RogerSelwyn / Home_Assistant_SkyQ_MediaPlayer

Home Assistant SkyQ Media player component
MIT License
105 stars 16 forks source link

[BUG] Schedule date/time shows 0 #138

Closed toddstar closed 1 year ago

toddstar commented 1 year ago

Is your feature request related to a problem? Please describe.

Somehow my sky box is reporting that my next scheduled recording is Unix time 0

Screenshot_20230112-145507_Home Assistant

And short of factory resetting my box I can't see how to clear it; I've got zero actual scheduled recordings for that show, been through the TV guide to find all the times it's on and done a series link and unlink but still isn't clearing it.

Describe the solution you'd like
Assuming you get an array of next recordings (rather than just a single result) can you add a check so that scheduled end time must be equal or greater than now() and any that are older are ignored and it moves onto checking & listing the next recording where end time is greater than now()

Describe alternatives you've considered
Think now() should be fine but could go extra safe by just doing a date check and have anything that ended yesterday be ignored

P.S. If anyone has any ideas for how to clear it on the sky box I'd be extremely grateful (although think it'd still be a worth while update to the code)

RogerSelwyn commented 1 year ago

If anyone has any ideas for how to clear it on the sky box I'd be extremely grateful (although think it'd still be a worth while update to the code)

Sorry not sure what you mean by clear it.

In any case can you run this against your box and post the response (which may be long), or at least the first instance of an item that shows as a Status of SCHEDULED, ideally for the item that is giving a 0 response.

http://192.168.1.122:9006/as/pvr/?limit=1000&offset=0

toddstar commented 1 year ago

Cropped results below, it's a failed download that was causing the erroneous next scheduled time. Once that was cancelled my next scheduled recording has changed to 7pm (1673550000) for 'House of games'

{
      "at": "S",
      "carating": "U",
      "cn": "Sky History",
      "downloadlink": "oig:\/\/ff7d4e78",
      "eg": 5,
      "episodenumber": 19,
      "esg": 6,
      "et": "HD",
      "fr": "Remote network problem",
      "hd": true,
      "lto": 0,
      "predictedsz": 1176309,
      "programmeuuid": "cbd716c5-847d-4eab-9784-ec54d5b73af0",
      "pvrid": "P2903eb47",
      "schd": 1440,
      "seasonnumber": 2,
      "seasonuuid": "320f2955-6994-4f2d-9df5-676f57e77535",
      "seriesuuid": "d75f9f32-c7bd-4383-b82f-ff798450d824",
      "src": "VOD",
      "status": "DOWNLOADING",
      "sy": "Bigfoot's Death Cry And Bird On Mars: Experts investigate the theory that Bigfoot makes sounds that can make people sick, and examine images captured by NASA on Mars. (S2, ep 19)",
      "t": "The Proof Is Out There",
      "tso": 4,
      "vodprogrammeid": 8565128,
      "w": true
    },
    {
      "at": "M",
      "c": "111",
      "canl": true,
      "cn": "Dave HD",
      "eg": 3,
      "episodenumber": 59,
      "esg": 5,
      "et": "HD",
      "hd": true,
      "lto": 0,
      "oeid": "Eee1-1cc",
      "osid": "3809",
      "osk": 3809,
      "predictedsz": 3379200,
      "programmeuuid": "d0c9e4b5-fda8-40a5-857c-26217e738d21",
      "pvrid": "P2904180b",
      "s": true,
      "schd": 2400,
      "seasonnumber": 4,
      "seasonuuid": "d99d82e3-2fd0-4baa-a6d8-b458186ffe3c",
      "seriesuuid": "4bd96fbf-db6d-4e03-a83a-a1f6bae2bf20",
      "slo": true,
      "src": "LIVE",
      "st": 1673550000,
      "status": "SCHEDULED",
      "sy": "New. TV presenter Charlotte Hawkins and comedians David Baddiel, Alex Brooker, and Sophie Duker test themselves against the best-selling author and Pointless friend's fiendish games. S4 Ep59",
      "t": "Richard Osman's House of Games",
      "w": true
    },
RogerSelwyn commented 1 year ago

Looks like I need to exclude items that have failed downloading. I imagine that deleting that item and then making sure it is removed from the deleted items should clear it.

RogerSelwyn commented 1 year ago

@toddstar just got a chance to look at this. To be honest from the extract you provided I can't see why you got that error because I filter for SCHEDULED and RECORDING, and that one shows as DOWNLOADING.

Do you still have the problem, and if so can you check if there is another instance of the program that shows as SCHEDULED?

toddstar commented 1 year ago

I deleted that failed download which cleared the error however do have another download that is stuck at 0% but my template sensor for 'time to next recording' is correctly showing 330mins at the minute. Will test with cancelling some of my scheduled recordings to see if I can get it to show again.

(Also may actually still have the full json response, will check my PC later)

-- Michael

On Tue, 17 Jan 2023, 12:09 RogerSelwyn, @.***> wrote:

@toddstar https://github.com/toddstar just got a chance to look at this. To be honest from the extract you provided I can't see why you got that error because I filter for SCHEDULED and RECORDING, and that one shows as DOWNLOADING.

Do you still have the problem, and if so can you check if there is another instance of the program that shows as SCHEDULED?

