RogerSelwyn / Home_Assistant_SkyQ_MediaPlayer

Home Assistant SkyQ Media player component
MIT License
104 stars 17 forks source link

[BUG] Lot of error in te log for missing attribute Episode #10

Closed ollo69 closed 4 years ago

ollo69 commented 4 years ago

Describe the bug
With some channel I receive a lot of error in the log as described below

To Reproduce
Steps to reproduce the behavior:

  1. What were you doing/watching at the time ? Seeing the TV
  2. What channel were you on? Sky Cinema Sci-Fi
  3. What time did the problem occur? during vision, error repeated for 164 times (until I change the channel)
  4. Where are you (bear in mind component supports GBR/ITA at the moment)? ITA

Expected behavior
A clear and concise description of what you expected to happen.

Catch the exception, simply do not provide info if not available

Screenshots
If applicable, add screenshots to help explain your problem.

Component versions

  1. What version of SkyQ component are you using? v2.2.1
  2. What was the last version where the problem was not shown? n/a

Your configuration
How have you setup your devices, by UI or YAML?

UI

Your configuration from the options dialogue

image

Output of HA logs
Paste the relavant output of the HA log here.

Logger: custom_components.skyq.media_player
Source: custom_components/skyq/media_player.py:421
Integration: Sky Q (documentation, issues)
First occurred: 2:00:11 (164 occurrences)
Last logged: 2:29:58

X0010M - Current Media retrieval failed: Media(channel='Sky Cinema Sci-Fi HD', imageUrl='https://ethaneurope.it.imageservice.sky.com/pd-logo/skychb_204skycinemascifihd/600/600', sid=204, pvrId=None, live=True) : 'str' object has no attribute 'episode'
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/skyq/media_player.py", line 421, in _async_getCurrentMedia
    self._episode = currentProgramme.episode
AttributeError: 'str' object has no attribute 'episode'
RogerSelwyn commented 4 years ago

What time did this happen at, so I can look at the EPG? What is the channel number you were on? Were you watching live, recorded or on pause?

ollo69 commented 4 years ago

Time is in the log, (2.00 to 2.29 am) Channel is in the issue info (Sky Cinema Sci-Fi, a thematic channel opened in June at number 303) Watching TV live In any case is not the first time, I received also watching other channels in the past...

RogerSelwyn commented 4 years ago

OK, I'll look at it over the week-end

RogerSelwyn commented 4 years ago

I think I can see why you get that error. Seems like the Italian EPG for 5th June starts as 12:30 UTC (2:30 Italian). So now I need to get it to check back a day as well as forward a day (which I do at end of day).

This is the EPG for that channel - https://apid.sky.it/gtv/v1/events?from=2020-06-05T00:00:00Z&to=2020-06-05T23:59:59Z&pageSize=50&pageNum=0&env=DTH&channels=9047

RogerSelwyn commented 4 years ago

Related information from Maurizio Fabiani:

2020-06-06 02:00:06 ERROR (MainThread) [custom_components.skyq.media_player] X0010M - Current Media retrieval failed: Media(channel='Sky Sport Uno HD', imageUrl='https://ethaneurope.it.imageservice.sky.com/pd-logo/skychb_23skysportunohd/600/600', sid=23, pvrId=None, live=True) : 'str' object has no attribute 'episode'
Traceback (most recent call last):
  File "/config/custom_components/skyq/media_player.py", line 421, in _async_getCurrentMedia
    self._episode = currentProgramme.episode
AttributeError: 'str' object has no attribute 'episode'

Looking at the hours (from 02:00:00 to 02:45:00) to it seems they appears only at night and maybe when the skyq is in standby mode. Never happened before with previous releases…

ollo69 commented 4 years ago

I think it happen only at night but not in stand-by mode (I was sleeping watching the TV at that hour :)). Make sense the analysys related to the UTC time used for the EPG. Should I try to install your last beta release?

RogerSelwyn commented 4 years ago

It should fix it, though I'm testing out some better code improvements overnight, before I put another beta out.

ollo69 commented 4 years ago

Ok, so I wait for next beta, thanks

RogerSelwyn commented 4 years ago

And yes 2am is midnight UTC, and Italian EPG brings back programmes starting between the hours searched for, and previously I look for 00:00 to 23:59. So now I'm changing to start at 22:00 the evening before, but again Italian EPG drops previous day listings off, which I'm trying to figure when. If you search to early like midday, then you get nothing back.

ollo69 commented 4 years ago

Let me know if you need any kind of support for testing...

RogerSelwyn commented 4 years ago

Thanks

RogerSelwyn commented 4 years ago

I just posted beta3. Give it a go and leave your Sky box on over 2am if you can, to test the midnight UTC logic.

Thanks

ollo69 commented 4 years ago

Just installed last beta3. Will let you now results tomorrow. Thanks again.

RogerSelwyn commented 4 years ago

Fixed by https://github.com/RogerSelwyn/Home_Assistant_SkyQ_MediaPlayer/releases/tag/v2.2.2