mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-02-28 01:00:43 +01:00
- added support for user-defined favorite list names within each channel list (antenna, cable, sat, ....)
- fixed bug saving wrong audioPid values in LG WebOS 4 XML/JSON files
This commit is contained in:
@@ -735,18 +735,19 @@ namespace ChanSort.Loader.Philips
|
||||
using var conn = new SQLiteConnection($"Data Source={listDb}");
|
||||
conn.Open();
|
||||
using var cmd = conn.CreateCommand();
|
||||
|
||||
// read favorite list names - disabled because currently ChanSort does not support different names for Fav1-4 based on input source
|
||||
//cmd.CommandText = "select list_id, list_name from List order by list_id";
|
||||
//using (var r = cmd.ExecuteReader())
|
||||
//{
|
||||
// while (r.Read())
|
||||
// {
|
||||
// var id = r.GetInt32(0);
|
||||
// var name = r.GetString(1);
|
||||
// this.DataRoot.SetFavListCaption(id - 1, name);
|
||||
// }
|
||||
//}
|
||||
|
||||
// read favorite list names
|
||||
cmd.CommandText = "select list_id, list_name from List order by list_id";
|
||||
using (var r = cmd.ExecuteReader())
|
||||
{
|
||||
while (r.Read())
|
||||
{
|
||||
var id = r.GetInt32(0);
|
||||
var name = r.GetString(1);
|
||||
var list = id <= 4 ? this.antChannels : id <= 8 ? this.cabChannels : this.satChannels;
|
||||
list.SetFavListCaption((id - 1)%4, name);
|
||||
}
|
||||
}
|
||||
|
||||
// read favorite channels
|
||||
for (int listIdx=0; listIdx<12; listIdx++)
|
||||
@@ -815,7 +816,7 @@ namespace ChanSort.Loader.Philips
|
||||
listIds.Add(listId);
|
||||
if (!this.mustFixFavListIds)
|
||||
listIndex = listId - 1;
|
||||
this.DataRoot.SetFavListCaption(listIndex, r.GetString(1));
|
||||
this.favChannels.SetFavListCaption(listIndex, r.GetString(1));
|
||||
++listIndex;
|
||||
}
|
||||
}
|
||||
@@ -1182,7 +1183,6 @@ namespace ChanSort.Loader.Philips
|
||||
using var cmd = conn.CreateCommand();
|
||||
using var trans = conn.BeginTransaction();
|
||||
|
||||
// TODO change data model so we can support different fav list names in each list and not require same name for Fav1-4 in each input source; then save the names in the "List" table
|
||||
|
||||
// save favorite channels
|
||||
for (int listIdx = 0; listIdx < 12; listIdx++)
|
||||
@@ -1192,7 +1192,21 @@ namespace ChanSort.Loader.Philips
|
||||
if ((long)cmd.ExecuteScalar() == 0)
|
||||
continue;
|
||||
|
||||
var incFavList = (ini.GetSection("Map" + chanLstBin.VersionMajor)?.GetBool("incrementFavListVersion", true) ?? true)
|
||||
? ", list_version=list_version+1"
|
||||
: "";
|
||||
|
||||
var list = listIdx < 4 ? this.antChannels : listIdx < 8 ? this.cabChannels : this.satChannels;
|
||||
cmd.CommandText = "update List set list_name=@name" + incFavList + " where list_id=@listId";
|
||||
cmd.Parameters.Add("@listId", DbType.Int32);
|
||||
cmd.Parameters.Add("@name", DbType.String);
|
||||
cmd.Parameters["@listId"].Value = listIdx + 1;
|
||||
cmd.Parameters["@name"].Value = list.GetFavListCaption(listIdx % 4, false);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
|
||||
cmd.CommandText = $"delete from {table}";
|
||||
cmd.Parameters.Clear();
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.CommandText = $"insert into {table} (_id, channel_id, rank) values (@id, @channelId, @rank)";
|
||||
@@ -1201,7 +1215,6 @@ namespace ChanSort.Loader.Philips
|
||||
cmd.Parameters.Add("@rank", DbType.Int32);
|
||||
|
||||
int order = 0;
|
||||
var list = listIdx < 4 ? this.antChannels : listIdx < 8 ? this.cabChannels : this.satChannels;
|
||||
foreach (var channel in list.Channels)
|
||||
{
|
||||
if (!(channel is Channel ch))
|
||||
@@ -1256,7 +1269,7 @@ namespace ChanSort.Loader.Philips
|
||||
cmd.Parameters.Add(new SQLiteParameter("@id", DbType.Int16));
|
||||
cmd.Parameters.Add(new SQLiteParameter("@name", DbType.String));
|
||||
cmd.Parameters["@id"].Value = favListId;
|
||||
cmd.Parameters["@name"].Value = DataRoot.GetFavListCaption(favListIndex) ?? "Fav " + (favListIndex + 1);
|
||||
cmd.Parameters["@name"].Value = this.favChannels.GetFavListCaption(favListIndex) ?? "Fav " + (favListIndex + 1);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.CommandText = "insert into FavoriteChannels(fav_list_id, channel_id, rank) values (@listId,@channelId,@rank)";
|
||||
|
||||
@@ -45,7 +45,7 @@ offChecksum=0
|
||||
offSymbolRate=8
|
||||
offFreq=18
|
||||
|
||||
# ChannelMap_45 format
|
||||
# ChannelMap_45 format (also used for ChannelMap_30)
|
||||
|
||||
[Map45_CableDb.bin_entry]
|
||||
offId=0
|
||||
@@ -89,6 +89,9 @@ offUnk1=48
|
||||
offUnk2=68
|
||||
offPolarity=72
|
||||
|
||||
[Map30]
|
||||
incrementFavListVersion=true
|
||||
|
||||
[Map45]
|
||||
incrementFavListVersion=true
|
||||
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace ChanSort.Loader.Philips
|
||||
this.Features.FavoritesMode = FavoritesMode.MixedSource;
|
||||
this.Features.MaxFavoriteLists = Math.Max(this.Features.MaxFavoriteLists, index);
|
||||
|
||||
this.DataRoot.SetFavListCaption(index - 1, name);
|
||||
this.favChannels.SetFavListCaption(index - 1, name);
|
||||
|
||||
if (this.favChannels.Count == 0)
|
||||
{
|
||||
@@ -586,7 +586,7 @@ namespace ChanSort.Loader.Philips
|
||||
favListNode.InnerXml = ""; // clear all <FavoriteChannel> child elements but keep the attributes of the current node
|
||||
var attr = favListNode.Attributes?["Name"];
|
||||
if (attr != null)
|
||||
attr.InnerText = EncodeName(this.DataRoot.GetFavListCaption(index - 1), (attr.InnerText.Length + 1)/5, false);
|
||||
attr.InnerText = EncodeName(this.favChannels.GetFavListCaption(index - 1), (attr.InnerText.Length + 1)/5, false);
|
||||
|
||||
// increment fav list version, unless disabled in .ini file
|
||||
if (chanLstBin != null && (ini.GetSection("Map" + chanLstBin.VersionMajor)?.GetBool("incrementFavListVersion", true) ?? true))
|
||||
|
||||
Reference in New Issue
Block a user