mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-05-07 04:47:34 +02:00
- added Italian translation
- updated Polish translation - added support for a Hisense HIS_SVL variant with different file structure - Samsung IP-TV lists allow editing stream and logo URLs
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
; HIS_SVL.BIN, HIS_TSL.BIN and HIS_FAV.BIN
|
||||
; ========================================
|
||||
|
||||
; there are several versions of this format, with no deterministic way to detect the format
|
||||
; ChanSort checks if the file sizes are multiples of the record sizes to guesstimate the version
|
||||
|
||||
[Header]
|
||||
RecordSize=40
|
||||
ID=0
|
||||
@@ -12,16 +15,20 @@ BlockSize=36
|
||||
[Version1]
|
||||
TSL_Record=304
|
||||
SVL_Record=264
|
||||
FAV_Header=24
|
||||
FAV_Record=80
|
||||
ReadDvb=false
|
||||
|
||||
[Version2]
|
||||
TSL_Record=328
|
||||
SVL_Record=304
|
||||
FAV_Header=16
|
||||
FAV_Record=80
|
||||
ReadDvb=true
|
||||
|
||||
;=== variant with 304 byte TSL record and 264 bytes SVL record (LTDN55K390XWSEU3D V00.01.00a.E0430)
|
||||
|
||||
[TSL_Record:304]
|
||||
[TSL_Record:Version1]
|
||||
RecordSize=304
|
||||
ID=0
|
||||
BroadcastType=2
|
||||
@@ -34,7 +41,7 @@ DvbsSymbolRate=28
|
||||
Name=188
|
||||
NameSize=28
|
||||
|
||||
[SVL_Record:264]
|
||||
[SVL_Record:Version1]
|
||||
RecordSize=264
|
||||
|
||||
RecordId=0
|
||||
@@ -79,10 +86,26 @@ NameSize=16
|
||||
|
||||
BroadcastSystemData=48
|
||||
|
||||
[FAV_Header:Version1]
|
||||
RecordSize=24
|
||||
CountFav1=16
|
||||
CountFav2=18
|
||||
CountFav3=20
|
||||
CountFav4=22
|
||||
|
||||
[FAV_Record:Version1]
|
||||
RecordSize=80
|
||||
SvlTableId=0
|
||||
SvlRecordId=2
|
||||
DisplayNumber=4
|
||||
DisplayNumberSize=10
|
||||
ChannelName=15
|
||||
ChannelNameSize=64
|
||||
|
||||
|
||||
;=== variant with 328 byte TSL record and 304 bytes SVL record
|
||||
|
||||
[TSL_Record:328]
|
||||
[TSL_Record:Version2]
|
||||
RecordSize=328
|
||||
ID=0
|
||||
BroadcastType=2
|
||||
@@ -96,7 +119,7 @@ DvbsSymbolRate=28
|
||||
Name=216
|
||||
NameSize=32
|
||||
|
||||
[SVL_Record:304]
|
||||
[SVL_Record:Version2]
|
||||
RecordSize=304
|
||||
|
||||
RecordId=0
|
||||
@@ -141,7 +164,7 @@ NameSize=96
|
||||
|
||||
BroadcastSystemData=136
|
||||
|
||||
[DVB_Data]
|
||||
[DVB_Data:Version2]
|
||||
ShortName=4
|
||||
ShortNameSize=16
|
||||
LinkageMask=28
|
||||
@@ -154,7 +177,14 @@ DvbcTsid=118
|
||||
DvbcOnid=120
|
||||
ServiceType=129
|
||||
|
||||
[FAV_Record]
|
||||
[FAV_Header:Version2]
|
||||
RecordSize=16
|
||||
SizeFav1=0
|
||||
SizeFav2=4
|
||||
SizeFav3=8
|
||||
SizeFav4=12
|
||||
|
||||
[FAV_Record:Version2]
|
||||
RecordSize=80
|
||||
SvlTableId=0
|
||||
SvlRecordId=2
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ChanSort.Loader.Hisense.HisBin;
|
||||
*
|
||||
* This binary format is based on a customized MediaTek format, which means that there may be many incompatible
|
||||
* variants that can't be identified and distinguished easily.
|
||||
* This loader only supports the known HiSense variants with 264 and 304 bytes per channel in HIS_SVL.BIN.
|
||||
* This loader supports 2 known versions with 264 and 304 bytes per channel in HIS_SVL.BIN, which also differ in TSL and FAV file layouts
|
||||
*
|
||||
* See also the his-svl.h file in Information/FileStructures_for_HHD_Hex_Editor_Neo
|
||||
*
|
||||
@@ -32,6 +32,7 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
private string favFileName;
|
||||
private byte[] svlFileContent;
|
||||
private byte[] tslFileContent;
|
||||
private byte[] favFileContent;
|
||||
private const int MaxFileSize = 4 << 20; // 4 MB
|
||||
|
||||
private bool readDvbData;
|
||||
@@ -42,7 +43,7 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
private const string ERR_badFileFormat = "The content of the file doesn't match the expected format.";
|
||||
|
||||
private IniFile ini;
|
||||
private DataMapping headerMapping, svlMapping, tslMapping, dvbMapping, favMapping;
|
||||
private DataMapping headerMapping, svlMapping, tslMapping, dvbMapping, favHeaderMapping, favMapping;
|
||||
private readonly Dictionary<int, Transponder> transponder = new ();
|
||||
|
||||
#region ctor()
|
||||
@@ -82,10 +83,6 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
this.ini = new IniFile(iniFile);
|
||||
this.headerMapping = new DataMapping(ini.GetSection("Header"));
|
||||
this.headerRecordSize = headerMapping.Settings.GetInt("RecordSize");
|
||||
|
||||
this.dvbMapping = new DataMapping(ini.GetSection("DVB_Data"));
|
||||
this.dvbMapping.DefaultEncoding = this.DefaultEncoding;
|
||||
this.favMapping = new DataMapping(ini.GetSection("FAV_Record"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -115,6 +112,7 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
{
|
||||
var svlLen = new FileInfo(this.FileName).Length;
|
||||
var tslLen = new FileInfo(tslName).Length;
|
||||
var favLen = new FileInfo(this.favFileName).Length;
|
||||
IniFile.Section candidate = null;
|
||||
foreach (var section in this.ini.Sections)
|
||||
{
|
||||
@@ -124,22 +122,29 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
continue;
|
||||
if ((svlLen - this.headerRecordSize * 3) % section.GetInt("SVL_Record") != 0)
|
||||
continue;
|
||||
if (favLen != 0 && (favLen - section.GetInt("FAV_Header")) % section.GetInt("FAV_Record") != 0)
|
||||
continue;
|
||||
if (candidate != null)
|
||||
throw LoaderException.Fail("Unable to uniquely infer file format from its content");
|
||||
candidate = section;
|
||||
}
|
||||
|
||||
if (candidate == null)
|
||||
throw LoaderException.Fail("File content doesn't match any known SVL/TSL/FAV.bin data format versions");
|
||||
throw LoaderException.Fail("File content doesn't match any known SVL/TSL/FAV.bin format versions");
|
||||
|
||||
var tslRecordSize = candidate.GetInt("TSL_Record");
|
||||
this.svlRecordSize = candidate.GetInt("SVL_Record");
|
||||
this.readDvbData = candidate.GetBool("ReadDvb");
|
||||
|
||||
this.svlMapping = new DataMapping(ini.GetSection("SVL_Record:" + this.svlRecordSize));
|
||||
this.svlMapping.DefaultEncoding = this.DefaultEncoding;
|
||||
this.tslMapping = new DataMapping(ini.GetSection("TSL_Record:" + tslRecordSize));
|
||||
this.tslMapping = new DataMapping(ini.GetSection("TSL_Record:" + candidate.Name));
|
||||
this.tslMapping.DefaultEncoding = this.DefaultEncoding;
|
||||
this.svlMapping = new DataMapping(ini.GetSection("SVL_Record:" + candidate.Name));
|
||||
this.svlMapping.DefaultEncoding = this.DefaultEncoding;
|
||||
this.dvbMapping = new DataMapping(ini.GetSection("DVB_Data:" + candidate.Name));
|
||||
this.dvbMapping.DefaultEncoding = this.DefaultEncoding;
|
||||
this.favHeaderMapping = new DataMapping(ini.GetSection("FAV_Header:" + candidate.Name));
|
||||
this.favHeaderMapping.DefaultEncoding = this.DefaultEncoding;
|
||||
this.favMapping = new DataMapping(ini.GetSection("FAV_Record:" + candidate.Name));
|
||||
this.favMapping.DefaultEncoding = this.DefaultEncoding;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -389,17 +394,29 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
return;
|
||||
var content = File.ReadAllBytes(filename);
|
||||
var favListSizes = new int[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
favListSizes[i] = BitConverter.ToInt32(content, i * 4);
|
||||
var content = this.favFileContent = File.ReadAllBytes(filename);
|
||||
|
||||
int[] favCount = new int[4];
|
||||
var recSize = favMapping.Settings.GetInt("RecordSize");
|
||||
favHeaderMapping.SetDataPtr(content, 0);
|
||||
if (favHeaderMapping.Settings.GetInt("SizeFav1", -1) >= 0)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
favCount[i] = BitConverter.ToInt32(content, i * 4) / recSize;
|
||||
}
|
||||
else if (favHeaderMapping.Settings.GetInt("CountFav1", -1) >= 0)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
favCount[i] = favHeaderMapping.GetWord("CountFav" + (i+1));
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
var dispNumLen = favMapping.Settings.GetInt("DisplayNumberSize");
|
||||
favMapping.SetDataPtr(content, 16 - recSize);
|
||||
favMapping.SetDataPtr(content, favHeaderMapping.Settings.GetInt("RecordSize") - recSize);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
for (int j = 0, c = favListSizes[i] / recSize; j < c; j++)
|
||||
for (int j = 0, c = favCount[i]; j < c; j++)
|
||||
{
|
||||
favMapping.BaseOffset += recSize;
|
||||
|
||||
@@ -525,8 +542,7 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
using var mem = new MemoryStream();
|
||||
using var writer = new BinaryWriter(mem);
|
||||
|
||||
for (int i=0; i<4; i++)
|
||||
writer.Write(0);
|
||||
writer.Write(this.favFileContent, 0, this.favHeaderMapping.Settings.GetInt("RecordSize"));
|
||||
|
||||
var favRecordSize = favMapping.Settings.GetInt("RecordSize");
|
||||
var tmp = new byte[favRecordSize];
|
||||
@@ -552,12 +568,11 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
}
|
||||
|
||||
// update header
|
||||
writer.Flush();
|
||||
var off = mem.Position;
|
||||
mem.Seek((i-1) * 4, SeekOrigin.Begin);
|
||||
writer.Write(order.Count * favRecordSize);
|
||||
writer.Flush();
|
||||
mem.Seek(off, SeekOrigin.Begin);
|
||||
favHeaderMapping.SetDataPtr(mem.GetBuffer(), 0); // the MemStream buffer gets reallocated while adding data
|
||||
if (favHeaderMapping.Settings.Keys.Contains("SizeFav1"))
|
||||
favHeaderMapping.SetDword("SizeFav" + i, order.Count * favRecordSize);
|
||||
else if (favHeaderMapping.Settings.Keys.Contains("CountFav1"))
|
||||
favHeaderMapping.SetWord("CountFav" + i, order.Count);
|
||||
}
|
||||
|
||||
tmp = new byte[mem.Length];
|
||||
@@ -589,11 +604,12 @@ public class HisSvlBinSerializer : SerializerBase
|
||||
return;
|
||||
base.DefaultEncoding = value;
|
||||
|
||||
this.dvbMapping.DefaultEncoding = value;
|
||||
if (this.svlMapping != null)
|
||||
{
|
||||
this.svlMapping.DefaultEncoding = value;
|
||||
this.tslMapping.DefaultEncoding = value;
|
||||
this.dvbMapping.DefaultEncoding = value;
|
||||
this.favMapping.DefaultEncoding = value;
|
||||
this.ReparseNames();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ChanSort.Loader.Hisense {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
128
source/ChanSort.Loader.Hisense/Resources.it.resx
Normal file
128
source/ChanSort.Loader.Hisense/Resources.it.resx
Normal file
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Load_NoChannelsMsg" xml:space="preserve">
|
||||
<value>Questo file di elenco canali non contiene dati.
|
||||
Molto probabilmente durante la configurazione iniziale del televisore è stato selezionato un elenco di canali predefinito. Tali elenchi non vengono esportati e non possono essere modificati sulla TV o sul PC.
|
||||
Per ottenere un elenco che può essere modificato sul tuo PC, devi ripristinare il televisore alle impostazioni di fabbrica e selezionare l'opzione 'Altro' durante l'impostazione del canale satellitare.</value>
|
||||
</data>
|
||||
<data name="Load_NoChannelsCaption" xml:space="preserve">
|
||||
<value>Nessun canale trovato</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user