From b60e541b00b3a1f809a6e10b6ffa824864b6e487 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Fri, 20 Nov 2020 20:34:41 -0800 Subject: [PATCH 1/4] Fix Collections stuck as partial object after reloading --- plexapi/base.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/plexapi/base.py b/plexapi/base.py index b8bfbd68..2f16c292 100644 --- a/plexapi/base.py +++ b/plexapi/base.py @@ -334,9 +334,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. """ @@ -612,14 +612,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. From 880043cb37607c6ab5082bf38931534f594294c2 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Fri, 20 Nov 2020 20:47:56 -0800 Subject: [PATCH 2/4] Add .vscode to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 39439fb4..6b7703a0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ syntax: glob .coverage .idea/ .Python +.vscode bin/ build config.ini From 3684b52d484e2648030dfc2fb9bada39c8ba4aff Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 21 Nov 2020 17:09:24 -0800 Subject: [PATCH 3/4] Fix collection mode update test --- tests/test_library.py | 4 ++-- tests/test_video.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_library.py b/tests/test_library.py index fabc3ff7..b576442c 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -242,7 +242,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() @@ -269,7 +269,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}) diff --git a/tests/test_video.py b/tests/test_video.py index 21ca259b..22cba4e9 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -909,7 +909,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 @@ -918,7 +918,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}) From fa4d8a45afadaad68d54eef189cc45968906a21d Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 21 Nov 2020 17:35:33 -0800 Subject: [PATCH 4/4] Collection mode default is -1 --- plexapi/library.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexapi/library.py b/plexapi/library.py index 4a7c4b84..50280dc9 100644 --- a/plexapi/library.py +++ b/plexapi/library.py @@ -1491,7 +1491,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'}