From 62d7d647aeb61bffe04a55f4b99e37b19f552ac1 Mon Sep 17 00:00:00 2001 From: hbeham Date: Tue, 4 Nov 2014 11:15:34 +0100 Subject: [PATCH] - physically remove channel data from LG's LD/LE/LH series files (which require physical reordering of channels) - fixed handling of favorite channel indices for Samsung F and H series --- ChanSort.Loader.LG/TllFileSerializer.cs | 7 ++++--- ChanSort.Loader.Samsung/AnalogChannel.cs | 2 +- .../ChanSort.Loader.Samsung.ini | 4 ++-- ChanSort.Loader.Samsung/DigitalChannel.cs | 2 +- ChanSort.Loader.Samsung/ModelConstants.cs | 20 +++++++++++++++++-- ChanSort.Loader.Samsung/SatChannel.cs | 2 +- ChanSort.Loader.Samsung/ScmChannelBase.cs | 19 +++++++++++------- ChanSort.Loader.Samsung/ScmSerializer.cs | 2 +- ChanSort/MainForm.cs | 2 +- readme.txt | 18 +++++++---------- 10 files changed, 48 insertions(+), 30 deletions(-) diff --git a/ChanSort.Loader.LG/TllFileSerializer.cs b/ChanSort.Loader.LG/TllFileSerializer.cs index 0e87b22..79374c2 100644 --- a/ChanSort.Loader.LG/TllFileSerializer.cs +++ b/ChanSort.Loader.LG/TllFileSerializer.cs @@ -68,8 +68,8 @@ namespace ChanSort.Loader.LG private int deletedChannelsSoft; private int dvbsChannelsAtPr0; - private bool removeDeletedActChannels = false; - private bool mustReorganizeDvbs = false; + private bool removeDeletedActChannels; + private bool mustReorganizeDvbs; private decimal dvbsSymbolRateFactor; #region ctor() @@ -288,7 +288,7 @@ namespace ChanSort.Loader.LG private void ReadActChannelBlock(ref int off, out int channelCount, ref int recordSize, Func channelFactory) { - int blockSize = this.GetBlockSize(off, minSize: 2); + int blockSize = this.GetBlockSize(off, 2); off += 4; channelCount = BitConverter.ToInt32(fileContent, off); @@ -298,6 +298,7 @@ namespace ChanSort.Loader.LG recordSize = GetActChannelRecordSize(off, blockSize, channelCount); var actMapping = GetActChannelMapping(recordSize); this.reorderPhysically = actMapping.Settings.GetInt("reorderChannelData") != 0; + this.removeDeletedActChannels |= this.reorderPhysically; for (int i = 0; i < channelCount; i++) { diff --git a/ChanSort.Loader.Samsung/AnalogChannel.cs b/ChanSort.Loader.Samsung/AnalogChannel.cs index a29966b..3f38a0e 100644 --- a/ChanSort.Loader.Samsung/AnalogChannel.cs +++ b/ChanSort.Loader.Samsung/AnalogChannel.cs @@ -8,7 +8,7 @@ namespace ChanSort.Loader.Samsung #region ctor() - public AnalogChannel(int slot, bool isCable, DataMapping mapping, decimal freq, bool sortedFavorites) : + public AnalogChannel(int slot, bool isCable, DataMapping mapping, decimal freq, FavoritesIndexMode sortedFavorites) : base(mapping, sortedFavorites) { var signalSource = SignalSource.Analog | SignalSource.Tv; diff --git a/ChanSort.Loader.Samsung/ChanSort.Loader.Samsung.ini b/ChanSort.Loader.Samsung/ChanSort.Loader.Samsung.ini index 550c509..2065b71 100644 --- a/ChanSort.Loader.Samsung/ChanSort.Loader.Samsung.ini +++ b/ChanSort.Loader.Samsung/ChanSort.Loader.Samsung.ini @@ -54,7 +54,7 @@ map-SateD = 168 map-AstraHDPlusD = 212 Favorites = 5 - SortedFavorites = 0 + SortedFavorites = 2 [Series:H] SatDataBase.dat = 145 @@ -67,7 +67,7 @@ map-AstraHDPlusD = 212 map-CyfraPlusD = 172 Favorites = 5 - SortedFavorites = 0 + SortedFavorites = 2 [Analog:28] ; map-AirA and map-CableA for B series diff --git a/ChanSort.Loader.Samsung/DigitalChannel.cs b/ChanSort.Loader.Samsung/DigitalChannel.cs index e0a0db7..d196c68 100644 --- a/ChanSort.Loader.Samsung/DigitalChannel.cs +++ b/ChanSort.Loader.Samsung/DigitalChannel.cs @@ -8,7 +8,7 @@ namespace ChanSort.Loader.Samsung private const string _ChannelOrTransponder = "offChannelTransponder"; public DigitalChannel(int slot, SignalSource signalSource, DataMapping data, - IDictionary transpFreq, bool sortedFavorites, IDictionary providerNames) : + IDictionary transpFreq, FavoritesIndexMode sortedFavorites, IDictionary providerNames) : base(data, sortedFavorites) { this.InitCommonData(slot, (SignalSource)((int)signalSource & ~(int)(SignalSource.TvAndRadio)), data); diff --git a/ChanSort.Loader.Samsung/ModelConstants.cs b/ChanSort.Loader.Samsung/ModelConstants.cs index 015dd40..4dbbe73 100644 --- a/ChanSort.Loader.Samsung/ModelConstants.cs +++ b/ChanSort.Loader.Samsung/ModelConstants.cs @@ -2,6 +2,22 @@ namespace ChanSort.Loader.Samsung { + public enum FavoritesIndexMode + { + /// + /// D model uses values 0 and 1 + /// + Flag = 0, + /// + /// E model uses -1 for not-a-fav and 1-x for a fav program number + /// + IndividuallySorted = 1, + /// + /// some F models and H series uses -1 for not-a-fav, but expects 1-x to match the main program number + /// + MainProgramnrIndex = 2 + } + internal class ModelConstants { public readonly string series; @@ -16,7 +32,7 @@ namespace ChanSort.Loader.Samsung public readonly Favorites supportedFavorites; public readonly int ptcLength; public readonly int serviceProviderLength; - public readonly bool SortedFavorites; + public readonly FavoritesIndexMode SortedFavorites; public readonly int cyfraPlusChannelSize; public ModelConstants(IniFile.Section iniSection) @@ -38,7 +54,7 @@ namespace ChanSort.Loader.Samsung for (int i = 0; i < numFavorites; i++) mask = (mask << 1) | 1; this.supportedFavorites = (Favorites)mask; - this.SortedFavorites = iniSection.GetInt("SortedFavorites") != 0; + this.SortedFavorites = (FavoritesIndexMode)iniSection.GetInt("SortedFavorites"); } } } diff --git a/ChanSort.Loader.Samsung/SatChannel.cs b/ChanSort.Loader.Samsung/SatChannel.cs index 8765fc6..28ed8ae 100644 --- a/ChanSort.Loader.Samsung/SatChannel.cs +++ b/ChanSort.Loader.Samsung/SatChannel.cs @@ -7,7 +7,7 @@ namespace ChanSort.Loader.Samsung { private const string _TransponderIndex = "offTransponderIndex"; - public SatChannel(int slot, SignalSource presetList, DataMapping data, DataRoot dataRoot, bool sortedFavorites, IDictionary providerNames) : + public SatChannel(int slot, SignalSource presetList, DataMapping data, DataRoot dataRoot, FavoritesIndexMode sortedFavorites, IDictionary providerNames) : base(data, sortedFavorites) { this.InitCommonData(slot, SignalSource.DvbS | presetList, data); diff --git a/ChanSort.Loader.Samsung/ScmChannelBase.cs b/ChanSort.Loader.Samsung/ScmChannelBase.cs index 6035cb7..adb886d 100644 --- a/ChanSort.Loader.Samsung/ScmChannelBase.cs +++ b/ChanSort.Loader.Samsung/ScmChannelBase.cs @@ -31,7 +31,7 @@ namespace ChanSort.Loader.Samsung private const string _ServiceProviderId = "offServiceProviderId"; private static readonly Encoding Utf16BigEndian = new UnicodeEncoding(true, false); - private readonly bool sortedFavorites; + private readonly FavoritesIndexMode sortedFavorites; protected readonly DataMapping mapping; protected readonly byte[] rawData; @@ -39,7 +39,7 @@ namespace ChanSort.Loader.Samsung internal bool InUse { get; set; } - protected ScmChannelBase(DataMapping data, bool sortedFavorites) + protected ScmChannelBase(DataMapping data, FavoritesIndexMode sortedFavorites) { this.mapping = data; this.rawData = data.Data; @@ -80,9 +80,11 @@ namespace ChanSort.Loader.Samsung foreach (int off in offsets) { int favValue = BitConverter.ToInt32(this.rawData, baseOffset + off); - if (sortedFavorites && favValue != -1 || !sortedFavorites && favValue != 0) + if (sortedFavorites == FavoritesIndexMode.Flag && favValue != 0) fav |= mask; - if (sortedFavorites) + else if (sortedFavorites != FavoritesIndexMode.Flag && favValue != -1) + fav |= mask; + if (sortedFavorites == FavoritesIndexMode.IndividuallySorted) this.FavIndex[favIndex] = favValue; mask <<= 1; ++favIndex; @@ -171,10 +173,13 @@ namespace ChanSort.Loader.Samsung foreach (int off in offsets) { int favValue; - if (this.sortedFavorites) - favValue = (fav & mask) != 0 ? this.FavIndex[favIndex] : -1; // E,F series - else + if (this.sortedFavorites == FavoritesIndexMode.Flag) // D series favValue = (fav & mask) != 0 ? 1 : 0; // D series + else if (this.sortedFavorites == FavoritesIndexMode.IndividuallySorted) // E series (and some F models with early firmware) + favValue = (fav & mask) != 0 ? this.FavIndex[favIndex] : -1; + else + favValue = (fav & mask) != 0 ? this.NewProgramNr : -1; // F series (newer models/firmware), H series + Array.Copy(BitConverter.GetBytes(favValue), 0, this.rawData, baseOffset + off, 4); mask <<= 1; ++favIndex; diff --git a/ChanSort.Loader.Samsung/ScmSerializer.cs b/ChanSort.Loader.Samsung/ScmSerializer.cs index d3efdf2..a88b104 100644 --- a/ChanSort.Loader.Samsung/ScmSerializer.cs +++ b/ChanSort.Loader.Samsung/ScmSerializer.cs @@ -112,7 +112,7 @@ namespace ChanSort.Loader.Samsung { DetectModelConstants(zip); DataRoot.SupportedFavorites = c.supportedFavorites; - DataRoot.SortedFavorites = c.SortedFavorites; + DataRoot.SortedFavorites = c.SortedFavorites == FavoritesIndexMode.IndividuallySorted; ReadAnalogFineTuning(zip); ReadAnalogChannels(zip, "map-AirA", this.avbtChannels, out this.avbtFileContent, this.avbtFrequency); diff --git a/ChanSort/MainForm.cs b/ChanSort/MainForm.cs index 405bbfe..ba5f3f5 100644 --- a/ChanSort/MainForm.cs +++ b/ChanSort/MainForm.cs @@ -25,7 +25,7 @@ namespace ChanSort.Ui { public partial class MainForm : XtraForm { - public const string AppVersion = "v2014-11-02"; + public const string AppVersion = "v2014-11-04"; private const int MaxMruEntries = 10; diff --git a/readme.txt b/readme.txt index fc9a73f..ef261eb 100644 --- a/readme.txt +++ b/readme.txt @@ -1,16 +1,8 @@ -Version v2014-11-02 ======================================================= +Version v2014-11-04 ======================================================= Changes: -- fixed reading Samsung channel lists containing empty satellite records -- disabled individual sorting of favorite lists for Samsung F and H series. - It appears that only the E series firmware supports this feature. -- disabled deleting of channels from LG's GlobalClone channel lists because - the TV does not support this. Instead they are appended at the end of the - list. -- added support for Samsung "map-AirCableMixedA" and "map-AirCableMixedD" - channel lists (used by some hospitality TVs) -- disabled editing of channel names for Panasonic lists to prevent side - effects after saving (e.g. incorrect alphabetical sorting shown on TV) +- fixed handling of favorites for Samsung F and H series +- fixed deleting of channels for older LG models (LD,LE,LH) The complete change log can be found at the end of this document @@ -126,6 +118,10 @@ OTHER DEALINGS IN THE SOFTWARE. Change log ================================================================ +2014-11-04 +- fixed handling of favorites for Samsung F and H series +- fixed deleting of channels for older LG models (LD,LE,LH) + 2014-11-02 - fixed reading Samsung channel lists containing empty satellite records - disabled individual sorting of favorite lists for Samsung F and H series.