Skip to content

Commit

Permalink
- LG WebOS 5: added support for lists with analog cable/antenna channels
Browse files Browse the repository at this point in the history
- Philips: added support for analog channel lists (Repair/CM_* format)
- GB Freesat reference lists updated
- Hiding "Favorite" column when the list doesn't support favorites
  • Loading branch information
Horst Beham committed Aug 27, 2020
1 parent c1926f2 commit e1e2c8d
Show file tree
Hide file tree
Showing 7 changed files with 393 additions and 154 deletions.
78 changes: 52 additions & 26 deletions source/ChanSort.Loader.GlobalClone/GcJsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public GcJsonSerializer(string filename, string content) : base(filename)
this.Features.CanSkipChannels = true;
this.Features.CanLockChannels = true;

this.DataRoot.AddChannelList(new ChannelList(SignalSource.AnalogT | SignalSource.Tv | SignalSource.Data, "Analog Antenna"));
this.DataRoot.AddChannelList(new ChannelList(SignalSource.DvbT | SignalSource.Tv | SignalSource.Data, "DVB-T TV"));
this.DataRoot.AddChannelList(new ChannelList(SignalSource.DvbT | SignalSource.Radio, "DVB-T Radio"));
this.DataRoot.AddChannelList(new ChannelList(SignalSource.AnalogC | SignalSource.Tv | SignalSource.Data, "Analog Cable"));
this.DataRoot.AddChannelList(new ChannelList(SignalSource.DvbC | SignalSource.Tv | SignalSource.Data, "DVB-C TV"));
this.DataRoot.AddChannelList(new ChannelList(SignalSource.DvbC | SignalSource.Radio, "DVB-C Radio"));
this.DataRoot.AddChannelList(new ChannelList(SignalSource.DvbS | SignalSource.Tv | SignalSource.Data, "DVB-S TV"));
Expand Down Expand Up @@ -122,47 +124,71 @@ private void LoadChannels()
foreach (var node in this.doc["channelList"])
{
var ch = new GcChannel<JToken>(0, i, node);
ch.PcrPid = (int) node["pcrPid"];
ch.IsDisabled = (bool) node["disabled"];
ch.FreqInMhz = (int) node["frequency"];
if (ch.FreqInMhz >= 100000 && ch.FreqInMhz < 1000000) // DVBS is given in MHz, DVBC/T in kHz
ch.FreqInMhz /= 1000;
ch.AudioPid = (int) node["audioPid"];

ch.Source = (string) node["sourceIndex"];

ch.Source = (string)node["sourceIndex"];
if (ch.Source == "SATELLITE DIGITAL")
ch.SignalSource |= SignalSource.DvbS;
else if (ch.Source == "CABLE DIGITAL")
ch.SignalSource |= SignalSource.DvbC;
else if (ch.Source.Contains("DIGITAL")) // not seen yet. maybe DIGITAL ANTENNA?
else if (ch.Source.Contains("ANTENNA DIGITAL"))
ch.SignalSource |= SignalSource.DvbT;
else if (ch.Source.Contains("ANTENNA ANALOG"))
ch.SignalSource |= SignalSource.AnalogT;
else if (ch.Source.Contains("CABLE ANALOG"))
ch.SignalSource |= SignalSource.AnalogC;
else
{
// TODO: add some log for skipped channels
continue;
}

ch.IsDisabled = (bool) node["disabled"];
ch.Skip = (bool) node["skipped"];
ch.Lock = (bool)node["locked"];
ch.Hidden = (bool) node["Invisible"];
ch.IsDeleted = (bool) node["deleted"];
//if (int.TryParse((string) node["satelliteId"], out var satId))
ch.Satellite = (string) node["satelliteId"]; //this.DataRoot.Satellites.TryGet(satId);
ch.Encrypted = (bool) node["scrambled"];
var nameBytes = Convert.FromBase64String((string) node["chNameBase64"]);
dec.GetChannelNames(nameBytes, 0, nameBytes.Length, out var name, out var shortName);
ch.Name = name;
ch.ShortName = shortName;
ch.VideoPid = (int) node["videoPid"];
var transSystem = (string) node["transSystem"];
var tpId = (string) node["tpId"];
if (tpId != null && tpId.Length == 10)
ch.Transponder = this.DataRoot.Transponder.TryGet((int.Parse(tpId.Substring(0, 4)) << 16) + int.Parse(tpId.Substring(4))); // satId + freq, e.g. 0192126041
ch.TransportStreamId = (int) node["TSID"];

ch.OldProgramNr = ch.IsDeleted ? -1 : (int) node["majorNumber"];
ch.ServiceType = (int) node["serviceType"];
ch.Lock = (bool) node["locked"];
if (string.IsNullOrWhiteSpace(ch.Name))
ch.Name = (string)node["channelName"];
ch.ServiceId = (int) node["SVCID"];
if (ch.ServiceId == 0)
ch.ServiceId = (int) node["programNum"];
ch.OriginalNetworkId = (int) node["ONID"];
ch.SignalSource |= LookupData.Instance.IsRadioTvOrData(ch.ServiceType);

ch.TransportStreamId = (int)node["TSID"];

if ((ch.SignalSource & SignalSource.Digital) != 0)
{
var transSystem = (string) node["transSystem"];

//if (int.TryParse((string) node["satelliteId"], out var satId))
ch.Satellite = (string) node["satelliteId"]; //this.DataRoot.Satellites.TryGet(satId);
ch.Encrypted = (bool) node["scrambled"];
ch.FreqInMhz = (int) node["frequency"];
if (ch.FreqInMhz >= 100000 && ch.FreqInMhz < 1000000) // DVBS is given in MHz, DVBC/T in kHz
ch.FreqInMhz /= 1000;

var tpId = (string) node["tpId"];
if (tpId != null && tpId.Length == 10)
ch.Transponder = this.DataRoot.Transponder.TryGet((int.Parse(tpId.Substring(0, 4)) << 16) + int.Parse(tpId.Substring(4))); // satId + freq, e.g. 0192126041

ch.IsDeleted = (bool) node["deleted"];
ch.PcrPid = (int) node["pcrPid"];
ch.AudioPid = (int) node["audioPid"];
ch.VideoPid = (int) node["videoPid"];
ch.ServiceId = (int) node["SVCID"];
if (ch.ServiceId == 0)
ch.ServiceId = (int) node["programNum"];
ch.ServiceType = (int) node["serviceType"];
ch.OriginalNetworkId = (int) node["ONID"];
ch.SignalSource |= LookupData.Instance.IsRadioTvOrData(ch.ServiceType);
}
else
{
ch.ChannelOrTransponder = (string) node["TSID"];
ch.SignalSource |= SignalSource.Tv;
}


if ((ch.OldProgramNr & 0x4000) != 0)
{
Expand Down
18 changes: 17 additions & 1 deletion source/ChanSort.Loader.PhilipsXml/Serializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ This loader supports 2 different kinds of XML files from Philips.
*/
class Serializer : SerializerBase
{
private readonly ChannelList analogChannels = new ChannelList(SignalSource.DvbCT, "Analog C/T");
private readonly ChannelList dvbctChannels = new ChannelList(SignalSource.DvbCT, "DVB-C/T");
private readonly ChannelList satChannels = new ChannelList(SignalSource.DvbS, "DVB-S");
private readonly ChannelList allSatChannels = new ChannelList(SignalSource.DvbS, "DVB-S all");
Expand All @@ -73,6 +74,7 @@ public Serializer(string inputFile) : base(inputFile)
this.Features.AllowGapsInFavNumbers = false;
this.Features.CanEditFavListNames = true;

this.DataRoot.AddChannelList(this.analogChannels);
this.DataRoot.AddChannelList(this.dvbctChannels);
this.DataRoot.AddChannelList(this.satChannels);
this.DataRoot.AddChannelList(this.allSatChannels);
Expand All @@ -90,6 +92,15 @@ public Serializer(string inputFile) : base(inputFile)
list.VisibleColumnFieldNames.Remove("Provider");
}

this.analogChannels.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.OriginalNetworkId));
this.analogChannels.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.TransportStreamId));
this.analogChannels.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.ServiceId));
this.analogChannels.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.SymbolRate));
this.analogChannels.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.ChannelOrTransponder));
this.analogChannels.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.NetworkName));
this.analogChannels.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.NetworkOperator));


