Skip to content

Commit

Permalink
Add get/update item metadata methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Jan 8, 2024
1 parent 749e322 commit 865d9cb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions jellyfin_apiclient_python/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,30 @@ def get_items(self, item_ids):
'Fields': info()
})

def get_item_metadata(self, item_id):
"""
Like :func:`get_item`, but returns all relevant metadata for the item.
Args:
item_id (str): item uuid to lookup metadata for
"""
body = self.get_items([item_id])['Items'][0]
return body

def update_item_metadata(self, item_id, data):
"""
Args:
item_id (str): item uuid to update metadata for
data (Dict): the new information to add to this item.
"""
# Force us to get the entire original item, we need to pass
# all information, otherwise all info is overwritten
body = self.get_item_metadata(item_id)
body.update(data)
assert body['Id'] == item_id
return self.items('/' + item_id, action='POST', params=None, json=body)

def get_sessions(self):
return self.sessions(params={'ControllableByUserId': "{UserId}"})

Expand Down

0 comments on commit 865d9cb

Please sign in to comment.