Jump to content

Get all TV Show ID's in Library?


Go to solution Solved by AbOoOdY,

Recommended Posts

EatSleepCodeDel
Posted

Hi all!

I am looking for an API endpoint where I can list all IDs of TV Shows or Movies in a library. I have looked at the docs, swagger.emby.media, and Googled and can't find anything to enumerate this data.

For context, I want to develop a small companion tool to dynamically manage collections based on metadata of TV shows and movies. For this to work, I need to iterate over each show or movie in a library, parse the data and add matching items to collections.

Apologies in advance if this is an `ID10T` error. 😅

Thanks!

Posted

hi, what have you done so far?

EatSleepCodeDel
Posted

Not a whole lot currently. I have been using curl to validate endpoints and their schema. e.g.

curl -X GET "http://<IP-ADDRESS>:8096/emby/Shows/290934/Episodes?api_key=${EMBY_TOKEN}"

I have been able to get valid responses, so I know the API is accessible in my environment and I can validate against it. What I want (in an ideal world) would be able to hit an endpoint like:

curl -X GET "http://<IP-ADDRESS>:8096/emby/libraries/tv_shows/entries?api_key=${EMBY_TOKEN}"

and get a response like:

{
  "TV Shows" : 
    [
      {
        "Title" : "foo",
        "ID" : "1234",
        "Genre" : "Comedy",
        "Studio" : "HBO"
      },
      {
        "Title" : "bar",
        "ID" : "4321",
        "Genre" : "Drama",
        "Studio" : "Netflix"
      }
    ],
  "page" : 1,
  "pages_total": 15
}

A single API call per 'page' of library entries would be ideal. I could then enumerate over the pages and parse the data in weird and wonderful ways, but I know this may not be possible. I would be happy with a way to query what is in my TV Shows or Movies library and have it return the IDs of the shows and movies in them. Is this possible?

Thank you!

hthgihwaymonk
Posted (edited)

I usually use the "GET /Users/{UserId}/Items" endpoint for this  

Edited by hthgihwaymonk
Souhila121320
Posted
curl -X GET "http://<IP-ADDRESS>:8096/emby/libraries/tv_shows/entries?api_key=${EMBY_TOKEN}"

 

  • Disagree 1
EatSleepCodeDel
Posted

Thanks for the suggestion, hthgihwaymonk. Unfortunately, that is not what I am after. I need to be able to get the IDs of each show or movie so I can then make calls to endpoints such as `/Shows/{Id}/Episodes`

  • Solution
AbOoOdY
Posted

try this:

{emby_server_url}/emby/Items?ParentId={parent_id}&api_key={api_key}

  • Thanks 1
EatSleepCodeDel
Posted

Thank you very much, AbOoOdY! That did the trick!

  • Like 1
  • 9 months later...
Ugnaughts
Posted
On 5/1/2024 at 11:35 PM, AbOoOdY said:

{emby_server_url}/emby/Items?ParentId={parent_id}&api_key={api_key}

do you know how to just get a list of the ids in that library? 

Posted
10 hours ago, Ugnaughts said:

do you know how to just get a list of the ids in that library? 

HI, I think the above query that you just quoted should do just that.

  • Thanks 1
Ugnaughts
Posted
3 hours ago, Luke said:

HI, I think the above query that you just quoted should do just that.

so i found the following cmd useful. the 1st one i had to parse just the ids into a list. then broke into 5 lists. then my script creates 5 process to break up the work load. cpu around 70percent. i thought great i found a way to speed things up. well just partially. it sent the cmds to emby 5 times faster. but then found out there's limit on the metadata providers to respond. although themoviedb says it can do 50 per second its more like 2 per second, maybe a emby limit.  

im not sure why its even contacting the metadata servers at all. if i already have all the nfo and images in with the media.??  maybe there is a better cmd than 3 ??

@Lukebasically if i have to nuke my database and start over. if all the metadata is still in with the media from the last time emby put it there. you would think it would be just an emby thing and it would update the library.db and everything would display in emby as before....

if we can get people to store there metadata in with media. in emby format. then it should never need to beat up the metadata servers. scans should be super fast. which would be great for all partys. emby // metadata providers // emby users

1===get all info for all ids in library.db====  

curl -X GET "http://localhost:8096/emby/Items?ParentId=<mylibID>&api_key=<myapikey>"

2===replace images if missing ===
curl.exe -X POST "http://localhost:8096/emby/Items/<myItemID>/Refresh?&ImageRefreshMode=FullRefresh&api_key=<myapikey>"

3=== replace if missing ===
curl.exe -X POST "http://localhost:8096/emby/Items/<myItemID>/Refresh?Recursive=true&ImageRefreshMode=FullRefresh&MetadataRefreshMode=FullRefresh&api_key=<myapikey>"

4=== if media is new  ===
curl.exe -X POST "http://localhost:8096/emby/Items/<myItemID>/Refresh?Recursive=true&ImageRefreshMode=default&MetadataRefreshMode=default&api_key=<myapikey>"

Posted
Quote

im not sure why its even contacting the metadata servers at all. if i already have all the nfo and images in with the media.??  maybe there is a better cmd than 3 ??

it will always try to supplement your nfo's with internet metadata. The only way to prevent this is to turn off internet metadata altogether.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...