Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions plexapi/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from plexapi.exceptions import BadRequest
from plexapi.mixins import (
AdvancedSettingsMixin, SplitMergeMixin, UnmatchMatchMixin, ExtrasMixin, HubsMixin, PlayedUnplayedMixin, RatingMixin,
ArtUrlMixin, ArtMixin, PosterUrlMixin, PosterMixin, SquareArtMixin, SquareArtUrlMixin, ThemeMixin, ThemeUrlMixin,
ArtUrlMixin, ArtMixin, LogoMixin, LogoUrlMixin, PosterUrlMixin, PosterMixin, SquareArtMixin, SquareArtUrlMixin,
ThemeMixin, ThemeUrlMixin,
ArtistEditMixins, AlbumEditMixins, TrackEditMixins
)
from plexapi.playlist import Playlist
Expand Down Expand Up @@ -181,7 +182,7 @@ def sonicallySimilar(
class Artist(
Audio,
AdvancedSettingsMixin, SplitMergeMixin, UnmatchMatchMixin, ExtrasMixin, HubsMixin, RatingMixin,
ArtMixin, PosterMixin, SquareArtMixin, ThemeMixin,
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin, ThemeMixin,
ArtistEditMixins
):
""" Represents a single Artist.
Expand Down Expand Up @@ -351,7 +352,7 @@ def metadataDirectory(self):
class Album(
Audio,
SplitMergeMixin, UnmatchMatchMixin, RatingMixin,
ArtMixin, PosterMixin, SquareArtMixin, ThemeUrlMixin,
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin, ThemeUrlMixin,
AlbumEditMixins
):
""" Represents a single Album.
Expand Down Expand Up @@ -504,7 +505,7 @@ def metadataDirectory(self):
class Track(
Audio, Playable,
ExtrasMixin, RatingMixin,
ArtUrlMixin, PosterUrlMixin, SquareArtUrlMixin, ThemeUrlMixin,
ArtUrlMixin, LogoUrlMixin, PosterUrlMixin, SquareArtUrlMixin, ThemeUrlMixin,
TrackEditMixins
):
""" Represents a single Track.
Expand Down
4 changes: 2 additions & 2 deletions plexapi/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from plexapi.library import LibrarySection, ManagedHub
from plexapi.mixins import (
AdvancedSettingsMixin, SmartFilterMixin, HubsMixin, RatingMixin,
ArtMixin, PosterMixin, SquareArtMixin, ThemeMixin,
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin, ThemeMixin,
CollectionEditMixins
)
from plexapi.utils import deprecated
Expand All @@ -18,7 +18,7 @@
class Collection(
PlexPartialObject,
AdvancedSettingsMixin, SmartFilterMixin, HubsMixin, RatingMixin,
ArtMixin, PosterMixin, SquareArtMixin, ThemeMixin,
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin, ThemeMixin,
CollectionEditMixins
):
""" Represents a single Collection.
Expand Down
8 changes: 6 additions & 2 deletions plexapi/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,15 @@ def setArt(self, art):
class LogoUrlMixin:
""" Mixin for Plex objects that can have a logo url. """

@property
def logo(self):
""" Return the API path to the logo image. """
return next((i.url for i in self.images if i.type == 'clearLogo'), None)

@property
def logoUrl(self):
""" Return the logo url for the Plex object. """
image = next((i for i in self.images if i.type == 'clearLogo'), None)
return self._server.url(image.url, includeToken=True) if image else None
return self._server.url(self.logo, includeToken=True) if self.logo else None


class LogoLockMixin:
Expand Down
6 changes: 3 additions & 3 deletions plexapi/photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from plexapi.exceptions import BadRequest
from plexapi.mixins import (
RatingMixin,
ArtUrlMixin, ArtMixin, PosterUrlMixin, PosterMixin, SquareArtMixin, SquareArtUrlMixin,
ArtUrlMixin, ArtMixin, LogoMixin, LogoUrlMixin, PosterUrlMixin, PosterMixin, SquareArtMixin, SquareArtUrlMixin,
PhotoalbumEditMixins, PhotoEditMixins
)

Expand All @@ -17,7 +17,7 @@
class Photoalbum(
PlexPartialObject,
RatingMixin,
ArtMixin, PosterMixin, SquareArtMixin,
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin,
PhotoalbumEditMixins
):
""" Represents a single Photoalbum (collection of photos).
Expand Down Expand Up @@ -159,7 +159,7 @@ def metadataDirectory(self):
class Photo(
PlexPartialObject, Playable,
RatingMixin,
ArtUrlMixin, PosterUrlMixin, SquareArtUrlMixin,
ArtUrlMixin, LogoUrlMixin, PosterUrlMixin, SquareArtUrlMixin,
PhotoEditMixins
):
""" Represents a single Photo.
Expand Down
4 changes: 2 additions & 2 deletions plexapi/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
from plexapi.base import Playable, PlexPartialObject, cached_data_property
from plexapi.exceptions import BadRequest, NotFound, Unsupported
from plexapi.library import LibrarySection, MusicSection
from plexapi.mixins import SmartFilterMixin, ArtMixin, PosterMixin, SquareArtMixin, PlaylistEditMixins
from plexapi.mixins import SmartFilterMixin, ArtMixin, LogoMixin, PosterMixin, SquareArtMixin, PlaylistEditMixins
from plexapi.utils import deprecated


@utils.registerPlexObject
class Playlist(
PlexPartialObject, Playable,
SmartFilterMixin,
ArtMixin, PosterMixin, SquareArtMixin,
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin,
PlaylistEditMixins
):
""" Represents a single Playlist.
Expand Down
11 changes: 7 additions & 4 deletions tests/test_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ def test_audio_Artist_mixins_edit_advanced_settings(artist):
def test_audio_Artist_mixins_images(artist):
test_mixins.lock_art(artist)
test_mixins.lock_poster(artist)
test_mixins.lock_square_art(artist)
test_mixins.lock_squareArt(artist)
test_mixins.edit_art(artist)
test_mixins.edit_poster(artist)
test_mixins.edit_square_art(artist)
test_mixins.edit_squareArt(artist)
test_mixins.attr_artUrl(artist)
test_mixins.attr_logoUrl(artist)
test_mixins.attr_posterUrl(artist)
test_mixins.attr_squareArtUrl(artist)

Expand Down Expand Up @@ -237,11 +238,12 @@ def test_audio_Album_artist(album):
def test_audio_Album_mixins_images(album):
test_mixins.lock_art(album)
test_mixins.lock_poster(album)
test_mixins.lock_square_art(album)
test_mixins.lock_squareArt(album)
test_mixins.edit_art(album)
test_mixins.edit_poster(album)
test_mixins.edit_square_art(album)
test_mixins.edit_squareArt(album)
test_mixins.attr_artUrl(album)
test_mixins.attr_logoUrl(album)
test_mixins.attr_posterUrl(album)
test_mixins.attr_squareArtUrl(album)

Expand Down Expand Up @@ -430,6 +432,7 @@ def test_audio_Track_sonicAdventure(account_plexpass, music):

def test_audio_Track_mixins_images(track):
test_mixins.attr_artUrl(track)
test_mixins.attr_logoUrl(track)
test_mixins.attr_posterUrl(track)
test_mixins.attr_squareArtUrl(track)

Expand Down
5 changes: 3 additions & 2 deletions tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,12 @@ def test_Collection_art(collection):
def test_Collection_mixins_images(collection):
test_mixins.lock_art(collection)
test_mixins.lock_poster(collection)
test_mixins.lock_square_art(collection)
test_mixins.lock_squareArt(collection)
test_mixins.edit_art(collection)
test_mixins.edit_poster(collection)
test_mixins.edit_square_art(collection)
test_mixins.edit_squareArt(collection)
test_mixins.attr_artUrl(collection)
test_mixins.attr_logoUrl(collection)
test_mixins.attr_posterUrl(collection)
test_mixins.attr_squareArtUrl(collection)

Expand Down
8 changes: 6 additions & 2 deletions tests/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def lock_poster(obj):
_test_mixins_lock_image(obj, "posters")


def lock_square_art(obj):
def lock_squareArt(obj):
_test_mixins_lock_image(obj, "squareArts")


Expand Down Expand Up @@ -298,7 +298,7 @@ def edit_poster(obj):
_test_mixins_edit_image(obj, "posters")


def edit_square_art(obj):
def edit_squareArt(obj):
_test_mixins_edit_image(obj, "squareArts")


Expand All @@ -318,6 +318,10 @@ def attr_artUrl(obj):
_test_mixins_imageUrl(obj, "art")


def attr_logoUrl(obj):
_test_mixins_imageUrl(obj, "logo")


def attr_posterUrl(obj):
_test_mixins_imageUrl(obj, "thumb")

Expand Down
8 changes: 5 additions & 3 deletions tests/test_photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ def test_photo_Photoalbum(photoalbum):

@pytest.mark.xfail(reason="Changing images fails randomly")
def test_photo_Photoalbum_mixins_images(photoalbum):
# test_mixins.lock_art(photoalbum) # Unlocking photoalbum artwork is broken in Plex
# test_mixins.lock_poster(photoalbum) # Unlocking photoalbum poster is broken in Plex
test_mixins.edit_art(photoalbum)
test_mixins.edit_poster(photoalbum)
test_mixins.lock_square_art(photoalbum)
test_mixins.edit_squareArt(photoalbum)
test_mixins.lock_art(photoalbum)
test_mixins.lock_poster(photoalbum)
test_mixins.lock_squareArt(photoalbum)
test_mixins.attr_artUrl(photoalbum)
test_mixins.attr_logoUrl(photoalbum)
test_mixins.attr_posterUrl(photoalbum)
test_mixins.attr_squareArtUrl(photoalbum)

Expand Down
8 changes: 6 additions & 2 deletions tests/test_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,14 @@ def test_Playlist_PlexWebURL(plex, show):
def test_Playlist_mixins_images(playlist):
test_mixins.lock_art(playlist)
test_mixins.lock_poster(playlist)
test_mixins.lock_square_art(playlist)
test_mixins.lock_squareArt(playlist)
test_mixins.edit_art(playlist)
test_mixins.edit_poster(playlist)
test_mixins.edit_square_art(playlist)
test_mixins.edit_squareArt(playlist)
test_mixins.attr_artUrl(playlist)
test_mixins.attr_logoUrl(playlist)
test_mixins.attr_posterUrl(playlist)
test_mixins.attr_squareArtUrl(playlist)


def test_Playlist_mixins_fields(playlist):
Expand Down
25 changes: 16 additions & 9 deletions tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,14 @@ def test_video_Movie_mixins_edit_advanced_settings(movie):
def test_video_Movie_mixins_images(movie):
test_mixins.lock_art(movie)
test_mixins.lock_poster(movie)
test_mixins.lock_square_art(movie)
test_mixins.lock_squareArt(movie)
test_mixins.edit_art(movie)
test_mixins.edit_poster(movie)
test_mixins.edit_square_art(movie)
test_mixins.edit_squareArt(movie)
test_mixins.attr_artUrl(movie)
test_mixins.attr_logoUrl(movie)
test_mixins.attr_posterUrl(movie)
test_mixins.attr_squareArtUrl(movie)


def test_video_Movie_mixins_themes(movie):
Expand Down Expand Up @@ -964,11 +968,12 @@ def test_video_Show_mixins_edit_advanced_settings(show):
def test_video_Show_mixins_images(show):
test_mixins.lock_art(show)
test_mixins.lock_poster(show)
test_mixins.lock_square_art(show)
test_mixins.lock_squareArt(show)
test_mixins.edit_art(show)
test_mixins.edit_poster(show)
test_mixins.edit_square_art(show)
test_mixins.edit_squareArt(show)
test_mixins.attr_artUrl(show)
test_mixins.attr_logoUrl(show)
test_mixins.attr_posterUrl(show)
test_mixins.attr_squareArtUrl(show)

Expand Down Expand Up @@ -1171,11 +1176,12 @@ def test_video_Season_mixins_images(show):
season = show.season(season=1)
test_mixins.lock_art(season)
test_mixins.lock_poster(season)
test_mixins.lock_square_art(season)
test_mixins.lock_squareArt(season)
test_mixins.edit_art(season)
test_mixins.edit_poster(season)
test_mixins.edit_square_art(season)
test_mixins.edit_squareArt(season)
test_mixins.attr_artUrl(season)
test_mixins.attr_logoUrl(season)
test_mixins.attr_posterUrl(season)
test_mixins.attr_squareArtUrl(season)

Expand Down Expand Up @@ -1392,11 +1398,12 @@ def test_video_Episode_unwatched(tvshows):
def test_video_Episode_mixins_images(episode):
test_mixins.lock_art(episode)
test_mixins.lock_poster(episode)
test_mixins.lock_square_art(episode)
# test_mixins.edit_art(episode) # Uploading episode artwork is broken in Plex
test_mixins.lock_squareArt(episode)
test_mixins.edit_art(episode)
test_mixins.edit_poster(episode)
test_mixins.edit_square_art(episode)
test_mixins.edit_squareArt(episode)
test_mixins.attr_artUrl(episode)
test_mixins.attr_logoUrl(episode)
test_mixins.attr_posterUrl(episode)
test_mixins.attr_squareArtUrl(episode)

Expand Down
Loading