Get artwork using API
-
- Junior
- Posts: 55
- Joined: Sat May 31, 2014 4:58 am
Get artwork using API
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.
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.
Re: Get artwork using API
Hi,
Short answer, no, not from the frontend.
Try Dvr/GetRecordedList and or Video/GetVideoList from you browser and then look for lines like:
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.
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>
calling api.send(), which you know will return JSON.
Re: Get artwork using API
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.
but it includes the inetref and as you can see from the above, the URL can be
developed from that.
-
- Junior
- Posts: 55
- Joined: Sat May 31, 2014 4:58 am
Re: Get artwork using API
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.
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.
Re: Get artwork using API
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'.
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'.
Re: Get artwork using API
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.
in the calling code.) Not sure I like it, but it's a start.
-
- Junior
- Posts: 55
- Joined: Sat May 31, 2014 4:58 am
Re: Get artwork using API
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.
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.
-
- Junior
- Posts: 55
- Joined: Sat May 31, 2014 4:58 am
Re: Get artwork using API
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!
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!
-
- Junior
- Posts: 55
- Joined: Sat May 31, 2014 4:58 am
Re: Get artwork using API
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.
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.
Re: Get artwork using API
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?
Bill any reason you suggested GetRecordedList TitleRegEx instead?
Re: Get artwork using API
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.
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.
-
- Junior
- Posts: 55
- Joined: Sat May 31, 2014 4:58 am
Re: Get artwork using API
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.
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.
-
- Junior
- Posts: 55
- Joined: Sat May 31, 2014 4:58 am
Re: Get artwork using API
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
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