Skip to content

Commit

Permalink
- disable editing of predefined channel lists (based on LCN).
Browse files Browse the repository at this point in the history
  TVs can show erratic behavior when a predefined list is modified.
  e.g. Samsung J built-in "Astra 19.2E" list, LG "Astra" or "Sky" lists, ...
  (can be overridden in the Settings menu)
- new skin
  • Loading branch information
PredatH0r committed Nov 27, 2015
1 parent 1f016c8 commit b571e88
Show file tree
Hide file tree
Showing 14 changed files with 516 additions and 374 deletions.
8 changes: 7 additions & 1 deletion source/ChanSort.Loader.Hisense/HisSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ internal enum DvbLinkageMask { Ts = 1<<2 }
#region ctor()
public HisSerializer(string inputFile) : base(inputFile)
{
DepencencyChecker.AssertVc2010RedistPackageX86Installed();

this.Features.ChannelNameEdit = ChannelNameEditMode.All;
this.Features.CanDeleteChannels = false;
channelLists.Add(new ChannelList(SignalSource.Antenna | SignalSource.Analog | SignalSource.Digital | SignalSource.Radio | SignalSource.Tv, "Antenna"));
Expand Down Expand Up @@ -192,12 +194,16 @@ private void LoadSvlData(SQLiteCommand cmd)
}

this.LoadSvlData(cmd, x, "svl_#_data_analog", "", (ci, r, i0) => { });
this.LoadSvlData(cmd, x, "svl_#_data_dvb", ", b_free_ca_mode, s_svc_name", (ci, r, i0) =>
this.LoadSvlData(cmd, x, "svl_#_data_dvb", ", b_free_ca_mode, s_svc_name, cur_lcn", (ci, r, i0) =>
{
ci.Encrypted = r.GetBoolean(i0 + 0);
ci.ShortName = r.GetString(i0 + 1);
if ((ci.SignalSource & SignalSource.DvbT) == SignalSource.DvbT)
ci.ChannelOrTransponder = LookupData.Instance.GetDvbtTransponder(ci.FreqInMhz).ToString();
// make the current list read-only if LCN is used
if (r.GetInt32(i0 + 2) != 0)
this.channelLists[x - 1].ReadOnly = true;
});
}
}
Expand Down
8 changes: 1 addition & 7 deletions source/ChanSort.Loader.SamsungJ/DbChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ protected void ReadDvbData(SQLiteDataReader r, IDictionary<string, int> field, D
this.VideoPid = r.GetInt32(field["vidPid"]);
if (!r.IsDBNull(field["provId"]))
this.Provider = providers.TryGet(r.GetInt64(field["provId"]));
}
#endregion


#region UpdateRawData()
public override void UpdateRawData()
{
this.AddDebug(r.GetInt32(field["lcn"]).ToString());
}
#endregion
}
Expand Down
37 changes: 19 additions & 18 deletions source/ChanSort.Loader.SamsungJ/DbSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public DbSerializer(string inputFile) : base(inputFile)
DepencencyChecker.AssertVc2010RedistPackageX86Installed();

this.Features.ChannelNameEdit = ChannelNameEditMode.All;
this.Features.CanDeleteChannels = true;
this.Features.CanDeleteChannels = false;
this.DataRoot.SupportedFavorites = Favorites.A | Favorites.B | Favorites.C | Favorites.D | Favorites.E;
this.DataRoot.SortedFavorites = false;
}
Expand Down Expand Up @@ -56,6 +56,9 @@ public override void Load()

