mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-02-26 16:20:43 +01:00
- Philips ChannelMap\_100: fixed reading/writing favorites
This commit is contained in:
@@ -114,7 +114,7 @@ namespace ChanSort.Api
|
||||
this.FavListCount = this.loader.Features.MaxFavoriteLists;
|
||||
|
||||
var favMode = this.FavoritesMode;
|
||||
if (this.ChannelLists.Any(l => l.IsMixedSourceFavoritesList))
|
||||
if (this.ChannelLists.Any(l => l.IsMixedSourceFavoritesList && l.Channels.Count > 0))
|
||||
favMode = loader.Features.FavoritesMode = FavoritesMode.MixedSource;
|
||||
|
||||
foreach (var list in this.ChannelLists)
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace ChanSort.Loader.Philips
|
||||
this.DataRoot.AddChannelList(this.dvbcChannels);
|
||||
this.DataRoot.AddChannelList(this.satChannels);
|
||||
this.DataRoot.AddChannelList(this.allSatChannels);
|
||||
this.DataRoot.AddChannelList(this.favChannels);
|
||||
//this.DataRoot.AddChannelList(this.favChannels); // format 100.0 does not support mixed source favs and adding it would automatically switch to mixed source fav mode
|
||||
|
||||
this.dvbtChannels.VisibleColumnFieldNames.Add("Source");
|
||||
this.dvbcChannels.VisibleColumnFieldNames.Add("Source");
|
||||
@@ -174,6 +174,9 @@ namespace ChanSort.Loader.Philips
|
||||
// otherwise load the single file that was originally selected by the user
|
||||
LoadFile(this.FileName);
|
||||
}
|
||||
|
||||
if (this.Features.FavoritesMode == FavoritesMode.MixedSource)
|
||||
this.DataRoot.AddChannelList(this.favChannels);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.M3u", "Chan
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.Philips", "ChanSort.Loader.Philips\ChanSort.Loader.Philips.csproj", "{1F52B5EC-A2F1-4E53-9E1A-4658296C5BB5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spike.LgWebOs5", "Spike.LgWebOs5\Spike.LgWebOs5.csproj", "{32EFB306-DEF8-4488-B1AE-46D5B183C373}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spikes", "Spike.LgWebOs5\Spikes.csproj", "{32EFB306-DEF8-4488-B1AE-46D5B183C373}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.Grundig", "ChanSort.Loader.Grundig\ChanSort.Loader.Grundig.csproj", "{4D5AF0A3-1B96-42C8-910D-0C4852EA22F4}"
|
||||
EndProject
|
||||
|
||||
@@ -22,7 +22,9 @@ public struct LaSat
|
||||
uint8 header[28];
|
||||
struct
|
||||
{
|
||||
uint16 u1[3];
|
||||
uint16 u1;
|
||||
uint16 zero1;
|
||||
uint16 zero2;
|
||||
uint16 sid;
|
||||
uint16 u2;
|
||||
uint16 pcrPid;
|
||||
@@ -53,5 +55,5 @@ public struct LaSat
|
||||
} satellites[30];
|
||||
} structured;
|
||||
} dataBlock;
|
||||
uint8 suffix_0A_0D[2];
|
||||
uint8 suffix_0A_0D[2]; // this may or may not be present, also additional data may follow, which should be kept as-is
|
||||
};
|
||||
93
source/Spike.LgWebOs5/PhilipsXmlStatsCollector.cs
Normal file
93
source/Spike.LgWebOs5/PhilipsXmlStatsCollector.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ChanSort.Api;
|
||||
using ChanSort.Loader.Philips;
|
||||
|
||||
namespace Spike.PhilipsXml
|
||||
{
|
||||
class PhilipsXmlStatsCollector
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
using var w = new StreamWriter(@"d:\sources\chansort\testfiles_philips\stats.txt");
|
||||
var dirs = new[] {"100.0", "105.0", "110.0"};
|
||||
foreach (var dir in dirs)
|
||||
ProcessDir(Path.Combine(@"d:\sources\chansort\testfiles_philips", dir), w);
|
||||
}
|
||||
|
||||
private static void ProcessDir(string dir, StreamWriter w)
|
||||
{
|
||||
foreach (var bak in Directory.GetFiles(dir, "*.bak"))
|
||||
File.Copy(bak, bak.Replace(".bak", ""), true);
|
||||
|
||||
foreach (var subdir in Directory.GetDirectories(dir))
|
||||
ProcessDir(subdir, w);
|
||||
|
||||
var file = Path.Combine(dir, "chanLst.bin");
|
||||
if (File.Exists(file))
|
||||
ProcessFile(file, w);
|
||||
}
|
||||
|
||||
private static void ProcessFile(string file, StreamWriter w)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(file);
|
||||
try
|
||||
{
|
||||
var p = new PhilipsPlugin();
|
||||
var ser = p.CreateSerializer(file);
|
||||
ser.Load();
|
||||
int totalChans = 0;
|
||||
var conseq = true;
|
||||
var inOrder = true;
|
||||
var hasFav = false;
|
||||
var srcSum = new int[5];
|
||||
var typeSum = new int[4];
|
||||
foreach (var list in ser.DataRoot.ChannelLists)
|
||||
{
|
||||
if (list.IsMixedSourceFavoritesList)
|
||||
continue;
|
||||
totalChans += list.Channels.Count;
|
||||
var lastNr = 0;
|
||||
var chanCountBySrc = new int[5,4];
|
||||
foreach (var c in list.Channels)
|
||||
{
|
||||
inOrder &= c.OldProgramNr >= lastNr;
|
||||
if (!inOrder)
|
||||
{
|
||||
}
|
||||
conseq &= c.OldProgramNr == lastNr + 1;
|
||||
if (!conseq)
|
||||
{
|
||||
}
|
||||
lastNr = c.OldProgramNr;
|
||||
hasFav |= c.GetOldPosition(1) != -1;
|
||||
var s = c.SignalSource;
|
||||
var i0 = (s & SignalSource.Antenna) != 0 ? 1 : (s & SignalSource.Cable) != 0 ? 2 : (s & SignalSource.Sat) != 0 ? 3 : (s & SignalSource.IP) != 0 ? 4 : 0;
|
||||
var i1 = (s & SignalSource.Tv) != 0 ? 1 : (s & SignalSource.Radio) != 0 ? 2 : (s & SignalSource.Data) != 0 ? 3 : 0;
|
||||
++chanCountBySrc[i0, i1];
|
||||
++srcSum[i0];
|
||||
++typeSum[i1];
|
||||
}
|
||||
}
|
||||
|
||||
sb.Append($"\t{totalChans}");
|
||||
foreach(var n in srcSum)
|
||||
sb.Append("\t").Append(n);
|
||||
foreach (var n in typeSum)
|
||||
sb.Append("\t").Append(n);
|
||||
sb.Append($"\t{inOrder}\t{conseq}\t{hasFav}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sb.Append("\t").Append(ex.Message);
|
||||
}
|
||||
w.WriteLine(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,8 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="PhilipsXmlStatsCollector.cs" />
|
||||
<None Include="WebOs5StatsCollector.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -86,6 +87,10 @@
|
||||
<Project>{dccffa08-472b-4d17-bb90-8f513fc01392}</Project>
|
||||
<Name>ChanSort.Api</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ChanSort.Loader.Philips\ChanSort.Loader.Philips.csproj">
|
||||
<Project>{1f52b5ec-a2f1-4e53-9e1a-4658296c5bb5}</Project>
|
||||
<Name>ChanSort.Loader.Philips</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -9,11 +9,17 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Spike.LgWebOs5
|
||||
{
|
||||
class Program
|
||||
class WebOs5StatsCollector
|
||||
{
|
||||
private static string basedir;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
CollectLgWebOs5Stats(args);
|
||||
}
|
||||
|
||||
#region CollectLgWebOs5Stats()
|
||||
static void CollectLgWebOs5Stats(string[] args)
|
||||
{
|
||||
basedir = args.Length > 0 ? args[0] : @"d:\sources\chansort\testfiles_lg";
|
||||
|
||||
@@ -44,7 +50,9 @@ namespace Spike.LgWebOs5
|
||||
|
||||
ProcessWebOs5Files(basedir, csv);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ProcessWebOs5Files
|
||||
private static void ProcessWebOs5Files(string dir, StreamWriter csv)
|
||||
{
|
||||
var files = Directory.GetFiles(dir, "GlobalClone*.tll");
|
||||
@@ -61,6 +69,7 @@ namespace Spike.LgWebOs5
|
||||
foreach (var subdir in Directory.GetDirectories(dir))
|
||||
ProcessWebOs5Files(subdir, csv);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ProcessFile()
|
||||
private static string ProcessFile(string file)
|
||||
@@ -192,6 +201,7 @@ namespace Spike.LgWebOs5
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Dup()
|
||||
private static string Dup(string str, int count)
|
||||
{
|
||||
var sb = new StringBuilder(str.Length * count);
|
||||
@@ -199,6 +209,7 @@ namespace Spike.LgWebOs5
|
||||
sb.Append(str);
|
||||
return sb.ToString();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region class ChanListStats
|
||||
@@ -1,10 +1,11 @@
|
||||
ChanSort Change Log
|
||||
===================
|
||||
|
||||
TBD
|
||||
- improved Linux/Wine performance
|
||||
- minor fixes ("File / File information" didn't ignore deleted channels when counting duplicates)
|
||||
2021-07-27
|
||||
- Philips ChannelMap\_100: fixed reading/writing favorites
|
||||
- updated Swiss reference lists with new ONID-TSID-SID for SRF info HD and RSI LA HD
|
||||
- improved Linux/Wine performance
|
||||
- "File / File information" now ignores deleted channels when counting duplicates
|
||||
|
||||
2021-07-26
|
||||
- user interface can now be toggled between
|
||||
|
||||
Reference in New Issue
Block a user