diff --git a/source/ChanSort.Api/Controller/CsvRefListSerializer.cs b/source/ChanSort.Api/Controller/CsvRefListSerializer.cs index 4df02cb..ef33063 100644 --- a/source/ChanSort.Api/Controller/CsvRefListSerializer.cs +++ b/source/ChanSort.Api/Controller/CsvRefListSerializer.cs @@ -31,6 +31,8 @@ namespace ChanSort.Api { this.Features.ChannelNameEdit = ChannelNameEditMode.All; this.Features.CanSkipChannels = true; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = true; this.Features.DeleteMode = DeleteMode.FlagWithoutPrNr; this.Features.CanHaveGaps = true; this.Features.EncryptedFlagEdit = false; diff --git a/source/ChanSort.Api/Controller/Editor.cs b/source/ChanSort.Api/Controller/Editor.cs index 4479435..8cd20a4 100644 --- a/source/ChanSort.Api/Controller/Editor.cs +++ b/source/ChanSort.Api/Controller/Editor.cs @@ -293,10 +293,14 @@ namespace ChanSort.Api chan.NewProgramNr = -1; tvChannel.SetPosition(0, newNr); - tvChannel.Skip = refChannel.Skip; - tvChannel.Lock = refChannel.Lock; - tvChannel.Hidden = refChannel.Hidden; - tvChannel.IsDeleted = refChannel.IsDeleted; + if (refDataRoot.CanSkip && this.DataRoot.CanSkip) + tvChannel.Skip = refChannel.Skip; + if (refDataRoot.CanLock && this.DataRoot.CanLock) + tvChannel.Lock = refChannel.Lock; + if (refDataRoot.CanHide && this.DataRoot.CanHide) + tvChannel.Hidden = refChannel.Hidden; + + //tvChannel.IsDeleted = refChannel.IsDeleted; if ((tvChannel.SignalSource & SignalSource.Analog) != 0 && !string.IsNullOrEmpty(refChannel.Name)) { tvChannel.Name = refChannel.Name; diff --git a/source/ChanSort.Api/Controller/SerializerBase.cs b/source/ChanSort.Api/Controller/SerializerBase.cs index 7ee7d02..e49e3c9 100644 --- a/source/ChanSort.Api/Controller/SerializerBase.cs +++ b/source/ChanSort.Api/Controller/SerializerBase.cs @@ -25,6 +25,8 @@ namespace ChanSort.Api public bool CleanUpChannelData { get; set; } public bool DeviceSettings { get; set; } public bool CanSkipChannels { get; set; } = true; + public bool CanLockChannels { get; set; } = true; + public bool CanHideChannels { get; set; } = true; public bool CanHaveGaps { get; set; } = true; public bool EncryptedFlagEdit { get; set; } public DeleteMode DeleteMode { get; set; } = DeleteMode.NotSupported; diff --git a/source/ChanSort.Api/Controller/TxtRefListSerializer.cs b/source/ChanSort.Api/Controller/TxtRefListSerializer.cs index 24fb89f..7ea4738 100644 --- a/source/ChanSort.Api/Controller/TxtRefListSerializer.cs +++ b/source/ChanSort.Api/Controller/TxtRefListSerializer.cs @@ -16,6 +16,8 @@ namespace ChanSort.Api { this.Features.ChannelNameEdit = ChannelNameEditMode.All; this.Features.CanSkipChannels = false; + this.Features.CanLockChannels = false; + this.Features.CanHideChannels = false; this.Features.DeleteMode = DeleteMode.Physically; this.Features.CanHaveGaps = true; this.Features.EncryptedFlagEdit = false; diff --git a/source/ChanSort.Api/Model/DataRoot.cs b/source/ChanSort.Api/Model/DataRoot.cs index 819796d..ecc70b3 100644 --- a/source/ChanSort.Api/Model/DataRoot.cs +++ b/source/ChanSort.Api/Model/DataRoot.cs @@ -23,6 +23,9 @@ namespace ChanSort.Api public bool MixedSourceFavorites => this.loader.Features.MixedSourceFavorites; public bool AllowGapsInFavNumbers => this.loader.Features.AllowGapsInFavNumbers; public bool DeletedChannelsNeedNumbers => this.loader.Features.DeleteMode == SerializerBase.DeleteMode.FlagWithPrNr; + public bool CanSkip => this.loader.Features.CanSkipChannels; + public bool CanLock => this.loader.Features.CanLockChannels; + public bool CanHide => this.loader.Features.CanHideChannels; public DataRoot(SerializerBase loader) { diff --git a/source/ChanSort.Loader.GlobalClone/GcSerializer.cs b/source/ChanSort.Loader.GlobalClone/GcSerializer.cs index eb15b52..e9f0fad 100644 --- a/source/ChanSort.Loader.GlobalClone/GcSerializer.cs +++ b/source/ChanSort.Loader.GlobalClone/GcSerializer.cs @@ -25,8 +25,11 @@ namespace ChanSort.Loader.GlobalClone public GcSerializer(string inputFile) : base(inputFile) { this.Features.ChannelNameEdit = ChannelNameEditMode.All; - this.Features.DeleteMode = DeleteMode.FlagWithPrNr; + this.Features.DeleteMode = DeleteMode.FlagWithoutPrNr; this.Features.CanHaveGaps = true; + this.Features.CanSkipChannels = true; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = true; this.DataRoot.AddChannelList(this.atvChannels); this.DataRoot.AddChannelList(this.dtvTvChannels); @@ -272,7 +275,7 @@ namespace ChanSort.Loader.GlobalClone case "transport_id": ch.TransportStreamId = int.Parse(info.InnerText); break; - case "service_id": + case "service_id": // also same value in "programNo" ch.ServiceId = int.Parse(info.InnerText); break; case "serviceType": @@ -320,7 +323,7 @@ namespace ChanSort.Loader.GlobalClone this.Features.SupportedFavorites |= (Favorites)mask; this.Features.SortedFavorites = true; if (((int)ch.Favorites & mask) != 0) // xml element holds bad index data (250) when fav is not set - ch.SetPosition(n + 1, int.Parse(info.InnerText)); + ch.SetOldPosition(n + 1, int.Parse(info.InnerText)); } break; } @@ -379,7 +382,6 @@ namespace ChanSort.Loader.GlobalClone { foreach (var list in this.DataRoot.ChannelLists) { - foreach (var channel in list.Channels) { var ch = channel as GcChannel; @@ -425,17 +427,25 @@ namespace ChanSort.Loader.GlobalClone // ? break; case "isDisabled": - node.InnerText = ch.IsDeleted || ch.IsDisabled ? "1" : "0"; + node.InnerText = ch.IsDisabled /* || ch.IsDeleted */ ? "1" : "0"; break; case "isDeleted": node.InnerText = ch.IsDeleted ? "1" : "0"; break; case "isUserSelCHNo": if (ch.NewProgramNr != ch.OldProgramNr) - node.InnerText = "1"; + node.InnerText = ch.IsDeleted ? "0" : "1"; break; case "mapType": mapType = node.InnerText; + if (int.TryParse(mapType, out int value)) + { + if (ch.IsDeleted) + value |= 0x02; // all channels that have isDeleted=1 had mapType=0x03, all other channels had mapType=0x01 + else + value &= ~0x02; + node.InnerText = value.ToString(); + } break; case "mapAttr": if (mapType == "1") @@ -474,6 +484,9 @@ namespace ChanSort.Loader.GlobalClone xml = "\r\n\r\n" + xml; xml = xml.Replace("\r\n", "\r\n\r\n"); xml = xml.Replace("\r\n", "\r\n\r\n"); + xml = xml.Replace("", " "); + xml = xml.Replace("", " "); + if (!xml.EndsWith("\r\n")) xml += "\r\n"; File.WriteAllText(tvOutputFile, xml, settings.Encoding); diff --git a/source/ChanSort.Loader.Hisense/HisDbSerializer.cs b/source/ChanSort.Loader.Hisense/HisDbSerializer.cs index a4f2523..9076d59 100644 --- a/source/ChanSort.Loader.Hisense/HisDbSerializer.cs +++ b/source/ChanSort.Loader.Hisense/HisDbSerializer.cs @@ -94,6 +94,8 @@ namespace ChanSort.Loader.Hisense this.Features.ChannelNameEdit = ChannelNameEditMode.All; this.Features.DeleteMode = DeleteMode.NotSupported; this.Features.CanSkipChannels = false; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = true; this.Features.CanHaveGaps = true; this.Features.SortedFavorites = true; diff --git a/source/ChanSort.Loader.Hisense2017/HisDbSerializer.cs b/source/ChanSort.Loader.Hisense2017/HisDbSerializer.cs index 5bb084e..ccb5ca3 100644 --- a/source/ChanSort.Loader.Hisense2017/HisDbSerializer.cs +++ b/source/ChanSort.Loader.Hisense2017/HisDbSerializer.cs @@ -121,6 +121,8 @@ namespace ChanSort.Loader.Hisense2017 Features.ChannelNameEdit = ChannelNameEditMode.All; Features.DeleteMode = DeleteMode.FlagWithPrNr; Features.CanSkipChannels = true; + Features.CanLockChannels = true; + Features.CanHideChannels = true; Features.CanHaveGaps = true; Features.MixedSourceFavorites = true; Features.SortedFavorites = true; diff --git a/source/ChanSort.Loader.LG/TllFileSerializer.cs b/source/ChanSort.Loader.LG/TllFileSerializer.cs index 31b0e8b..6100cc1 100644 --- a/source/ChanSort.Loader.LG/TllFileSerializer.cs +++ b/source/ChanSort.Loader.LG/TllFileSerializer.cs @@ -77,6 +77,9 @@ namespace ChanSort.Loader.LG { this.Features.ChannelNameEdit = ChannelNameEditMode.Analog; this.Features.DeleteMode = DeleteMode.FlagWithoutPrNr; + this.Features.CanSkipChannels = true; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = true; this.Features.CanHaveGaps = true; this.Features.DeviceSettings = true; this.Features.CleanUpChannelData = true; diff --git a/source/ChanSort.Loader.Panasonic/Serializer.cs b/source/ChanSort.Loader.Panasonic/Serializer.cs index 10ff2d2..58266e3 100644 --- a/source/ChanSort.Loader.Panasonic/Serializer.cs +++ b/source/ChanSort.Loader.Panasonic/Serializer.cs @@ -41,6 +41,9 @@ namespace ChanSort.Loader.Panasonic this.Features.ChannelNameEdit = ChannelNameEditMode.None; // due to the chaos with binary data inside the "sname" string column, writing back a name has undesired side effects this.Features.DeleteMode = DeleteMode.Physically; + this.Features.CanSkipChannels = true; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = false; this.Features.CanHaveGaps = false; this.Features.EncryptedFlagEdit = true; this.Features.SortedFavorites = true; diff --git a/source/ChanSort.Loader.PhilipsXml/Serializer.cs b/source/ChanSort.Loader.PhilipsXml/Serializer.cs index c18f576..9df149f 100644 --- a/source/ChanSort.Loader.PhilipsXml/Serializer.cs +++ b/source/ChanSort.Loader.PhilipsXml/Serializer.cs @@ -11,12 +11,30 @@ namespace ChanSort.Loader.PhilipsXml { /* This loader supports 2 different kinds of XML files from Philips. - - I had a test file "DVBS.xml" with satellite channels and entries like: + - - + + + + Example from a ChannelMap_100\ChannelList\channellib\DVBC.xml: + + + + + + Example from a ChannelMap_105\ChannelList\s2channellib\DVBS.xml: + + + + + + Example from a ChannelMap_110\ChannelList\channellib\DVBC.xml: + + + + + The other file was "CM_TPM1013E_LA_CK.xml" with entries like: @@ -43,6 +61,9 @@ namespace ChanSort.Loader.PhilipsXml public Serializer(string inputFile) : base(inputFile) { this.Features.ChannelNameEdit = ChannelNameEditMode.All; + this.Features.CanSkipChannels = false; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = true; this.Features.DeleteMode = DeleteMode.Physically; this.Features.CanSaveAs = false; @@ -252,8 +273,10 @@ namespace ChanSort.Loader.PhilipsXml foreach(XmlAttribute attr in n.Attributes) data.Add(attr.LocalName, attr.Value); } - - var chan = new Channel(curList.SignalSource & SignalSource.MaskAdInput, rowId, rowId, setupNode); + + if (!int.TryParse(data["UniqueID"], out var uniqueId)) // UniqueId only exists in ChannelMap_105 and later + uniqueId = rowId; + var chan = new Channel(curList.SignalSource & SignalSource.MaskAdInput, rowId, uniqueId, setupNode); chan.OldProgramNr = -1; chan.IsDeleted = false; if (file.formatVersion == 1) diff --git a/source/ChanSort.Loader.Samsung/ScmSerializer.cs b/source/ChanSort.Loader.Samsung/ScmSerializer.cs index aa3a7fc..97dd21b 100644 --- a/source/ChanSort.Loader.Samsung/ScmSerializer.cs +++ b/source/ChanSort.Loader.Samsung/ScmSerializer.cs @@ -63,6 +63,9 @@ namespace ChanSort.Loader.Samsung this.ReadConfigurationFromIniFile(); this.Features.ChannelNameEdit = ChannelNameEditMode.All; this.Features.DeleteMode = DeleteMode.FlagWithPrNr; + this.Features.CanSkipChannels = true; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = true; this.Features.CleanUpChannelData = true; this.Features.EncryptedFlagEdit = true; } diff --git a/source/ChanSort.Loader.SamsungJ/DbSerializer.cs b/source/ChanSort.Loader.SamsungJ/DbSerializer.cs index 568c40f..7b07c9d 100644 --- a/source/ChanSort.Loader.SamsungJ/DbSerializer.cs +++ b/source/ChanSort.Loader.SamsungJ/DbSerializer.cs @@ -26,6 +26,9 @@ namespace ChanSort.Loader.SamsungJ this.Features.ChannelNameEdit = ChannelNameEditMode.All; this.Features.DeleteMode = DeleteMode.Physically; + this.Features.CanSkipChannels = true; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = true; this.Features.SupportedFavorites = Favorites.A | Favorites.B | Favorites.C | Favorites.D | Favorites.E; this.Features.SortedFavorites = true; this.Features.AllowGapsInFavNumbers = false; diff --git a/source/ChanSort.Loader.SilvaSchneider/Serializer.cs b/source/ChanSort.Loader.SilvaSchneider/Serializer.cs index 7080c53..cb61388 100644 --- a/source/ChanSort.Loader.SilvaSchneider/Serializer.cs +++ b/source/ChanSort.Loader.SilvaSchneider/Serializer.cs @@ -17,6 +17,9 @@ namespace ChanSort.Loader.SilvaSchneider { this.Features.ChannelNameEdit = ChannelNameEditMode.None; this.Features.DeleteMode = DeleteMode.Physically; + this.Features.CanSkipChannels = false; + this.Features.CanLockChannels = false; + this.Features.CanHideChannels = false; this.Features.SortedFavorites = false; this.Features.SupportedFavorites = 0; diff --git a/source/ChanSort.Loader.Sony/Serializer.cs b/source/ChanSort.Loader.Sony/Serializer.cs index 9f84bbe..6edb1b0 100644 --- a/source/ChanSort.Loader.Sony/Serializer.cs +++ b/source/ChanSort.Loader.Sony/Serializer.cs @@ -65,6 +65,10 @@ namespace ChanSort.Loader.Sony this.Features.DeleteMode = DeleteMode.FlagWithoutPrNr; // in Android/e-format, this will be changed to FlagWithPrNr this.Features.MixedSourceFavorites = false; // true for Android/e-format this.Features.SortedFavorites = false; // true for Android/e-format + this.Features.CanSkipChannels = false; + this.Features.CanLockChannels = false; + this.Features.CanHideChannels = false; // true in Android/e-format + this.DataRoot.AddChannelList(new ChannelList(SignalSource.DvbT | SignalSource.Tv, "DVB-T TV")); this.DataRoot.AddChannelList(new ChannelList(SignalSource.DvbT | SignalSource.Radio, "DVB-T Radio")); @@ -164,6 +168,7 @@ namespace ChanSort.Loader.Sony this.format = "e" + formatNode.InnerText; this.isEFormat = true; this.Features.DeleteMode = DeleteMode.FlagWithPrNr; + this.Features.CanHideChannels = true; this.Features.MixedSourceFavorites = true; this.Features.SortedFavorites = true; this.mixedFavList = new ChannelList(SignalSource.All, "Favorites"); diff --git a/source/ChanSort.Loader.Toshiba/DbSerializer.cs b/source/ChanSort.Loader.Toshiba/DbSerializer.cs index 6188604..053549c 100644 --- a/source/ChanSort.Loader.Toshiba/DbSerializer.cs +++ b/source/ChanSort.Loader.Toshiba/DbSerializer.cs @@ -25,6 +25,9 @@ namespace ChanSort.Loader.Toshiba this.Features.ChannelNameEdit = ChannelNameEditMode.All; this.Features.DeleteMode = DeleteMode.Physically; + this.Features.CanSkipChannels = false; + this.Features.CanLockChannels = true; + this.Features.CanHideChannels = false; // true in Android/e-format this.DataRoot.AddChannelList(this.atvChannels); this.DataRoot.AddChannelList(this.dtvTvChannels); diff --git a/source/ChanSort/MainForm.cs b/source/ChanSort/MainForm.cs index 98a5c5f..0c8d1be 100644 --- a/source/ChanSort/MainForm.cs +++ b/source/ChanSort/MainForm.cs @@ -1480,7 +1480,7 @@ namespace ChanSort.Ui { if (filter.Contains("+" + col.FieldName)) // force-show without further checks return true; - if (!filter.Contains(col.FieldName)) // force-hide without further checks + if (filter.Contains("-" + col.FieldName) || !filter.Contains(col.FieldName)) // force-hide without further checks return false; } else if (col.Tag is bool originalVisible && !originalVisible) @@ -1497,7 +1497,6 @@ namespace ChanSort.Ui if (col == this.colAudioPid) return (source & SignalSource.Digital) != 0; //if (col == this.colServiceType) return (source & SignalSource.Digital) != 0; if (col == this.colServiceTypeName) return (source & SignalSource.Digital) != 0; - if (col == this.colEncrypted) return (source & SignalSource.Digital) != 0; if (col == this.colTransportStreamId) return (source & SignalSource.Digital) != 0; if (col == this.colNetworkName) return (source & SignalSource.Digital) != 0; if (col == this.colNetworkOperator) return (source & SignalSource.Digital) != 0; @@ -1505,6 +1504,9 @@ namespace ChanSort.Ui if (col == this.colSatellite) return (source & SignalSource.Sat) != 0; if (col == this.colNetworkId) return (source & SignalSource.Digital) != 0; if (col == this.colSymbolRate) return (source & SignalSource.Digital) != 0; + if (col == this.colSkip) return (source & SignalSource.Digital) != 0 && this.DataRoot.CanSkip; + if (col == this.colLock) return (source & SignalSource.Digital) != 0 && this.DataRoot.CanLock; + if (col == this.colHidden) return (source & SignalSource.Digital) != 0 && this.DataRoot.CanHide; if (col == this.colIndex) return col.Visible; if (col == this.colUid) return col.Visible; if (col == this.colDebug) return col.Visible; @@ -1643,6 +1645,8 @@ namespace ChanSort.Ui this.miMoveDown.Visibility = visLeft; this.miAddChannel.Visibility = visRight; this.miSkipOn.Enabled = this.miSkipOff.Enabled = this.currentTvSerializer?.Features.CanSkipChannels ?? false; + this.miLockOn.Enabled = this.miLockOff.Enabled = this.currentTvSerializer?.Features.CanLockChannels ?? false; + this.miHideOn.Enabled = this.miHideOff.Enabled = this.currentTvSerializer?.Features.CanHideChannels ?? false; var isLeftGridSortedByNewProgNr = this.IsLeftGridSortedByNewProgNr; var sel = this.gviewLeft.GetSelectedRows(); diff --git a/source/changelog.md b/source/changelog.md index 574bc51..3ae8313 100644 --- a/source/changelog.md +++ b/source/changelog.md @@ -1,6 +1,15 @@ ChanSort Change Log =================== +2019-11-24 +- LG GlobalClone: Favorites were not loaded correctly into ChanSort +- LG GlobalClone: some changes that might fix problems where the TV didn't work properly + with an importet list (ChanSort now modifies less data in the file) +- Menu items for hide/unhide, skip/unskip, lock/unlock are now disabled when these features are not supported by the + channel list file format +- Applying a .txt reference list (which doesn't contain information about skip/lock/hide) will no longer clear these + flags in the current channel list + 2019-11-18 - Philips: fixed file detection in some ChannelMap_xxx folder structures