this.favChannels.IsMixedSourceFavoritesList = true;
}
#endregion
Expand Down Expand Up @@ -266,6 +277,9 @@ private ChannelList DetectFormatAndFeatures(FileData file, XmlNode node)
ChannelList chList = null;
switch (medium)
{
case "analog":
chList = this.analogChannels;
break;
case "dvbc":
case "dvbt":
chList = this.dvbctChannels;
Expand Down Expand Up @@ -361,7 +375,9 @@ private void ParseChannelFormat2(Dictionary<string, string> data, Channel chan)
chan.Name = data.TryGet("name");
chan.RawName = chan.Name;
chan.FreqInMhz = ParseInt(data.TryGet("frequency"));
if (chan.FreqInMhz > 2000)
//if ((chan.SignalSource & SignalSource.Analog) != 0)
// chan.FreqInMhz /= 16;
if (chan.FreqInMhz > 1200)
chan.FreqInMhz /= 1000;
chan.ServiceId = ParseInt(data.TryGet("serviceID"));
chan.OriginalNetworkId = ParseInt(data.TryGet("ONID"));
Expand Down
30 changes: 30 additions & 0 deletions source/ChanSort/ChanSort.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,36 @@
<Content Include="ChanSort.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="ReferenceLists\BE_Telenet_CI+_Module.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\ch_astra192E_hotbird130E_freehd.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\ch_astra192E_hotbird130E_hdplus.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\de_unitymedia_nrw.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\de_vodafone_KabelTV_Berlin.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\gb_astra282E_freesat.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\gb_astra282E_freesat_EastAnglia_StartAt1.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\gb_astra282E_sky.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\it_hotbird130E_tivusat.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ReferenceLists\ru_eutelsat36E_tricolor.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 2 additions & 0 deletions source/ChanSort/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,8 @@ private bool GetGridColumnVisibility(GridColumn col)
return false;

var source = list.SignalSource;
if (col == this.colFavorites) return this.DataRoot.SupportedFavorites != 0;
if (col == this.colOutFav) return this.DataRoot.SupportedFavorites != 0;
if (col == this.colPrNr) return this.subListIndex > 0;
if (col == this.colChannelOrTransponder) return (source & SignalSource.Sat) == 0;
if (col == this.colShortName) return (source & SignalSource.Digital) != 0;
Expand Down
Loading

0 comments on commit e1e2c8d

Please sign in to comment.