— Reply to this email directly, view it on GitHub https://github.com/RogerSelwyn/Home_Assistant_SkyQ_MediaPlayer/issues/138#issuecomment-1385329514, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFMHV4GMJRB6PJVTQPMXZ3TWS2DV3ANCNFSM6AAAAAATZL5KXQ . You are receiving this because you were mentioned.Message ID: @.*** com>

toddstar commented 1 year ago

@toddstar just got a chance to look at this. To be honest from the extract you provided I can't see why you got that error because I filter for SCHEDULED and RECORDING, and that one shows as DOWNLOADING.

Do you still have the problem, and if so can you check if there is another instance of the program that shows as SCHEDULED?

I've found the issue. (altho not sure what happened with first set of data*)

Downloads that haven't started yet, or indeed go from failed to back into the download queue, also have the SCHEDULED status so these can be picked up as next recording.

e.g. 1 failed download but next recording was still fine

      {
         "at" : "DD",
         "carating" : "PG",
         "cn" : "Sky Documentaries",
         "downloadlink" : "oig://ff75e87d",
         "eg" : 3,
         "episodenumber" : 2,
         "esg" : 11,
         "et" : "HD",
         "fr" : "Remote network problem",
         "hd" : true,
         "lto" : 0,
         "predictedsz" : 4766093,
         "programmeuuid" : "1efb40e3-e0e0-459e-9d63-ec55f1b63d26",
         "pvrid" : "P2904605b",
         "r" : "PG",
         "s" : true,
         "schd" : 3060,
         "seasonnumber" : 1,
         "seasonuuid" : "32080ad7-d4c7-445c-aed3-a0bc757839fb",
         "seriesuuid" : "b1273791-0581-450b-b0bc-63add78f68f0",
         "src" : "VOD",
         "status" : "DOWNLOADING",
         "sy" : "...Transfer Window. New & Exclusive. As deadline day nears, Sasa KalajdZic considers Manchester United, Spurs cling on to Japhet Tanganga and Fabian Ruiz's dream hits a hurdle. (2 of 4)",
         "t" : "Deadline Day: Football's...",
         "vodprogrammeid" : 9049987,
         "w" : true                
      }
   ],
   "totalPvrItems" : 97,
   "version" : 11556
}

tried to download the same show that failed before

      {
         "at" : "DD",
         "carating" : "PG",
         "cn" : "Sky Documentaries",
         "downloadlink" : "oig://ff75e87d",
         "eg" : 3,
         "episodenumber" : 2,
         "esg" : 11,
         "et" : "HD",
         "fr" : "Remote network problem",
         "hd" : true,
         "lto" : 0,
         "predictedsz" : 4766093,
         "programmeuuid" : "1efb40e3-e0e0-459e-9d63-ec55f1b63d26",
         "pvrid" : "P2904605b",
         "r" : "PG",
         "s" : true,
         "schd" : 3060,
         "seasonnumber" : 1,
         "seasonuuid" : "32080ad7-d4c7-445c-aed3-a0bc757839fb",
         "seriesuuid" : "b1273791-0581-450b-b0bc-63add78f68f0",
         "src" : "VOD",
         "status" : "SCHEDULED",
         "sy" : "...Transfer Window. New & Exclusive. As deadline day nears, Sasa KalajdZic considers Manchester United, Spurs cling on to Japhet Tanganga and Fabian Ruiz's dream hits a hurdle. (2 of 4)",
         "t" : "Deadline Day: Football's...",
         "vodprogrammeid" : 9049987,
         "w" : true
      },
      {
         "at" : "S",
         "carating" : "PG",
         "cn" : "Sky History",
         "downloadlink" : "oig://ff7d4e78",
         "eg" : 5,
         "episodenumber" : 19,
         "esg" : 6,
         "et" : "HD",
         "fr" : "Remote network problem",
         "hd" : true,
         "lto" : 0,
         "predictedsz" : 1176309,
         "programmeuuid" : "cbd716c5-847d-4eab-9784-ec54d5b73af0",
         "pvrid" : "P29046533",
         "schd" : 1440,
         "seasonnumber" : 2,
         "seasonuuid" : "320f2955-6994-4f2d-9df5-676f57e77535",
         "seriesuuid" : "d75f9f32-c7bd-4383-b82f-ff798450d824",
         "src" : "VOD",
         "status" : "SCHEDULED",
         "sy" : "Bigfoot's Death Cry And Bird On Mars: Experts investigate the theory that Bigfoot makes sounds that can make people sick, and examine images captured by NASA on Mars. (S2, ep 19)",
         "t" : "The Proof Is Out There",
         "tso" : 4,
         "vodprogrammeid" : 8565128,
         "w" : true
      }
   ],
   "totalPvrItems" : 98,
   "version" : 12574

'Deadline Day: Football' has now gone from downloading to scheduled and is now showing as my next recording

Screenshot 2023-01-17 153457

deleting these go back to the correct show

Screenshot 2023-01-17 154435

(was also able to get similar results but just downloading two large movies, the next scheduled is the second movie waiting to be downloaded)

so think easiest check is just to make sure "st" isn't null

*only think I noticed from the actual sky box is the failed download seem to rapidly try restart so assume swaps between schedule and downloading quickly but this seem to stop after 5/10 seconds so may just have been luck / unlucky to get downloading state.

RogerSelwyn commented 1 year ago

Maybe be easier to check src and ignore items with VOD.

RogerSelwyn commented 1 year ago

Fixed with - https://github.com/RogerSelwyn/Home_Assistant_SkyQ_MediaPlayer/releases/tag/v2.10.10