Add logos to music, photos, collections, and playlists by JonnyWong16 · Pull Request #1561 · pushingkarmaorg/python-plexapi

Pull Request Overview

This PR adds logo support to music library items (artists, albums, tracks), photo collections (photoalbums, photos), playlists, and collections by incorporating LogoMixin and LogoUrlMixin into their class definitions.

Key Changes:

  • Added LogoMixin to classes that support editing/uploading (Artist, Album, Photoalbum, Collection, Playlist)
  • Added LogoUrlMixin to classes with read-only access (Track, Photo)
  • Added comprehensive test coverage for the new logoUrl attribute across all affected entities

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
plexapi/audio.py Added LogoMixin to Artist and Album classes, LogoUrlMixin to Track class
plexapi/photo.py Added LogoMixin to Photoalbum class, LogoUrlMixin to Photo class
plexapi/collection.py Added LogoMixin to Collection class
plexapi/playlist.py Added LogoMixin to Playlist class
tests/test_mixins.py Added attr_logoUrl test function to validate logoUrl property
tests/test_audio.py Added logoUrl tests for Artist, Album, and Track
tests/test_photo.py Added logoUrl test for Photoalbum
tests/test_collection.py Added logoUrl test for Collection
tests/test_playlist.py Added logoUrl tests for Playlist
tests/test_video.py Added logoUrl tests for Movie, Show, Season, and Episode
Comments suppressed due to low confidence (1)

tests/test_mixins.py:308

  • The attr_logoUrl function calls _test_mixins_imageUrl(obj, "logo"), which will fail with an AttributeError.

The _test_mixins_imageUrl function at line 292 does if getattr(obj, attr):, which for logos means getattr(obj, "logo"). However, unlike art and thumb attributes that are loaded from XML in _loadData methods, there is no logo attribute on these objects.

The LogoUrlMixin.logoUrl property looks for logos in the images list (checking for type == 'clearLogo'), not from a logo attribute. This is different from how artUrl and posterUrl work.

To fix this, either:

  1. Add self.logo = data.attrib.get('logo') to the _loadData methods of all classes using LogoMixin/LogoUrlMixin (if Plex XML includes a logo attribute), OR
  2. Modify _test_mixins_imageUrl to handle logos specially, perhaps using hasattr with a try-except, or checking the images list directly for logos.
    url = getattr(obj, attr + "Url")
    if getattr(obj, attr):
        assert url.startswith(utils.SERVER_BASEURL)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.