- 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
This commit is contained in:
hbeham
2014-11-04 11:15:34 +01:00
parent 7a7dd56b3e
commit 62d7d647ae
10 changed files with 48 additions and 30 deletions

View File

@@ -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<int, DataMapping, ChannelInfo> 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++)
{

View File

@@ -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;

View File

@@ -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

View File

@@ -8,7 +8,7 @@ namespace ChanSort.Loader.Samsung
private const string _ChannelOrTransponder = "offChannelTransponder";
public DigitalChannel(int slot, SignalSource signalSource, DataMapping data,
IDictionary<int, decimal> transpFreq, bool sortedFavorites, IDictionary<int, string> providerNames) :
IDictionary<int, decimal> transpFreq, FavoritesIndexMode sortedFavorites, IDictionary<int, string> providerNames) :
base(data, sortedFavorites)
{
this.InitCommonData(slot, (SignalSource)((int)signalSource & ~(int)(SignalSource.TvAndRadio)), data);

View File

@@ -2,6 +2,22 @@
namespace ChanSort.Loader.Samsung
{
public enum FavoritesIndexMode
{
/// <summary>
/// D model uses values 0 and 1
/// </summary>
Flag = 0,
/// <summary>
/// E model uses -1 for not-a-fav and 1-x for a fav program number
/// </summary>
IndividuallySorted = 1,
/// <summary>
/// some F models and H series uses -1 for not-a-fav, but expects 1-x to match the main program number
/// </summary>
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");
}
}
}

View File

@@ -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<int,string> providerNames) :
public SatChannel(int slot, SignalSource presetList, DataMapping data, DataRoot dataRoot, FavoritesIndexMode sortedFavorites, IDictionary<int,string> providerNames) :
base(data, sortedFavorites)
{
this.InitCommonData(slot, SignalSource.DvbS | presetList, data);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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.