Closed richard-scott closed 4 years ago
No really obvious coding error. I'll have a look tonight to see what's happening.
Could you try restarting and see if it is working? I ran a standalone app I have to scraping and everything looked ok. I tried changing to 105 and as you said it went to 155. I enabled debug and restarted, whereupon it started working fine. I can't see any problem with the scraping of the site at the moment.
Nah, for me the wife has just complained that its changing to wrong channels. I've had many restarts and a restore recently, so its not that.
When you say you've enabled debugging, is that via logging in HA, or something else??
ah, I've added logging...
2020-04-26 22:11:02 DEBUG (SyncWorker_6) [custom_components.virgintivo.media_player] New channel [105]
2020-04-26 22:11:02 DEBUG (SyncWorker_6) [custom_components.virgintivo.media_player] Related channels: {105, 154, 155, 855}
2020-04-26 22:11:02 DEBUG (SyncWorker_6) [custom_components.virgintivo.media_player] Copied channel [105] to channel [154]
2020-04-26 22:11:02 DEBUG (SyncWorker_6) [custom_components.virgintivo.media_player] Copied channel [105] to channel [155]
2020-04-26 22:11:02 DEBUG (SyncWorker_6) [custom_components.virgintivo.media_player] Copied channel [105] to channel [855]
What does the channel copy do??
The channel copy doesn't matter for this. It is just copying the programme listings for 105 into 154, 155 and 855. The important bit is near the start of the log when it prints out the full channel layout. Here's the sort of thing you are looking for.
2020-04-23 19:32:36 DEBUG (SyncWorker_2) [custom_components.virgintivo.media_player] {100: {'name': 'Virgin Media Previews', 'logo': '', 'hd_channel': 0, 'plus_one': 0, 'show': 'UNSET', 'target': '', 'source': '', 'package': 'Player'}, 101: {'name': 'BBC One', 'logo': '', 'hd_channel': 0, 'plus_one': 0, 'show': 'true', 'target': '', 'source': '', 'package': 'Player'}, 102: {'name': 'BBC Two', 'logo': '', 'hd_channel': 0, 'plus_one': 0, 'show': 'true', 'target': '', 'source': '', 'package': 'Player'}, 103: {'name': 'ITV', 'logo': '', 'hd_channel': 113, 'plus_one': 114, 'show': 'true', 'target': '', 'source': '', 'package': 'Player'}, 104: {'name': 'Channel 4', 'logo': '', 'hd_channel': 141, 'plus_one': 142, 'show': 'true', 'target': '', 'source': '', 'package': 'Player'}, 105: {'name': 'Channel 5', 'logo': '', 'hd_channel': 0, 'plus_one': 155, 'show': 'true', 'target': '', 'source': '', 'package': 'Player'}
Looking specifically at the chunks for Channel 5
105: {'name': 'Channel 5', 'logo': '', 'hd_channel': 0, 'plus_one': 155, 'show': 'true', 'target': '', 'source': '', 'package': 'Player'}
154: {'name': 'Channel 5', 'logo': '', 'hd_channel': 105, 'plus_one': 155, 'show': 'UNSET', 'target': '', 'source': '', 'package': 'Player'}
155: {'name': 'Channel 5', 'logo': '', 'hd_channel': 0, 'plus_one': 0, 'show': 'UNSET', 'target': '', 'source': '', 'package': 'Player'}
This shows that channel 105 is the HD channel, 154 is the SD version and 155 is the +1 version. If you can grab the relevant chunks from your log, that would show whether yours is the same. If so, it isn't the site scraping that is the problem, must be something else.
Hmmm, I don't seem to have any HD channels listed in my dropdown now. My config is this:
- platform: virgintivo
scan_interval: 5
force_hd: true
tvchannellists:
enable: True
guide:
enable_guide: true
tivos:
1:
name: Virgin V6
host: TIVO-C680000
That looks fine. I can't imagine you're getting anything different when grabbing the site than I do. The values in the channels object look fine when I have a quick run-through. I'll go back through the switching logic to see if there is anything in there.
The channels no longer have HD in the name on the site, so that's probably why they don't appear in your dropdown. E.g. Channel 4 HD will just be listed as Channel 4. I'll check in case that is somehow causing a problem. Shouldn't be if I've done it right.
I have ran a few tests today, and it seems to be working fine. I think my issue was that new channels had been added, but I was only limiting things to the "Players" list... as we've had some temporary free channels things got confused.
Thanks for your work on this add-on I think its fantastic and saves lots of arguments at my house :-)
oh, and also I had an automation that was looking for "Channel 5 HD", and as it could not find it I assumed it was broken.... sorry about that.
I'm reopening this one as there does seem to be a problem. It's pretty inconsistent though. Most channels work fine, but a small number either don't change to the HD version, or change to the +1 version.
Adding extra debug logging to my version shows the issue, but seems utterly bizzare:
2020-05-01 07:36:39 DEBUG (SyncWorker_5) [custom_components.virgintivo.media_player] Virgin V6: changing to channel [0106]
2020-05-01 07:36:39 DEBUG (SyncWorker_5) [custom_components.virgintivo.media_player] Old channel details: [{'name': 'E4', 'logo': '', 'hd_channel': 145, 'plus_one': 146, 'show': True, 'target': '', 'source': ''}]
2020-05-01 07:36:39 DEBUG (SyncWorker_5) [custom_components.virgintivo.media_player] Virgin V6: automatically switching to HD channel [145]
2020-05-01 07:36:39 DEBUG (SyncWorker_5) [custom_components.virgintivo.media_player] New channel details: [{'name': 'E4', 'logo': '', 'hd_channel': None, 'plus_one': 146, 'show': False, 'target': '', 'source': ''}]
2020-05-01 07:36:39 DEBUG (SyncWorker_5) [custom_components.virgintivo.media_player] Virgin V6: setting channel to [146]
In the above I've changed to E4 (106). The component detects that there is a HD version at 145 and tries to switch to it. However when the actual switch happens it is to 146. The bizarre bit is that in the code, the value 145 in the log is what is returned from the function that looks for HD channels but the calling routine sees it as 146. Obviously I'm missing something but currently stumped. I'll have a look over the weekend.
Channels I've found that have the problem:
106 - detects HD as 145 but switches to 146 110 - detects HD as 109 but swtiches to 110 112 - detects HD as 111 but switches to 180 122 - detects HD as 121 but switches to 122
Found the problem, just need to decide what to do about it. It's because the channels now all have the same name. So when looking for E4, it is random whether we get the SD, HD or plus one versions. Easiest fix might be to just rename the channels. I'll have a think.
Fantastic work finding the issue :-)
My wife has just called me as the TV was changing from E4, to E4+1... maybe its just the '+1' channels that are causing issues?
First attempt at a fix
If it is causing you a headache, you can give it a go. Haven't done any testing yet. I've stuck it on my system to try it.
Let me know if there are any further problems.
When selecting "Channel 5 HD" in a Home Assistant automation I get changed to Channel 155, not 105.