- Panasonic: fixed error reading lists with channels that refer to non-existing transponders

- Philips ChannelMap_45: incrementing fav list version number when saving and setting the last_watched_channel_id to
  the first channel in the fav list (ensuring that the channel is actually present in the list)
This commit is contained in:
Horst Beham
2021-02-17 09:41:06 +01:00
parent 241f8be0f7
commit f85ff02a92
3 changed files with 17 additions and 5 deletions

View File

@@ -40,8 +40,11 @@ namespace ChanSort.Loader.Panasonic
this.SignalSource |= SignalSource.SatIP;
byte[] buffer = new byte[1000];
var len = r.GetBytes(field["delivery"], 0, buffer, 0, 1000);
this.AddDebug(buffer, 0, (int) len);
if (!r.IsDBNull(field["delivery"]))
{
var len = r.GetBytes(field["delivery"], 0, buffer, 0, 1000);
this.AddDebug(buffer, 0, (int) len);
}
this.Skip = r.GetInt32(field["skip"]) != 0;
this.Encrypted = r.GetInt32(field["free_CA_mode"]) != 0;
@@ -87,7 +90,7 @@ namespace ChanSort.Loader.Panasonic
this.SignalSource |= LookupData.Instance.IsRadioTvOrData(stype);
this.ServiceType = stype;
int freq = r.GetInt32(field["freq"]);
int freq = r.IsDBNull(field["freq"]) ? 0 : r.GetInt32(field["freq"]);
if ((this.SignalSource & SignalSource.Sat) != 0)
{
// ReSharper disable PossibleLossOfFraction

View File

@@ -1005,14 +1005,14 @@ namespace ChanSort.Loader.Philips
{
cmd.CommandText = $"delete from FavoriteChannels where fav_list_id={favListId}";
cmd.ExecuteNonQuery();
sqlInsertOrUpdateList = "update List set list_name=@name where list_id=@id";
sqlInsertOrUpdateList = "update List set list_name=@name, list_version=list_version+1 where list_id=@id";
}
else
{
favListId = favListIndexToId.Count == 0 ? 1 : favListIndexToId.Max() + 1;
favListIndexToId[favListIndex] = favListId;
favListIdToIndex[favListId] = favListIndex;
sqlInsertOrUpdateList = "insert into List (list_id, list_name) values (@id,@name)";
sqlInsertOrUpdateList = "insert into List (list_id, list_name, list_version) values (@id,@name,1)";
}
cmd.CommandText = sqlInsertOrUpdateList;
@@ -1048,6 +1048,10 @@ namespace ChanSort.Loader.Philips
cmd.CommandText = "delete from List where list_id not in (select fav_list_id from FavoriteChannels)";
cmd.ExecuteNonQuery();
// make sure the last_watched_channel_id is valid in the list
cmd.CommandText = "update List set last_watched_channel_id=(select min(channel_id) from FavoriteChannels f where f.fav_list_id=List.list_id)";
cmd.ExecuteNonQuery();
trans.Commit();
conn.Close();
}

View File

@@ -1,6 +1,11 @@
ChanSort Change Log
===================
2021-02-17
- Panasonic: fixed error reading lists with channels that refer to non-existing transponders
- Philips ChannelMap_45: incrementing fav list version number when saving and setting the last_watched_channel_id to
the first channel in the fav list (ensuring that the channel is actually present in the list)
2021-02-09
- Sony: fixed incorrect checksum error for Android based TVs which use CR+LF as line separators (normally only LF is used)
- Philips: show info that it may be necessary to unplug and reboot the TV after the import