From a649d2ec12582cd49c06ef96346f07bfc44911b2 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Fri, 16 Oct 2020 12:31:18 -0700 Subject: [PATCH] Add locations for plexapi.photo.Photo and plexapi.video.Clip --- lib/plexapi/audio.py | 2 +- lib/plexapi/photo.py | 7 +++++++ lib/plexapi/video.py | 11 +++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/plexapi/audio.py b/lib/plexapi/audio.py index 8b5bf9cb..90f7be64 100644 --- a/lib/plexapi/audio.py +++ b/lib/plexapi/audio.py @@ -383,7 +383,7 @@ class Track(Audio, Playable): @property def locations(self): """ This does not exist in plex xml response but is added to have a common - interface to get the location of the Artist + interface to get the location of the Track """ return [part.file for part in self.iterParts() if part] diff --git a/lib/plexapi/photo.py b/lib/plexapi/photo.py index 51e087ce..437216fe 100644 --- a/lib/plexapi/photo.py +++ b/lib/plexapi/photo.py @@ -159,6 +159,13 @@ class Photo(PlexPartialObject): else: raise BadRequest('Unable to get section for photo, can`t find librarySectionID') + @property + def locations(self): + """ This does not exist in plex xml response but is added to have a common + interface to get the location of the Photo + """ + return [part.file for item in self.media for part in item.parts if part] + def sync(self, resolution, client=None, clientId=None, limit=None, title=None): """ Add current photo as sync item for specified device. See :func:`plexapi.myplex.MyPlexAccount.sync()` for possible exceptions. diff --git a/lib/plexapi/video.py b/lib/plexapi/video.py index cfc5cd44..d12ce4ad 100644 --- a/lib/plexapi/video.py +++ b/lib/plexapi/video.py @@ -328,7 +328,7 @@ class Movie(Playable, Video): @property def locations(self): """ This does not exist in plex xml response but is added to have a common - interface to get the location of the Movie/Show/Episode + interface to get the location of the Movie """ return [part.file for part in self.iterParts() if part] @@ -714,7 +714,7 @@ class Episode(Playable, Video): @property def locations(self): """ This does not exist in plex xml response but is added to have a common - interface to get the location of the Movie/Show + interface to get the location of the Episode """ return [part.file for part in self.iterParts() if part] @@ -770,3 +770,10 @@ class Clip(Playable, Video): self.type = data.attrib.get('type') self.year = utils.cast(int, data.attrib.get('year')) self.media = self.findItems(data, media.Media) + + @property + def locations(self): + """ This does not exist in plex xml response but is added to have a common + interface to get the location of the Clip + """ + return [part.file for part in self.iterParts() if part]