diff --git a/.gitignore b/.gitignore index 1cca489..ea0e6d7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ source/ChanSort.opensdf /source/.vs/ /source/packages/ /source/ChanSort.Loader.PhilipsBin/DllClient.cs +/source/ChanSort.Loader.MediaTek/.vs/ diff --git a/source/ChanSort.Loader.MediaTek/MediatekPlugin.cs b/source/ChanSort.Loader.MediaTek/MediatekPlugin.cs index 10abb77..83c6c6b 100644 --- a/source/ChanSort.Loader.MediaTek/MediatekPlugin.cs +++ b/source/ChanSort.Loader.MediaTek/MediatekPlugin.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using ChanSort.Api; namespace ChanSort.Loader.MediaTek; @@ -6,16 +7,16 @@ 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); } diff --git a/source/ChanSort.Loader.Philips/XmlSerializer.cs b/source/ChanSort.Loader.Philips/XmlSerializer.cs index 5d93f67..233cad6 100644 --- a/source/ChanSort.Loader.Philips/XmlSerializer.cs +++ b/source/ChanSort.Loader.Philips/XmlSerializer.cs @@ -227,6 +227,16 @@ namespace ChanSort.Loader.Philips 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 { @@ -718,8 +728,12 @@ namespace ChanSort.Loader.Philips 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); diff --git a/source/changelog.md b/source/changelog.md index 045e7c2..f88a3e3 100644 --- a/source/changelog.md +++ b/source/changelog.md @@ -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)