Jump to content

ItemCounts - Using emby/Artists or emby/Artists/AlbumArtist endpoints


PenkethBoy

Recommended Posts

PenkethBoy

If i query either emby/Artist or emby/Artist/AlbumArtist endpoints with Fields=Itemcounts

 

i get counts for Songs, Albums and Musicvideos for each Artist/AlbumArtist if applicable - great!

 

 

However

 

1. If i want to narrow the search to a specific Library and add parentId=<libraryidguid> - NO itemcounts are returned

2. The same happens if i specify a UserId - to limit the search to what the user has access to - NO Itemcounts returned

 

Is this intentional or perhaps a bug? - as it would be good to get these counts when needed for a particular library / or user access

 

 

Link to comment
Share on other sites

  • 3 weeks later...

Yes it looks like this is an issue that needs looking at. Thanks.

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Does this mean search will support Limit WITH support for StartIndex? :)

hopeful it will.. That would improve search so much having a start index with limit like every other API response. Then you can page search or have "more..." work correctly. Imagine the usefulness here. The potential.

Edited by speechles
Link to comment
Share on other sites

What I mean is.. you do not have item counts. Likely you cannot use a start index. Because it does not know how many are in the count...

So while fixing the aritst/albumartist lookup to include this ability.. at the same time and closely related.. can its cousin search get this same ability?

It is on topic. ;)

I mean there is TotalRecordCount that is a pretty good item counter too. But requires you get all the items. But item counts themselves aren't always there without getting them all. I thought this was done for speed. Not enumerating on some calls to speed them up.

I remember on Blue Neon Night I had genre counts, artist counts, all those.. and then one day the server stopped giving those counts. I was told they were eliminated to provide a speed boost. That it was slowing down the calls having to show these.

Edited by speechles
Link to comment
Share on other sites

PenkethBoy

huh

itemcounts/childcount are not valid for startindex or limit 

one is for the item itself and how many items to return

 the other is a property of an item - how many sub/child items it has associated with it

Link to comment
Share on other sites

itemcounts/childcounts do not appear unless you get the items too. That is what I am trying to say. But then what good are the counts if you already have the items. Exactly. To get the counts you have to pull all the items and enumerate them to return that as the count. In other words, the call might take the same amount of time as if you had just gotten the items. The only difference would be payload size. ie.. you wasted time enumerating just to throw away the result and you just get the count which is why it likely isnt doing this.

Edited by speechles
Link to comment
Share on other sites

PenkethBoy

its not doing it because its a bug - see post two - which Luke acknowledged

adding parentID will narrow down the request to less items - so reduces the payload which is returned. I want to eliminate AudioBooks from the request as i'm interested in my Music library in this case - if i dont use parentid then i get both in the result as Audiobooks are the same as music internally to Emby just with a diff name.

doing it via multiple requests is possible but would require the server to supply a minimum of three sets of results to the client app - then the client app would process them to get the result

But as this is an option in the api to request the 3 itemcounts by each individual albumartist or Artist - the server can do this much more efficiently (in sql directly on the db) itself and then provide a single result. For what is a few hundred artist/albumartists compared with getting thousands of song items back with probably a multi megabyte JSON file as the result.

 

"But then what good are the counts if you already have the items"

No actually you dont - you get a list of Artists/Album artist - with up to 3 extra fields containing the counts for Songs, MusicVideos and Albums - that info is calculated by the server prior to returning only a list of Artists/Albumartists - no need to request the total songs, MV and albums (although you could get this from songs)

And again has nothing to do with Limit or StartIndex

 

"To get the counts you have to pull all the items and enumerate them to return that as the count"

nope as the json has the counts already calculated or Once the json is imported (yes i suppose this is enumeration) to my app i know the total count a a property of the object - and a 10,000+ payload can be process in a few milliseconds so not a hardship or time factor 

 

And You are talking about the http API as thats what i use not the api via a plugin?

Link to comment
Share on other sites

  • 1 month later...

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...