foreach (var filePath in Directory.GetFiles(tempDir, "*."))
{
var filename = Path.GetFileName(filePath) ?? "";
if (filename.StartsWith("vconf_"))
continue;
try
{
using (var conn = new SQLiteConnection("Data Source=" + filePath))
Expand Down Expand Up @@ -265,7 +268,13 @@ private ChannelList ReadChannels(SQLiteCommand cmd, string dbPath, Dictionary<lo
"SRV.srvId", "major", "progNum", "cast(srvName as blob)", "srvType", "hidden", "scrambled", "lockMode", "numSel", // SRV
};
if (digital)
fieldNames.AddRange(new[] { "onid", "tsid", "vidPid", "provId", "cast(shrtSrvName as blob)" }); // SRV_DVB
{
fieldNames.AddRange(new[] {"onid", "tsid", "vidPid", "provId", "cast(shrtSrvName as blob)", "lcn"}); // SRV_DVB

// make LCN-based channel lists read-only
cmd.CommandText = "select count(1) from SRV_DVB where lcn<>65535";
channelList.ReadOnly = (long)cmd.ExecuteScalar() > 0;
}

var sql = this.BuildQuery(table, fieldNames);
var fields = this.GetFieldMap(fieldNames);
Expand Down Expand Up @@ -497,22 +506,14 @@ private static SQLiteCommand PrepareUpdateCommand(SQLiteConnection conn)
private static SQLiteCommand PrepareDeleteCommand(SQLiteConnection conn, bool digital)
{
var cmd = conn.CreateCommand();
cmd.CommandText = "select count(1) from sqlite_master where upper(name)='SRV_DVB_EXT' and type='table'";
bool hasDvbExt = (long) cmd.ExecuteScalar() > 0;

cmd.CommandText += "; delete from SRV_FAV where srvId=@id";

if (digital)
var sql = new StringBuilder();
cmd.CommandText = "select name from sqlite_master where sql like '%srvId integer%' order by name desc";
using (var r = cmd.ExecuteReader())
{
if (hasDvbExt)
cmd.CommandText += "; delete from SRV_DVB_EXT where srvId=@id";
cmd.CommandText += "; delete from SRV_DVB where srvId=@id";
while (r.Read())
sql.AppendLine($"; delete from {r.GetString(0)} where srvId=@id");
}
else
cmd.CommandText += "; delete from SRV_ANL where srvId=@id";

cmd.CommandText = "delete from SRV where srvId=@id";

cmd.CommandText = sql.ToString();
cmd.Parameters.Add(new SQLiteParameter("@id", DbType.Int64));
cmd.Prepare();
return cmd;
Expand Down Expand Up @@ -559,7 +560,7 @@ private void WriteChannels(SQLiteCommand cmdUpdateSrv, SQLiteCommand cmdDeleteSr
var channel = channelInfo as DbChannel;
if (channel == null) // ignore reference list proxy channels
continue;
channel.UpdateRawData();

if (channel.NewProgramNr < 0)
{
cmdDeleteSrv.Parameters["@id"].Value = channel.RecordIndex;
Expand All @@ -572,7 +573,7 @@ private void WriteChannels(SQLiteCommand cmdUpdateSrv, SQLiteCommand cmdDeleteSr
cmdUpdateSrv.Parameters["@lock"].Value = channel.Lock;
cmdUpdateSrv.Parameters["@hidden"].Value = channel.Hidden;
cmdUpdateSrv.Parameters["@numsel"].Value = !channel.Skip;
cmdUpdateSrv.Parameters["@srvname"].Value = channel.Name == null ? null : Encoding.BigEndianUnicode.GetBytes(channel.Name);
cmdUpdateSrv.Parameters["@srvname"].Value = channel.Name == null ? (object)DBNull.Value : Encoding.BigEndianUnicode.GetBytes(channel.Name);
cmdUpdateSrv.ExecuteNonQuery();
}

Expand Down
10 changes: 2 additions & 8 deletions source/ChanSort/ChanSort.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,21 @@
<ApplicationIcon>app.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Charts.v15.1.Core, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.Office.v15.1.Core, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.PivotGrid.v15.1.Core, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Printing.v15.1.Core, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.RichEdit.v15.1.Core, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Sparkline.v15.1.Core, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.Utils.v15.1.UI, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraBars.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.XtraCharts.v15.1.Wizard, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraCharts.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
Expand All @@ -88,12 +83,11 @@
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.XtraReports.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.DataAccess.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.DataAccess.v15.1.UI, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpo.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraReports.v15.1.Extensions, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Deployment" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
Expand Down
5 changes: 5 additions & 0 deletions source/ChanSort/GlobalImageCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ private void InitializeComponent()
//
// sharedImageCollection1
//
//
//
//
this.sharedImageCollection1.ImageSource.ImageStream = ((DevExpress.Utils.ImageCollectionStreamer)(resources.GetObject("sharedImageCollection1.ImageSource.ImageStream")));
this.sharedImageCollection1.ImageSource.Images.SetKeyName(36, "0036.png");
this.sharedImageCollection1.ImageSource.Images.SetKeyName(37, "0037.png");
this.sharedImageCollection1.ParentControl = null;
((System.ComponentModel.ISupportInitialize)(this.sharedImageCollection1.ImageSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sharedImageCollection1)).EndInit();
Expand Down
Loading

0 comments on commit b571e88

Please sign in to comment.