mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-25 13:10:17 +00:00
Add custom Plex Web URL override for track, photo, and playlist
This commit is contained in:
parent
0811e5334c
commit
9483e4d9c9
3 changed files with 36 additions and 0 deletions
|
@ -415,3 +415,12 @@ class Track(Audio, Playable, ArtUrlMixin, PosterUrlMixin, RatingMixin,
|
|||
def _defaultSyncTitle(self):
|
||||
""" Returns str, default title for a new syncItem. """
|
||||
return '%s - %s - %s' % (self.grandparentTitle, self.parentTitle, self.title)
|
||||
|
||||
def getWebURL(self, base=None):
|
||||
""" Returns the Plex Web URL for the track's album.
|
||||
|
||||
Parameters:
|
||||
base (str): The base URL before the fragment (``#!``).
|
||||
Default is https://app.plex.tv/desktop.
|
||||
"""
|
||||
return self._buildWebURL(base=base, key=self.parentKey)
|
||||
|
|
|
@ -137,6 +137,15 @@ class Photoalbum(PlexPartialObject, ArtMixin, PosterMixin, RatingMixin):
|
|||
filepaths.append(filepath)
|
||||
return filepaths
|
||||
|
||||
def getWebURL(self, base=None):
|
||||
""" Returns the Plex Web URL for the photoalbum.
|
||||
|
||||
Parameters:
|
||||
base (str): The base URL before the fragment (``#!``).
|
||||
Default is https://app.plex.tv/desktop.
|
||||
"""
|
||||
return self._buildWebURL(base=base, legacy=True)
|
||||
|
||||
|
||||
@utils.registerPlexObject
|
||||
class Photo(PlexPartialObject, Playable, ArtUrlMixin, PosterUrlMixin, RatingMixin, TagMixin):
|
||||
|
@ -301,3 +310,12 @@ class Photo(PlexPartialObject, Playable, ArtUrlMixin, PosterUrlMixin, RatingMixi
|
|||
if filepath:
|
||||
filepaths.append(filepath)
|
||||
return filepaths
|
||||
|
||||
def getWebURL(self, base=None):
|
||||
""" Returns the Plex Web URL for the photo's photoalbum.
|
||||
|
||||
Parameters:
|
||||
base (str): The base URL before the fragment (``#!``).
|
||||
Default is https://app.plex.tv/desktop.
|
||||
"""
|
||||
return self._buildWebURL(base=base, key=self.parentKey, legacy=True)
|
||||
|
|
|
@ -459,3 +459,12 @@ class Playlist(PlexPartialObject, Playable, ArtMixin, PosterMixin, SmartFilterMi
|
|||
raise Unsupported('Unsupported playlist content')
|
||||
|
||||
return myplex.sync(sync_item, client=client, clientId=clientId)
|
||||
|
||||
def getWebURL(self, base=None):
|
||||
""" Returns the Plex Web URL for the playlist.
|
||||
|
||||
Parameters:
|
||||
base (str): The base URL before the fragment (``#!``).
|
||||
Default is https://app.plex.tv/desktop.
|
||||
"""
|
||||
return self._buildWebURL(base=base, endpoint='playlist')
|
||||
|
|
Loading…
Reference in a new issue