radityaharya / jellyfinapi

Python interface to Jellyfin Instance
14 stars 0 forks source link

Can't get parental and custon raiting of an item #1

Closed ftoek closed 1 year ago

ftoek commented 1 year ago

I'm trying to manipulate fields parental rating and custom rating of an item, however, I don't have CustomRating value in the BaseItemDto object returned in the callback. This is the a part of code I'm using:

item_res = items_controller.get_items_by_user_id(user_id=admin_id, parent_id=PARENT_ID)
re_query = re.compile("Boss")
for item in item_res.items:
    if re_query.search(item.name):
        print(f"{item.id} -> {item.name}, {item.official_rating},  {item._names['official_rating']}, {item._names['custom_rating']}")

and this is what I get

8b50ea0970c187473115191fa298ac9d -> The.Boss.Baby, RU-12+,  OfficialRating, CustomRating

image

Any ideas? maybe I'm doing something wrong?

radityaharya commented 1 year ago

I tried replicating the issue on my instance and it yielded the same result. For some reason the response from the "/Users/{userId}/Items" endpoint doesn't return the CustomRating value. I haven't updated this library since jellyfin-openapi-10.8.5 dated 25-Sep-2022, things might've changed that I'm not aware of. I'll have a look at it over the weekend.

ftoek commented 1 year ago

I figured this out this is not an issue, this is a feature, JellyfinapiClient.get_items by default fetches just a few fields, if you need more fields you have to specify them explicitly, this is a working code

from jellyfinapi.jellyfinapi_client import JellyfinapiClient
client = JellyfinapiClient(
    x_emby_token='xxx',
    server_url="http://host-name:8096/")
items_controller = client.items
item_res = items_controller.get_items(ids="8b50ea0970c187473115191fa298ac9d", fields="CustomRating,People")

fields="CustomRating,People" here I defined data fields I need to process