garybuhrmaster / tv_grab_zz_sdjson_sqlite

XMLTV grabber for Schedules Direct JSON service
GNU General Public License v2.0
6 stars 8 forks source link

Add support for downloading artwork info for programme icon. #12

Open azlm8t opened 6 years ago

azlm8t commented 6 years ago

Although programmes can have an episodeImage, this is often missing from the SD data. For my channels, no programmes at all have an episodeImage.

So we now fetch image information for every programme we are downloading and use that to generate the programme icon.

We download the URL information only and not the actual artwork.

Since many programmes and show information are already cached, the database will need to be cleared if you want the artwork immediately for all programmes, otherwise it will be downloaded the next time the show is updated since we only download images for changed programmes.

The downloading is done on a "best effort" basis, so we don't keep trying to re-download images for any shows where artwork is missing. The overhead of downloading artwork seems minimal after the initial grab.

Where there is multiple artwork, we try and pick good quality episode artwork (based on image width), but fall-back to show artwork otherwise. For daytime shows sometimes there is no decent artwork for the show either so in that case we pick up "iconic" artwork from the episode, which appears to be just a screenshot.

I've tried to keep the code consistent with the existing logic, but error 5001 (queued) is ignored since I've never seen a case where a re-request is successful.