Get artwork using API

Get artwork using API

Postby lindsayward » Sat May 06, 2017 12:34 am

Hi.
Is there a way to get the program artwork using the Frontend Service API?

I would like to be able to get a (local) URL to an image for the currently playing recording.
Australialindsayward
Junior
 
Posts: 47
Joined: Sat May 31, 2014 4:58 am

Re: Get artwork using API

Postby bill6502 » Sat May 06, 2017 12:49 am

Hi,

Short answer, no, not from the frontend.

Try Dvr/GetRecordedList and or Video/GetVideoList from you browser and then look for lines like:
Code: Select all
<Artwork>
<ArtworkInfos>
<ArtworkInfo>
<URL>
/Content/GetImageFile?StorageGroup=Coverart&FileName=/tmdb3.py_10201_coverart.jpg
</URL>
<FileName>myth://Coverart@mc0/tmdb3.py_10201_coverart.jpg</FileName>
<StorageGroup>Coverart</StorageGroup>
<Type>coverart</Type>
</ArtworkInfo>
<ArtworkInfo>

Note that you're getting this from the backend so set the port to 6544 when
calling api.send(), which you know will return JSON.
User avatar
United States of Americabill6502
Developer
 
Posts: 747
Joined: Fri Feb 07, 2014 5:28 pm

Re: Get artwork using API

Postby bill6502 » Sat May 06, 2017 12:57 am

Also, for recordings there's GetTitleInfoList which returns much less information,
but it includes the inetref and as you can see from the above, the URL can be
developed from that.
User avatar
United States of Americabill6502
Developer
 
Posts: 747
Joined: Fri Feb 07, 2014 5:28 pm

Re: Get artwork using API

Postby lindsayward » Sun May 07, 2017 11:09 pm

Thanks!
Are you Bill Meek from: https://github.com/billmeek/MythTVServicesAPI
I'm working on a Home Assistant platform (https://github.com/calmor15014/HA-Compo ... v-frontend) using this Python API, so thanks if you are!

So, looks like I can use this Python wrapper for any MythTV API (listed at https://www.mythtv.org/wiki/Services_API)?
Then I can get the recording ID from the frontend and use it to look up "Dvr/GetRecorded" to get the artwork (and other) data from the backend...
I'll test that soon.
Australialindsayward
Junior
 
Posts: 47
Joined: Sat May 31, 2014 4:58 am

Re: Get artwork using API

Postby bill6502 » Mon May 08, 2017 1:22 am

As long as it's working, yes that's me. And you right about send(). Originally, I'd considered
one module per service (Dvr/Frontend/Video etc.) but saw that they're all doing the same
thing, so abandon the idea and tried to make a single tool that any endpoint could be
plugged into. Really, a subset of send() could live in the work you and Jim are doing.

For this specific case, I assume you're trying to get art for the recording that's playing.
So could use the title that you've already got from Frontend/GetStatus and then call
endpoint=Dvr/GetRecordedList, rest=TitleRegEx=Elementary (for example.) The
response will have the URL you need to get the art. But send() will fire an error
'cause the response isn't JSON, rather, it's an icon. I hadn't tried this, looks like a
bug to me. Maybe a new opt like 'rawdata'.
User avatar
United States of Americabill6502
Developer
 
Posts: 747
Joined: Fri Feb 07, 2014 5:28 pm

Re: Get artwork using API

Postby bill6502 » Mon May 08, 2017 3:59 am

Try mythtv_services_api-0.0.4 (you must delete the temporary file
in the calling code.) Not sure I like it, but it's a start.
User avatar
United States of Americabill6502
Developer
 
Posts: 747
Joined: Fri Feb 07, 2014 5:28 pm

Re: Get artwork using API

Postby lindsayward » Fri May 19, 2017 9:17 am

I just noticed I didn't reply to say thank you... Thank you!
I think I was waiting until I'd tried out what you'd suggested...

I have been following your API updates (v 0.0.8 currently), and will keep trying with your suggestions as well.
Australialindsayward
Junior
 
Posts: 47
Joined: Sat May 31, 2014 4:58 am

Re: Get artwork using API

Postby lindsayward » Sat May 20, 2017 2:12 am

Is there any way to get a unique identifier from the frontend to look up the recorded program details?

I would like to use the info on what's currently playing (Frontend/GetStatus) to look up the metadata on that program (Dvr/GetRecorded), but I don't see anything unique.
Do I just have to use the title and subtitle of the current item to go looking for the program in the GetRecordedList details? Or is there a better way?
Thanks!
Australialindsayward
Junior
 
Posts: 47
Joined: Sat May 31, 2014 4:58 am

Re: Get artwork using API

Postby lindsayward » Sat May 20, 2017 1:02 pm

I have got what I want working - thanks for your help Bill!
But I would still like to know if there's a better way to get the program data from the backend for the current program playing on the frontend. It would be great if MythTV would provide a unique identifier to link them together.

Currently I'm getting all programs with the matching "Title", then if there are multiples, I look for the one with matching "SubTitle". I hope there won't be duplicates of those, but I guess there could be.
Australialindsayward
Junior
 
Posts: 47
Joined: Sat May 31, 2014 4:58 am

Re: Get artwork using API

Postby daraden » Wed May 24, 2017 1:01 am

The best way to get a unique recording entry would be using the chanid and starttime with Dvr/GetRecorded. For videos you would need to strip the path name to just the file name and use Video/GetVideoByFileName.

Bill any reason you suggested GetRecordedList TitleRegEx instead?
United States of Americadaraden
Senior
 
Posts: 142
Joined: Tue Feb 23, 2016 7:33 am

Re: Get artwork using API

Postby bill6502 » Wed May 24, 2017 1:33 am

Hi,

Been mostly off the grid for the last week, but suggest TitleRegEx
to get all (perhaps previously recorded) recordings of a single series.
If a recording is in progress and the metadata hasn't been retrieved,
getting a unique recording may not give the desired results.

daraden is correct for a unique recording, or with 0.28+ if the RecordedId
is available, then I'd prefer it.
User avatar
United States of Americabill6502
Developer
 
Posts: 747
Joined: Fri Feb 07, 2014 5:28 pm

Re: Get artwork using API

Postby lindsayward » Sat May 27, 2017 7:21 am

Thanks for the replies daraden and Bill!
The start time + channel id seem a bit odd, but I guess that uniquely identifies the playing video in the list so I don't need to get all and process them.
That sounds good and a quick test in the browser shows that it works.
Recordedid doesn't exist on most of my recorded media it seems, so I'll skip that.
I haven't looked at videos (as opposed to TV) since I very rarely use those, but I'll check that out.
Australialindsayward
Junior
 
Posts: 47
Joined: Sat May 31, 2014 4:58 am

Re: Get artwork using API

Postby lindsayward » Fri Jun 02, 2017 9:45 pm

Thanks again for the input.
Using starttime and chanid works well. Done. https://github.com/calmor15014/HA-Compo ... 05eab63b93
I was also able to handle video artwork as well. https://github.com/calmor15014/HA-Compo ... ab8915715e
Australialindsayward
Junior
 
Posts: 47
Joined: Sat May 31, 2014 4:58 am


Return to Services API



Who is online

Users browsing this forum: No registered users and 1 guest

cron