pkkid / python-plexapi

Python bindings for the Plex API.
BSD 3-Clause "New" or "Revised" License
1.14k stars 196 forks source link

Plex online sources str prints nan as id #1072

Open glensc opened 1 year ago

glensc commented 1 year ago

Describe the Bug

<Movie:nan:Silent-Rage>

The problem being that the ratingKey is hash not integer for those items: 5d7768532e80df001ebe18e7

Code Snippets

➜ git grep 'ratingKey = utils.cast'
plexapi/audio.py:        self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
plexapi/client.py:        self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
plexapi/collection.py:        self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
plexapi/photo.py:        self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
plexapi/photo.py:        self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
plexapi/playlist.py:        self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
plexapi/video.py:        self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))

Expected Behavior

No response

Additional Context

Related Issues:

Operating System and Version

Irrelevant

Plex Media Server Version

Irrelevant

Python Version

Irrelevant

PlexAPI Version

4.13.1

glensc commented 1 year ago

now fix would be to remove the cast, but then it would be a breaking change. so would need new API like "maybe cast", or add int_fallback=str argument?

JonnyWong16 commented 1 year ago

The entire library needs to be refactored to support Plex's online metadata source. There are a lot more differences than just the ratingKey.