Genres API does not return ItemCount (Albums) when using fields query param #5384

Closed
opened 2026-02-07 01:45:04 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @ncrmro on GitHub (Jan 14, 2024).

Please describe your bug

Background: I was hoping to query genres and get album count and feed this to maybe chatGPT to consolidate my 300+ genres.

Issue:

Given a request to the following path Genres?limit=1&ParentId=LONG_ID&fields=ItemCount

I expect to get the count of items in the, though as I write this I realize what is the count of?

{
  "Items": [
    {
      "Name": "17",
      "ServerId": "e2846106fb984d5c8af2bb0dba3c9fcc",
      "Id": "483843092bd841d1010b657d2095675e",
      "ChannelId": null,
      "Type": "MusicGenre",
      "ImageTags": {
        "Primary": "239ddbca6bc9fe27e3f9098c58c8fe7b"
      },
      "BackdropImageTags": [],
      "ImageBlurHashes": {
        "Primary": {
          "239ddbca6bc9fe27e3f9098c58c8fe7b": "eGL,,UxFfQxE#S*OWWfQS3oM9^WWfQS4XS?YbFfQWoV@E3bHfQW;N^"
        }
      },
      "LocationType": "FileSystem"
    }
  ],
  "TotalRecordCount": 310,
  "StartIndex": 0
}

I will say the Web UI calls this url on the Genres page

/Genres?SortBy=SortName&SortOrder=Ascending&Recursive=true&Fields=PrimaryImageAspectRatio%2CItemCounts&StartIndex=0&ParentId=ID&userId=ID

Which returns an item like this but again no count.

        {
            "Name": "17",
            "ServerId": "e2846106fb984d5c8af2bb0dba3c9fcc",
            "Id": "483843092bd841d1010b657d2095675e",
            "ChannelId": null,
            "Type": "MusicGenre",
            "PrimaryImageAspectRatio": 1,
            "ImageTags": {
                "Primary": "239ddbca6bc9fe27e3f9098c58c8fe7b"
            },
            "BackdropImageTags": [],
            "ImageBlurHashes": {
                "Primary": {
                    "239ddbca6bc9fe27e3f9098c58c8fe7b": "eGL,,UxFfQxE#S*OWWfQS3oM9^WWfQS4XS?YbFfQWoV@E3bHfQW;N^"
                }
            },
            "LocationType": "FileSystem"
        },

I also trying connecting directly to the library database but found it's not in WAL mode.

Jellyfin Version

10.8.z

if other:

No response

Environment

- OS: Debian
- Linux Kernel:
- Virtualization: ContainerD/Kubernetes
- Clients:
- Browser:
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- GPU Model:
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking:
- Storage:

Jellyfin logs

No response

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Originally created by @ncrmro on GitHub (Jan 14, 2024). ### Please describe your bug Background: I was hoping to query genres and get album count and feed this to maybe chatGPT to consolidate my 300+ genres. Issue: Given a request to the following path `Genres?limit=1&ParentId=LONG_ID&fields=ItemCount` I expect to get the count of items in the, though as I write this I realize what is the count of? ``` { "Items": [ { "Name": "17", "ServerId": "e2846106fb984d5c8af2bb0dba3c9fcc", "Id": "483843092bd841d1010b657d2095675e", "ChannelId": null, "Type": "MusicGenre", "ImageTags": { "Primary": "239ddbca6bc9fe27e3f9098c58c8fe7b" }, "BackdropImageTags": [], "ImageBlurHashes": { "Primary": { "239ddbca6bc9fe27e3f9098c58c8fe7b": "eGL,,UxFfQxE#S*OWWfQS3oM9^WWfQS4XS?YbFfQWoV@E3bHfQW;N^" } }, "LocationType": "FileSystem" } ], "TotalRecordCount": 310, "StartIndex": 0 } ``` I will say the Web UI calls this url on the Genres page ``` /Genres?SortBy=SortName&SortOrder=Ascending&Recursive=true&Fields=PrimaryImageAspectRatio%2CItemCounts&StartIndex=0&ParentId=ID&userId=ID ``` Which returns an item like this but again no count. ``` { "Name": "17", "ServerId": "e2846106fb984d5c8af2bb0dba3c9fcc", "Id": "483843092bd841d1010b657d2095675e", "ChannelId": null, "Type": "MusicGenre", "PrimaryImageAspectRatio": 1, "ImageTags": { "Primary": "239ddbca6bc9fe27e3f9098c58c8fe7b" }, "BackdropImageTags": [], "ImageBlurHashes": { "Primary": { "239ddbca6bc9fe27e3f9098c58c8fe7b": "eGL,,UxFfQxE#S*OWWfQS3oM9^WWfQS4XS?YbFfQWoV@E3bHfQW;N^" } }, "LocationType": "FileSystem" }, ``` I also trying connecting directly to the library database but found it's not in WAL mode. ### Jellyfin Version 10.8.z ### if other: _No response_ ### Environment ```markdown - OS: Debian - Linux Kernel: - Virtualization: ContainerD/Kubernetes - Clients: - Browser: - FFmpeg Version: - Playback Method: - Hardware Acceleration: - GPU Model: - Plugins: - Reverse Proxy: - Base URL: - Networking: - Storage: ``` ### Jellyfin logs _No response_ ### FFmpeg logs _No response_ ### Please attach any browser or client logs here _No response_ ### Please attach any screenshots here _No response_ ### Code of Conduct - [X] I agree to follow this project's Code of Conduct
OVERLORD added the bugstale labels 2026-02-07 01:45:04 +03:00
Author
Owner

@jellyfin-bot commented on GitHub (May 14, 2024):

This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs.

If you have any questions you can use one of several ways to contact us.

@jellyfin-bot commented on GitHub (May 14, 2024): This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs. If you have any questions you can use one of several ways to [contact us](https://jellyfin.org/contact).
Author
Owner

@jellyfin-bot commented on GitHub (Jun 4, 2024):

This issue was closed due to inactivity.

@jellyfin-bot commented on GitHub (Jun 4, 2024): This issue was closed due to inactivity.
Author
Owner

@chrisbenincasa commented on GitHub (Jul 23, 2024):

Hey there - just wondering if you ever figured a workaround for this. Facing the same issue.

@chrisbenincasa commented on GitHub (Jul 23, 2024): Hey there - just wondering if you ever figured a workaround for this. Facing the same issue.
Author
Owner

@errorforce commented on GitHub (Mar 30, 2025):

solve it with multiple requests:

get all genres with your url and extract the genre name:
${serverUrl}/Genres?SortBy=SortName&SortOrder=Ascending&Recursive=true&UserId=${userId}

use each genre name and get the count:
${serverUrl}/Users/${userId}/Items?Recursive=true&Genres=${encodeURIComponent(genre.name)}&Limit=0

@errorforce commented on GitHub (Mar 30, 2025): solve it with multiple requests: get all genres with your url and extract the genre name: ${serverUrl}/Genres?SortBy=SortName&SortOrder=Ascending&Recursive=true&UserId=${userId} use each genre name and get the count: ${serverUrl}/Users/${userId}/Items?Recursive=true&Genres=${encodeURIComponent(genre.name)}&Limit=0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#5384