Skip to content

Commit

Permalink
- updated NuGet packages
Browse files Browse the repository at this point in the history
- added support for dtv_cmdb_3.bin file with file size 1323920
- fixed error when opening reference list dialog with Italian translation
- "Tornado" TV lists which are a slight variation of old Philips lists using a file name __chtb_do_not_delete_.xml
  • Loading branch information
PredatH0r committed Aug 18, 2024
1 parent 78e53e7 commit d33f349
Show file tree
Hide file tree
Showing 53 changed files with 712 additions and 429 deletions.
2 changes: 1 addition & 1 deletion source/ChanSort.Loader.Amdb/ChanSort.Loader.Amdb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<OutputPath>..\Release\</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.8" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.1" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.8" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
Expand Down
67 changes: 66 additions & 1 deletion source/ChanSort.Loader.CmdbBin/ChanSort.Loader.CmdbBin.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,75 @@
# This file holds the definitions for various verions of the binary "dtv_cmdb_2.bin" channel list format used by some models of Sharp, Toshiba, Dyon, OK. and others
# Some files have an 8 byte header starting with "0004", others have an 12 byte header starting with "0005"
# Some files have an 8 byte header starting with "0004", others have an 12 byte header starting with "0005" or "1114"

# [dtv_chmdb_x.bin:filesize] defines the overall layout of the various file format versions. Values for x are 0=antenna, 1=cable, 2=satellite
# lenChannelRecord, lenTransponderRecord and lenSatelliteRecord are then used to select the [dvsChannel:...], [dvbsTransponder:...] and [dvbsSatellite:...] sections



# C.F. - Grundig 37 VLE 9270 SL dtv_cmd_3.bin with 1293 KB

[dtv_cmdb_3.bin:1323920]
offSatelliteBitmap=0x0008
lenSatelliteBitmap=4

offChannelBitmap=12
lenChannelBitmap=752

offSatelliteRecord=0x2fc
lenSatelliteRecord=60_3
numSatelliteRecord=24

offNetworkRecord=0x89c
lenNetworkRecord=54
numNetworkRecord=254

offTransponderBitmap=-1
lenTransponderBitmap=-1
offTransponderRecord=0x3e30
lenTransponderRecord=44_3
numTransponderRecord=3000

numChannelRecord=6000
offChannelRecord=0x241d0
lenChannelRecord=196_3

[dvbsSatellite:60_3]
offName=2
lenName=14

[dvbsTransponder:44_3]
offSatelliteIndex=0
offTransportStreamId=6
offOriginalNetworkId=8
offNetworkId=-1
offTransponderIndex=10
offFreqInMhz=12
offSymbolRate=32

[dvbsChannel:196_3]
offEncrypted=11
maskEncrypted=0x10
offSkip=11
maskSkip=0x20
offLocked=11
maskLocked=0x40
offDeleted=11
maskDeleted=0x04
offChannelType=13
offServiceType=-1
offTransponderIndex=16
offPmtPid=18
offPcrPid=22
offVideoPid=24
offProgramNr=28
offServiceId=30
offAudioPid=52
offName=144
lenName=44
offDebug=11
lenDebug=1


# Rabinowitsch - dtv_cmd_2.bin with 1296 KB

[dtv_cmdb_2.bin:1326665]
Expand Down
50 changes: 34 additions & 16 deletions source/ChanSort.Loader.CmdbBin/CmdbFileSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public override void Load()
case "dtv_cmdb_2.bin":
LoadFile(file, this.dvbsTv, this.dvbsRadio, this.dvbsData);
break;
case "dtv_cmdb_3.bin":
LoadFile(file, this.dvbsTv, this.dvbsRadio, this.dvbsData);
break;
case "atv_cmdb.bin":
LoadFile(file, this.avbtTv, null, null);
break;
Expand Down Expand Up @@ -93,7 +96,7 @@ private void LoadFile(string file, ChannelList tvList, ChannelList radioList, Ch
}
else
{
LoadBitmappedRecords(data, sec, "dvbs", "Satellite", ReadSatellite);
LoadBitmappedRecords(data, sec, "dvbs", "Satellite", ReadSatellite, Encoding.UTF8);
LoadBitmappedRecords(data, sec, "dvbs", "Transponder", ReadTransponder);
LoadBitmappedRecords(data, sec, "dvbs", "Channel", (map, index, len) => ReadDigitalChannel(map, tvList, radioList, dataList, index, len));
}
Expand All @@ -116,28 +119,42 @@ private byte[] LoadAnalogProgramNumbers(byte[] data, IniFile.Section sec)
#endregion

