Skip to content

Commit

Permalink
- opening MtkChannelList.xml in a Philips directory structure now loa…
Browse files Browse the repository at this point in the history
…ds the whole Philips list instead of just MtkChannelList.xml

- Philips list versions 120 and 125 are now read-only because the TV ignores changes to the main channel numbers. Only favorite lists are imported correctly
  • Loading branch information
PredatH0r committed Oct 15, 2024
1 parent 1904e97 commit 4eb78e1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ source/ChanSort.opensdf
/source/.vs/
/source/packages/
/source/ChanSort.Loader.PhilipsBin/DllClient.cs
/source/ChanSort.Loader.MediaTek/.vs/
11 changes: 6 additions & 5 deletions source/ChanSort.Loader.MediaTek/MediatekPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
using System.IO;
using System;
using System.IO;
using ChanSort.Api;

namespace ChanSort.Loader.MediaTek;

public class MediatekPlugin : ISerializerPlugin
{
public string DllName { get; set; }
public string PluginName => "MediaTek (MtkChannelList.xml)";
public string PluginName => "MediaTek (Mtk*.xml)";
public string FileFilter => "Mtk*.xml";

public SerializerBase CreateSerializer(string inputFile)
{
var dir = Path.GetDirectoryName(inputFile);
var dir = Path.GetDirectoryName(inputFile) ?? "";

// if there is a chanLst.bin file, let the Philips module handle the channel list
//if (File.Exists(Path.Combine(dir, "chanLst.bin")))
// return null;
if (StringComparer.InvariantCultureIgnoreCase.Equals(Path.GetFileName(inputFile), "MtkChannelList.xml") && File.Exists(Path.Combine(dir, "chanLst.bin")))
return null;

return new Serializer(inputFile);
}
Expand Down
18 changes: 16 additions & 2 deletions source/ChanSort.Loader.Philips/XmlSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ public override void Load()
throw LoaderException.TryNext("No XML files found in folder structure");

LoadAndValidateMtkChannelList(dir);

// version 120 and 125 ignore the modified main channel numbers and only take changes from the favorites.xml
if ((chanLstBin?.VersionMajor ?? 0) >= 120)
{
foreach (var list in this.DataRoot.ChannelLists)
{
if (!list.IsMixedSourceFavoritesList)
list.ReadOnly = true;
}
}
}
else
{
Expand Down Expand Up @@ -718,8 +728,12 @@ private void LoadAndValidateMtkChannelList(string dir)
if (others.Count == 0)
throw LoaderException.Fail("MtkChannelList.xml doesn't contain a matching channel for " + ch1);
if (others.Count > 1)
throw LoaderException.Fail("MtkChannelList.xml contains multiple matching channel for " + ch1);

{
others = others.Where(c => c.OldProgramNr == ch1.OldProgramNr).ToList();
if (others.Count != 1)
throw LoaderException.Fail("MtkChannelList.xml contains multiple matching channel for " + ch1);
}

var ch2 = others[0];
if (ch1.OldProgramNr != ch2.OldProgramNr)
throw LoaderException.Fail("MtkChannelList.xml contains a different channel number for " + ch1);
Expand Down
6 changes: 6 additions & 0 deletions source/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
ChanSort Change Log
===================

2024-10-15
- Philips formats 120-125: opening the "MtkChannelList.xml" file will now load/save the whole Philips channel list
instead of only loading the data from that particular file.
- Philips formats 120-125: the main program numbers are now read-only because the TV seems to ignores changes to them.
Changes to the favorite lists however are imported correctly.

2024-10-02
- Philips formats 100-125: further improvements/fixes for decoding non-latin characters
- Sony Bravia 7 (2024) sdb.xml: support to read it as a reference list (the TV will ignore any edits to this file)
Expand Down

0 comments on commit 4eb78e1

Please sign in to comment.