mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-07-04 11:57:46 +02:00
- processing Samsung's ServiceProvider file
- upgraded to DevExpress 13.2.6
This commit is contained in:
@@ -120,6 +120,12 @@
|
||||
[PTC:12]
|
||||
offFrequency = 4
|
||||
offChannelTransponder = 8
|
||||
|
||||
[ServiceProvider:108]
|
||||
offSignalSource = 0
|
||||
offIndex = 2
|
||||
offLenName = 6
|
||||
offName = 8
|
||||
|
||||
[DvbCT:248]
|
||||
; map-AirD and map-CableD for B series
|
||||
@@ -141,7 +147,7 @@
|
||||
offChannelTransponder = 26
|
||||
offLogicalProgramNr = 28
|
||||
offSymbolRate = 32
|
||||
offBouqet = 34
|
||||
offBouquet = 34
|
||||
offTransportStreamId = 36
|
||||
offName = 44
|
||||
lenName = 100
|
||||
@@ -158,6 +164,7 @@
|
||||
offServiceId = 6
|
||||
offDeleted = 8
|
||||
maskDeleted = 0x01
|
||||
offSignalSource = 10
|
||||
offQam = 12
|
||||
offBandwidth = 14
|
||||
offServiceType = 15
|
||||
@@ -186,13 +193,14 @@
|
||||
|
||||
|
||||
[DvbCT:320]
|
||||
; map-AirD and map-CableD for D,E and F series
|
||||
; map-AirD, map-CableD, Freesat for D,E and F series
|
||||
offProgramNr = 0
|
||||
offVideoPid = 2
|
||||
offPcrPid = 4
|
||||
offServiceId = 6
|
||||
offDeleted = 8
|
||||
maskDeleted = 0x01
|
||||
offSignalSource = 10
|
||||
offQam = 12
|
||||
offBandwidth = 14
|
||||
offServiceType = 15
|
||||
@@ -242,6 +250,7 @@
|
||||
offPcrPid = 4
|
||||
offInUse = 7
|
||||
maskInUse = 0x01
|
||||
offSignalSource = 10
|
||||
offLock = 13
|
||||
maskLock = 0x01
|
||||
offServiceType = 14
|
||||
@@ -256,7 +265,7 @@
|
||||
lenName = 100
|
||||
offEncrypted = 136
|
||||
maskEncrypted = 0x01
|
||||
offBouquet = 138
|
||||
offServiceProviderId = 138
|
||||
offFavorites = 142
|
||||
offChecksum = 143
|
||||
|
||||
@@ -267,6 +276,7 @@
|
||||
offPcrPid = 4
|
||||
offInUse = 7
|
||||
maskInUse = 0x01
|
||||
offSignalSource = 10
|
||||
offLock = 13
|
||||
maskLock = 0x01
|
||||
offServiceType = 14
|
||||
@@ -281,7 +291,7 @@
|
||||
lenName = 100
|
||||
offEncrypted = 136
|
||||
maskEncrypted = 0x01
|
||||
offBouquet = 138
|
||||
offServiceProviderId = 138
|
||||
offFavorites = 140,144,148,152,156
|
||||
offChecksum = 171
|
||||
|
||||
@@ -292,6 +302,7 @@
|
||||
offPcrPid = 4
|
||||
offInUse = 7
|
||||
maskInUse = 0x01
|
||||
offSignalSource = 10
|
||||
offLock = 13
|
||||
maskLock = 0x01
|
||||
offServiceType = 14
|
||||
@@ -306,7 +317,7 @@
|
||||
offEncrypted = 136
|
||||
maskEncrypted = 0x01
|
||||
lenName = 100
|
||||
offBouquet = 138
|
||||
offServiceProviderId = 138
|
||||
offFavorites = 140,144,148,152,156
|
||||
offChecksum = 167
|
||||
|
||||
@@ -317,6 +328,7 @@
|
||||
offPcrId=4
|
||||
offInUse = 7
|
||||
maskInUse = 0x01
|
||||
offSignalSource = 10
|
||||
offLock = 13
|
||||
maskLock = 0x01
|
||||
offServiceType = 14
|
||||
|
||||
@@ -7,18 +7,16 @@ namespace ChanSort.Loader.Samsung
|
||||
{
|
||||
private const string _ChannelOrTransponder = "offChannelTransponder";
|
||||
|
||||
public DigitalChannel(int slot, bool isCable, DataMapping data,
|
||||
IDictionary<int, decimal> transpFreq, bool sortedFavorites) :
|
||||
public DigitalChannel(int slot, SignalSource signalSource, DataMapping data,
|
||||
IDictionary<int, decimal> transpFreq, bool sortedFavorites, IDictionary<int, string> providerNames) :
|
||||
base(data, sortedFavorites)
|
||||
{
|
||||
var signalSource = SignalSource.Digital;
|
||||
signalSource |= isCable ? SignalSource.Cable : SignalSource.Antenna;
|
||||
this.InitCommonData(slot, signalSource, data);
|
||||
this.InitCommonData(slot, (SignalSource)((int)signalSource & ~(int)(SignalSource.TvAndRadio)), data);
|
||||
|
||||
if (this.OldProgramNr == 0)
|
||||
return;
|
||||
|
||||
this.InitDvbData(data);
|
||||
this.InitDvbData(data, providerNames);
|
||||
|
||||
int transp = data.GetByte(_ChannelOrTransponder);
|
||||
decimal freq = transpFreq.TryGet(transp);
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace ChanSort.Loader.Samsung
|
||||
public readonly int dvbtFineTuneLength;
|
||||
public readonly Favorites supportedFavorites;
|
||||
public readonly int ptcLength;
|
||||
public readonly int serviceProviderLength;
|
||||
public readonly bool SortedFavorites;
|
||||
|
||||
public ModelConstants(IniFile.Section iniSection)
|
||||
@@ -29,6 +30,7 @@ namespace ChanSort.Loader.Samsung
|
||||
this.dvbsTransponderLength = iniSection.GetInt("TransponderDataBase.dat");
|
||||
this.avbtFineTuneLength = iniSection.GetInt("FineTune");
|
||||
this.dvbtFineTuneLength = iniSection.GetInt("FineTune_Digital");
|
||||
this.serviceProviderLength = iniSection.GetInt("ServiceProvider", 108);
|
||||
int numFavorites = iniSection.GetInt("Favorites");
|
||||
int mask = 0;
|
||||
for (int i = 0; i < numFavorites; i++)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ChanSort.Api;
|
||||
using System.Collections.Generic;
|
||||
using ChanSort.Api;
|
||||
|
||||
namespace ChanSort.Loader.Samsung
|
||||
{
|
||||
@@ -6,14 +7,14 @@ namespace ChanSort.Loader.Samsung
|
||||
{
|
||||
private const string _TransponderIndex = "offTransponderIndex";
|
||||
|
||||
public SatChannel(int slot, SignalSource presetList, DataMapping data, DataRoot dataRoot, bool sortedFavorites) :
|
||||
public SatChannel(int slot, SignalSource presetList, DataMapping data, DataRoot dataRoot, bool sortedFavorites, IDictionary<int,string> providerNames) :
|
||||
base(data, sortedFavorites)
|
||||
{
|
||||
this.InitCommonData(slot, SignalSource.DvbS | presetList, data);
|
||||
if (!this.InUse)
|
||||
return;
|
||||
|
||||
this.InitDvbData(data);
|
||||
this.InitDvbData(data, providerNames);
|
||||
|
||||
int transponderIndex = data.GetWord(_TransponderIndex);
|
||||
Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ChanSort.Api;
|
||||
|
||||
@@ -27,6 +28,7 @@ namespace ChanSort.Loader.Samsung
|
||||
private const string _TransportStreamId = "offTransportStreamId";
|
||||
private const string _ServiceType = "offServiceType";
|
||||
private const string _SymbolRate = "offSymbolRate";
|
||||
private const string _ServiceProviderId = "offServiceProviderId";
|
||||
|
||||
private static readonly Encoding Utf16BigEndian = new UnicodeEncoding(true, false);
|
||||
private readonly bool sortedFavorites;
|
||||
@@ -91,7 +93,7 @@ namespace ChanSort.Loader.Samsung
|
||||
|
||||
|
||||
#region InitDvbData()
|
||||
protected void InitDvbData(DataMapping data)
|
||||
protected void InitDvbData(DataMapping data, IDictionary<int, string> providerNames)
|
||||
{
|
||||
this.ShortName = data.GetString(_ShortName, data.Settings.GetInt("lenShortName"));
|
||||
this.ServiceId = data.GetWord(_ServiceId);
|
||||
@@ -102,7 +104,22 @@ namespace ChanSort.Loader.Samsung
|
||||
this.TransportStreamId = data.GetWord(_TransportStreamId);
|
||||
this.ServiceType = data.GetByte(_ServiceType);
|
||||
this.SymbolRate = data.GetWord(_SymbolRate);
|
||||
|
||||
if (data.Settings.GetInt(_ServiceProviderId, -1) != -1)
|
||||
{
|
||||
int source = -1;
|
||||
if ((this.SignalSource & SignalSource.MaskProvider) == SignalSource.Freesat)
|
||||
source = 4;
|
||||
else if ((this.SignalSource & SignalSource.MaskProvider) == SignalSource.TivuSat)
|
||||
source = 6;
|
||||
else if ((this.SignalSource & SignalSource.Antenna) != 0)
|
||||
source = 0;
|
||||
else if ((this.SignalSource & SignalSource.Cable) != 0)
|
||||
source = 1;
|
||||
else if ((this.SignalSource & SignalSource.Sat) != 0)
|
||||
source = 3;
|
||||
int providerId = data.GetWord(_ServiceProviderId);
|
||||
this.Provider = providerNames.TryGet((source << 16) + providerId);
|
||||
}
|
||||
this.SignalSource |= LookupData.Instance.IsRadioOrTv(this.ServiceType);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -18,15 +18,17 @@ namespace ChanSort.Loader.Samsung
|
||||
private readonly MappingPool<DataMapping> analogFineTuneMappings = new MappingPool<DataMapping>("FineTune");
|
||||
private readonly MappingPool<DataMapping> ptccableMappings = new MappingPool<DataMapping>("PTC");
|
||||
private readonly MappingPool<DataMapping> transponderMappings = new MappingPool<DataMapping>("TransponderDataBase");
|
||||
private readonly MappingPool<DataMapping> serviceProviderMappings = new MappingPool<DataMapping>("ServiceProvider");
|
||||
|
||||
private readonly ChannelList avbtChannels = new ChannelList(SignalSource.AnalogT|SignalSource.TvAndRadio, "Analog Air");
|
||||
private readonly ChannelList avbcChannels = new ChannelList(SignalSource.AnalogC|SignalSource.TvAndRadio, "Analog Cable");
|
||||
private readonly ChannelList dvbtChannels = new ChannelList(SignalSource.DvbT | SignalSource.Tv, "Digital Air");
|
||||
private readonly ChannelList dvbcChannels = new ChannelList(SignalSource.DvbC | SignalSource.TvAndRadio, "Digital Cable");
|
||||
private readonly ChannelList dvbsChannels = new ChannelList(SignalSource.DvbS | SignalSource.TvAndRadio, "Satellite");
|
||||
private readonly ChannelList hdplusChannels = new ChannelList(SignalSource.HdPlusD | SignalSource.TvAndRadio, "Astra HD+");
|
||||
private readonly ChannelList freesatChannels = new ChannelList(SignalSource.HdPlusD | SignalSource.TvAndRadio, "Freesat");
|
||||
private readonly ChannelList primeChannels = new ChannelList(SignalSource.CablePrimeD | SignalSource.TvAndRadio, "Cable Prime");
|
||||
private readonly ChannelList hdplusChannels = new ChannelList(SignalSource.HdPlusD | SignalSource.TvAndRadio, "Astra HD+");
|
||||
private readonly ChannelList freesatChannels = new ChannelList(SignalSource.FreesatD | SignalSource.TvAndRadio, "Freesat");
|
||||
private readonly ChannelList tivusatChannels = new ChannelList(SignalSource.TivuSatD | SignalSource.TvAndRadio, "TivuSat");
|
||||
|
||||
private readonly Dictionary<int, decimal> avbtFrequency = new Dictionary<int, decimal>();
|
||||
private readonly Dictionary<int, decimal> avbcFrequency = new Dictionary<int, decimal>();
|
||||
@@ -41,7 +43,9 @@ namespace ChanSort.Loader.Samsung
|
||||
private byte[] hdplusFileContent;
|
||||
private byte[] primeFileContent;
|
||||
private byte[] freesatFileContent;
|
||||
private byte[] tivusatFileContent;
|
||||
private ModelConstants c;
|
||||
private Dictionary<int, string> serviceProviderNames;
|
||||
|
||||
#region ctor()
|
||||
public ScmSerializer(string inputFile) : base(inputFile)
|
||||
@@ -84,6 +88,8 @@ namespace ChanSort.Loader.Samsung
|
||||
transponderMappings.AddMapping(len, new DataMapping(section));
|
||||
else if (section.Name.StartsWith("PTC:"))
|
||||
ptccableMappings.AddMapping(len, new DataMapping(section));
|
||||
else if (section.Name.StartsWith("ServiceProvider"))
|
||||
serviceProviderMappings.AddMapping(len, new DataMapping(section));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -101,11 +107,13 @@ namespace ChanSort.Loader.Samsung
|
||||
ReadAnalogChannels(zip, "map-AirA", this.avbtChannels, out this.avbtFileContent, this.avbtFrequency);
|
||||
ReadAnalogChannels(zip, "map-CableA", this.avbcChannels, out this.avbcFileContent, this.avbcFrequency);
|
||||
ReadDvbTransponderFrequenciesFromPtc(zip, "PTCAIR", this.dvbtFrequency);
|
||||
ReadDvbServiceProviders(zip);
|
||||
ReadDvbctChannels(zip, "map-AirD", this.dvbtChannels, out this.dvbtFileContent, this.dvbtFrequency);
|
||||
ReadDvbTransponderFrequenciesFromPtc(zip, "PTCCABLE", this.dvbcFrequency);
|
||||
ReadDvbctChannels(zip, "map-CableD", this.dvbcChannels, out this.dvbcFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(zip, "map-CablePrime_D", this.primeChannels, out this.primeFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(zip, "map-FreesatD", this.freesatChannels, out this.freesatFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(zip, "map-TivusatD", this.tivusatChannels, out this.tivusatFileContent, this.dvbcFrequency);
|
||||
ReadSatellites(zip);
|
||||
ReadTransponder(zip, "TransponderDataBase.dat");
|
||||
ReadTransponder(zip, "UserTransponderDataBase.dat");
|
||||
@@ -139,7 +147,9 @@ namespace ChanSort.Loader.Samsung
|
||||
{
|
||||
case "1001": series = "C"; break;
|
||||
case "1101": series = "D"; break;
|
||||
case "1201": series = "E"; break;
|
||||
case "1201":
|
||||
series = match.Groups[2].Value == "F" ? "F" : "E";
|
||||
break;
|
||||
default:
|
||||
series = match.Groups[1].Value.StartsWith("LT") ? "F" : match.Groups[2].Value;
|
||||
break;
|
||||
@@ -381,6 +391,31 @@ namespace ChanSort.Loader.Samsung
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ReadDvbServiceProviders()
|
||||
private void ReadDvbServiceProviders(ZipFile zip)
|
||||
{
|
||||
this.serviceProviderNames = new Dictionary<int, string>();
|
||||
var data = ReadFileContent(zip, "ServiceProviders");
|
||||
if (data == null) return;
|
||||
|
||||
if (data.Length % c.serviceProviderLength != 0) return;
|
||||
var mapping = serviceProviderMappings.GetMapping(c.serviceProviderLength, false);
|
||||
if (mapping == null) return;
|
||||
int count = data.Length/c.serviceProviderLength;
|
||||
var enc = new UnicodeEncoding(true, false);
|
||||
var offName = mapping.Settings.GetInt("offName");
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
mapping.SetDataPtr(data, i*c.serviceProviderLength);
|
||||
int source = mapping.GetWord("offSignalSource");
|
||||
int index = mapping.GetWord("offIndex");
|
||||
int len = System.Math.Min(mapping.GetWord("offLenName"), c.serviceProviderLength - offName);
|
||||
var name = len < 2 ? "" : enc.GetString(data, mapping.BaseOffset + offName, len);
|
||||
this.serviceProviderNames[(source << 16) + index] = name;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ReadDvbctChannels()
|
||||
private void ReadDvbctChannels(ZipFile zip, string fileName, ChannelList list, out byte[] data, Dictionary<int, decimal> frequency)
|
||||
{
|
||||
@@ -393,15 +428,15 @@ namespace ChanSort.Loader.Samsung
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
bool isCable = (list.SignalSource & SignalSource.Cable) != 0;
|
||||
this.DataRoot.AddChannelList(list);
|
||||
var source = list.SignalSource;
|
||||
DataMapping rawChannel = dvbctMappings.GetMapping(entrySize);
|
||||
list.MaxChannelNameLength = rawChannel.Settings.GetInt("lenName") / 2;
|
||||
rawChannel.SetDataPtr(data, 0);
|
||||
int count = data.Length / entrySize;
|
||||
for (int slotIndex = 0; slotIndex < count; slotIndex++)
|
||||
{
|
||||
DigitalChannel ci = new DigitalChannel(slotIndex, isCable, rawChannel, frequency, c.SortedFavorites);
|
||||
DigitalChannel ci = new DigitalChannel(slotIndex, source, rawChannel, frequency, c.SortedFavorites, this.serviceProviderNames);
|
||||
if (ci.InUse && !ci.IsDeleted && ci.OldProgramNr > 0)
|
||||
this.DataRoot.AddChannel(list, ci);
|
||||
|
||||
@@ -489,7 +524,7 @@ namespace ChanSort.Loader.Samsung
|
||||
mapping.SetDataPtr(dvbsFileContent, 0);
|
||||
for (int slotIndex = 0; slotIndex < count; slotIndex++)
|
||||
{
|
||||
SatChannel ci = new SatChannel(slotIndex, SignalSource.StandardSat, mapping, this.DataRoot, c.SortedFavorites);
|
||||
SatChannel ci = new SatChannel(slotIndex, SignalSource.StandardSat, mapping, this.DataRoot, c.SortedFavorites, this.serviceProviderNames);
|
||||
if (ci.InUse)
|
||||
this.DataRoot.AddChannel(this.dvbsChannels, ci);
|
||||
|
||||
@@ -512,7 +547,7 @@ namespace ChanSort.Loader.Samsung
|
||||
mapping.SetDataPtr(hdplusFileContent, 0);
|
||||
for (int slotIndex = 0; slotIndex < count; slotIndex++)
|
||||
{
|
||||
SatChannel ci = new SatChannel(slotIndex, SignalSource.AstraHdPlus, mapping, this.DataRoot, c.SortedFavorites);
|
||||
SatChannel ci = new SatChannel(slotIndex, SignalSource.AstraHdPlus, mapping, this.DataRoot, c.SortedFavorites, this.serviceProviderNames);
|
||||
if (ci.InUse)
|
||||
this.DataRoot.AddChannel(this.hdplusChannels, ci);
|
||||
mapping.BaseOffset += entrySize;
|
||||
@@ -555,6 +590,7 @@ namespace ChanSort.Loader.Samsung
|
||||
this.SaveChannels(zip, "map-AstraHDPlusD", this.hdplusChannels, this.hdplusFileContent);
|
||||
this.SaveChannels(zip, "map-CablePrime_D", this.primeChannels, this.primeFileContent);
|
||||
this.SaveChannels(zip, "map-FreesatD", this.freesatChannels, this.freesatFileContent);
|
||||
this.SaveChannels(zip, "map-TivusatD", this.tivusatChannels, this.tivusatFileContent);
|
||||
zip.CommitUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user