#region LoadBitmappedRecords()
private void LoadBitmappedRecords(byte[] data, IniFile.Section sec, string recordSectionPrefix, string recordType, Action<DataMapping, int, int> readRecord)
private void LoadBitmappedRecords(byte[] data, IniFile.Section sec, string recordSectionPrefix, string recordType, Action<DataMapping, int, int> readRecord, Encoding forceEncoding = null)
{
var lenRecord = sec.GetInt($"len{recordType}Record");
var map = new DataMapping(this.ini.GetSection($"{recordSectionPrefix}{recordType}:{lenRecord}"));
map.DefaultEncoding = this.DefaultEncoding;
var lenRecordVariant = sec.GetString($"len{recordType}Record");
var p = lenRecordVariant.IndexOf('_');
var lenRecord = p < 0 ? int.Parse(lenRecordVariant) : int.Parse(lenRecordVariant.Substring(0, p));
var map = new DataMapping(this.ini.GetSection($"{recordSectionPrefix}{recordType}:{lenRecordVariant}"));
map.DefaultEncoding = forceEncoding ?? this.DefaultEncoding;
map.SetDataPtr(data, sec.GetInt($"off{recordType}Record"));

var off = sec.GetInt($"off{recordType}Bitmap");
var len = sec.GetInt($"len{recordType}Bitmap");
var count = sec.GetInt($"num{recordType}Record", short.MaxValue);
int index = 0;
for (int i = 0; i < len; i++)
if (off >= 0)
{
var len = sec.GetInt($"len{recordType}Bitmap");
var count = sec.GetInt($"num{recordType}Record", short.MaxValue);
int index = 0;
for (int i = 0; i < len; i++)
{
var b = data[off + i];
for (byte mask = 1; mask != 0; mask <<= 1)
{
if ((b & mask) != 0)
readRecord(map, index, lenRecord);
map.BaseOffset += lenRecord;
++index;
if (index >= count)
break;
}
}
}
else
{
var b = data[off + i];
for (byte mask = 1; mask != 0; mask <<= 1)
var count = sec.GetInt($"num{recordType}Record", short.MaxValue);
for (int index = 0; index < count; index++)
{
if ((b & mask) != 0)
readRecord(map, index, lenRecord);
readRecord(map, index, lenRecord);
map.BaseOffset += lenRecord;
++index;
if (index >= count)
break;
}
}
}
Expand Down Expand Up @@ -218,6 +235,7 @@ private void ReadDigitalChannel(DataMapping chanMap, ChannelList tvList, Channel
ch.Encrypted = chanMap.GetFlag("Encrypted", false);
ch.Skip = chanMap.GetFlag("Skip", false);
ch.Lock = chanMap.GetFlag("Locked", false);
ch.IsDeleted = chanMap.GetFlag("Deleted", false);
ch.Favorites = chanMap.GetFlag("Fav", false) ? Favorites.A : 0;

var off = chanMap.BaseOffset + chanMap.GetOffsets("offName")[0];
Expand Down
121 changes: 114 additions & 7 deletions source/ChanSort.Loader.DBM/ChanSort.Loader.DBM.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[dbm:74303]
; overall file layout
; overall file layout, e.g. Renkforce 1510 C HD, Telestar digiHD TC 7
isDvbS=false
separateTvRadioData=false
offChecksum=0x0000
Expand Down Expand Up @@ -44,10 +44,54 @@ offPcrPid=104
offVideoPid=106


;-------------------------------

[dbm:100120]
; overall file layout, e.g. XORO 7660
isDvbS=false
separateTvRadioData=false
offChecksum=-1
offDataLength=-1
offData=0
offTransponderBitmap=0x0000
lenTransponderBitmap=16
offTransponderData=0x0010
numTransponder=100
lenTransponderData=40
offChannelBitmap=0x0fc6
lenChannelBitmap=75
offChannelData=0x1014
numChannel=600
lenChannelData=160

;transponder record
offFreq=0
offSymRate=8

;channel record
offName=0
lenName=64
offProgNr=64
offLcn=66
offTransponderIndex=70
offServiceType=76
offHide=77
maskHide=0x04
offSkip=77
maskSkip=0x08
offLock=77
maskLock=0x10
offFavorites=79
offTsid=96
offOnid=98
offSid=100
offPcrPid=104
offVideoPid=106

;---------------------------------------

[dbm:109720]
; overall file layout
; overall file layout, e.g. Xoro DVB-C tuner
isDvbS=false
separateTvRadioData=false
offChecksum=-1
Expand Down Expand Up @@ -94,7 +138,7 @@ offVideoPid=106
;---------------------------------------

[dbm:163772]
; overall file layout
; overall file layout, e.g. TechniSat DVB-C TS_Programmliste_06_01.DBM
isDvbS=false
offChecksum=0x0000
offDataLength=0x0002
Expand Down Expand Up @@ -139,7 +183,7 @@ offVideoPid=106
;---------------------------------------

[dbm:781736]
; overall file layout
; overall file layout, e.g. Strong HB_DTABASE_1_18.DBM, Xoro HB_DATABASE_6_29.DBM
isDvbS=true
offChecksum=0x0000
offDataLength=0x0002
Expand Down Expand Up @@ -198,7 +242,7 @@ offVideoPid=110
;---------------------------------------

[dbm:785256]
; overall file layout
; overall file layout, e.g. Strong HB_DATABASE_5_4.DBM
isDvbS=true
offChecksum=0x0000
offDataLength=0x0002
Expand Down Expand Up @@ -257,7 +301,7 @@ offVideoPid=110
;---------------------------------------

[dbm:793736]
; overall file layout
; overall file layout, e.g. Xoro HB_DATABASE_8_19.DBM
isDvbS=true
offChecksum=0x0000
offDataLength=0x0002
Expand Down Expand Up @@ -313,10 +357,73 @@ offSid=104
offPcrPid=108
offVideoPid=110



;---------------------------------------

[dbm:862272]
; overall file layout, e.g. Orbitech IR440 HB_DATABASE_5_3.DBM
isDvbS=true
offChecksum=0x0000
offDataLength=0x0002
offData=0x0006

offSatelliteBitmap=0x0006
lenSatelliteBitmap=32
offSatelliteData=0x0026
numSatellite=254
lenSatelliteData=84

offTransponderBitmap=0x537e
lenTransponderBitmap=376
offTransponderData=0x54f6
numTransponder=3000
lenTransponderData=40

offChannelBitmap=0x229ca
lenChannelBitmap=500
offChannelData=0x22bbe
numChannel=4000
lenChannelData=180

;satellite record
offSatName=0
lenSatName=34
offLowFreq=34
offHighFreq=36
offOribalPos=74

;transponder record
offFreq=0
offSymRate=20

;channel record
offName=0
lenName=64
offProgNr=64
offLcn=66
offSatelliteIndex=70
offTransponderIndex=72
offServiceType=80
offHide=81
maskHide=0x04
offSkip=81
maskSkip=0x08
offLock=81
maskLock=0x10
offFavorites=83
offTsid=100
offOnid=102
offSid=104
offPcrPid=108
offVideoPid=110



;---------------------------------------

[dbm:948368]
; overall file layout
; overall file layout, e.g. Comag SL40HD_V1_17_02, Xoro HRS 8520
isDvbS=true
offChecksum=0x0000
offDataLength=0x0002
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.8" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
Expand Down
8 changes: 4 additions & 4 deletions source/ChanSort.Loader.LG.UI/ChanSort.Loader.LG.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Data.Desktop" Version="23.2.4" />
<PackageReference Include="DevExpress.Printing.Core" Version="23.2.4" />
<PackageReference Include="DevExpress.Utils" Version="23.2.4" />
<PackageReference Include="DevExpress.Win" Version="23.2.4" />
<PackageReference Include="DevExpress.Data.Desktop" Version="23.2.5" />
<PackageReference Include="DevExpress.Printing.Core" Version="23.2.5" />
<PackageReference Include="DevExpress.Utils" Version="23.2.5" />
<PackageReference Include="DevExpress.Win" Version="23.2.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj" />
Expand Down
Loading

0 comments on commit d33f349

Please sign in to comment.