Merge pull request #606 from JonnyWong16/bugfix/full_object

Fix Collections stuck as partial object after reloading
This commit is contained in:
Steffen Fredriksen 2020-11-23 07:47:10 +01:00 committed by GitHub
commit b623b43a58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 15 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@ syntax: glob
.coverage
.idea/
.Python
.vscode
bin/
build
config.ini

View file

@ -401,9 +401,9 @@ class PlexPartialObject(PlexObject):
""" Retruns True if this is already a full object. A full object means all attributes
were populated from the api path representing only this item. For example, the
search result for a movie often only contain a portion of the attributes a full
object (main url) for that movie contain.
object (main url) for that movie would contain.
"""
return not self.key or self.key == self._initpath
return not self.key or (self._details_key or self.key) == self._initpath
def isPartialObject(self):
""" Returns True if this is not a full object. """
@ -679,14 +679,6 @@ class Playable(object):
self.playlistItemID = utils.cast(int, data.attrib.get('playlistItemID')) # playlist
self.playQueueItemID = utils.cast(int, data.attrib.get('playQueueItemID')) # playqueue
def isFullObject(self):
""" Retruns True if this is already a full object. A full object means all attributes
were populated from the api path representing only this item. For example, the
search result for a movie often only contain a portion of the attributes a full
object (main url) for that movie contain.
"""
return self._details_key == self._initpath or not self.key
def getStreamURL(self, **params):
""" Returns a stream url that may be used by external applications such as VLC.

View file

@ -1500,7 +1500,7 @@ class Collections(PlexPartialObject):
collection = 'plexapi.library.Collections'
collection.updateMode(mode="hide")
"""
mode_dict = {'default': '-2',
mode_dict = {'default': '-1',
'hide': '0',
'hideItems': '1',
'showItems': '2'}

View file

@ -246,7 +246,7 @@ def test_library_editAdvanced_default(movies):
def test_library_Collection_modeUpdate(collection):
mode_dict = {"default": "-2", "hide": "0", "hideItems": "1", "showItems": "2"}
mode_dict = {"default": "-1", "hide": "0", "hideItems": "1", "showItems": "2"}
for key, value in mode_dict.items():
collection.modeUpdate(key)
collection.reload()
@ -273,7 +273,7 @@ def test_library_Colletion_edit(collection):
for field in collection.fields:
if field.name == 'titleSort':
assert collection.titleSort == 'New Title Sort'
assert field.locked == True
assert field.locked is True
collection.edit(**{'titleSort.value': collectionTitleSort, 'titleSort.locked': 0})

View file

@ -911,7 +911,7 @@ def test_video_edits_locked(movie, episode):
for field in movie.fields:
if field.name == 'titleSort':
assert movie.titleSort == 'New Title Sort'
assert field.locked == True
assert field.locked is True
movie.edit(**{'titleSort.value': movieTitleSort, 'titleSort.locked': 0})
episodeTitleSort = episode.titleSort
@ -920,7 +920,7 @@ def test_video_edits_locked(movie, episode):
for field in episode.fields:
if field.name == 'titleSort':
assert episode.titleSort == 'New Title Sort'
assert field.locked == True
assert field.locked is True
episode.edit(**{'titleSort.value': episodeTitleSort, 'titleSort.locked': 0})