Jump to content

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


Recommended Posts

PenkethBoy
Posted

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

 

 

  • 3 weeks later...
Posted

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

PenkethBoy
Posted

Great

  • 1 month later...
PenkethBoy
Posted

This is still not fixed in 4.5.0.13

Posted

Sorry I haven't had a chance to look at this yet.

  • 2 months later...
PenkethBoy
Posted

@Luke

Any chance you can look at this please as its still and issue in .26

Posted (edited)

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
PenkethBoy
Posted

apart from being off topic

limit and startindex have always worked for me via the http api

 

Posted (edited)

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
PenkethBoy
Posted

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

Posted (edited)

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
PenkethBoy
Posted

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?

  • 1 month later...
PenkethBoy
Posted

Can this outstanding bug get fixed please its a huge pain

  • 3 years later...
smoothquark
Posted

Apologies for resurrecting an old thread but I did not want to duplicate the topic title.

I have been playing with the REST API - I am trying to get a list of artists as well as counts for songs and albums. According to this thread, using Fields=ItemCounts should provide the counts. I am using: http://<server>:8096/emby/Artists?api_key=<api_key>&IncludeItemTypes=Music,MusicAlbum&Fields=ItemCounts,ProviderIds&Recursive=true, with the appropriate <server> and <api_key>. I do get a list of Artists and the ProviderIds but no counts. I have tried Artists/<name> but no success either. I notice that ItemCounts is not in the API documentation. Has it been deprecated? Perhaps I am being silly and missing something?

Thank you.

Posted
19 hours ago, smoothquark said:

Apologies for resurrecting an old thread but I did not want to duplicate the topic title.

I have been playing with the REST API - I am trying to get a list of artists as well as counts for songs and albums. According to this thread, using Fields=ItemCounts should provide the counts. I am using: http://<server>:8096/emby/Artists?api_key=<api_key>&IncludeItemTypes=Music,MusicAlbum&Fields=ItemCounts,ProviderIds&Recursive=true, with the appropriate <server> and <api_key>. I do get a list of Artists and the ProviderIds but no counts. I have tried Artists/<name> but no success either. I notice that ItemCounts is not in the API documentation. Has it been deprecated? Perhaps I am being silly and missing something?

Thank you.

Hi, truthfully this api is quite complicated. I kept it going solely for penkethboy, as a reward for his community participation. But he hasn't been around lately and as a result it hasn't stayed up to date with server revisions. It is possible to get it working again but it may not be currently returning correct data in the current 4.8 release.

smoothquark
Posted

Ah. That explains it. Thank you. I am getting around it by iterating through the list of artists but it is rather slow. As I am doing this via a script, perhaps I ought to try to query the sqlite db directly, but I am running Emby on a QNAP NAS and doing my work on a Debian desktop

  • Thanks 1
  • 9 months later...
jarome
Posted

Turn on Overview in the dots menu next to Filter

SCR-20250412-rcyu.png

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