mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 14:14:19 +00:00
Ability to list all albums; Fix setting object values when not found (NA) and we know its the full object
This commit is contained in:
parent
748fc68406
commit
1a679411dc
4 changed files with 13 additions and 7 deletions
|
@ -263,6 +263,9 @@ class MusicSection(LibrarySection):
|
|||
ALLOWED_SORT = ('addedAt', 'lastViewedAt', 'viewCount', 'titleSort')
|
||||
TYPE = 'artist'
|
||||
|
||||
def albums(self):
|
||||
return utils.listItems(self.server, '/library/sections/%s/albums' % self.key)
|
||||
|
||||
def searchArtists(self, **kwargs):
|
||||
return self.search(libtype='artist', **kwargs)
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
"""
|
||||
PlexPlaylist
|
||||
"""
|
||||
import requests
|
||||
from plexapi import utils
|
||||
from plexapi.exceptions import BadRequest
|
||||
from plexapi.utils import cast, toDatetime
|
||||
|
|
|
@ -53,16 +53,12 @@ class PlexPartialObject(object):
|
|||
return '<%s:%s:%s>' % (clsname, key, title)
|
||||
|
||||
def __getattr__(self, attr):
|
||||
if attr == 'key' or self.__dict__.get(attr):
|
||||
if attr == 'key' or self.__dict__.get(attr) != NA:
|
||||
return self.__dict__.get(attr)
|
||||
if self.isPartialObject():
|
||||
self.reload()
|
||||
return self.__dict__[attr]
|
||||
|
||||
def __setattr__(self, attr, value):
|
||||
if value != NA:
|
||||
super(PlexPartialObject, self).__setattr__(attr, value)
|
||||
|
||||
def _loadData(self, data):
|
||||
raise Exception('Abstract method not implemented.')
|
||||
|
||||
|
|
|
@ -457,6 +457,14 @@ def test_stream_url(plex, account=None):
|
|||
log(2, 'Track: cvlc "%s"' % track.getStreamURL())
|
||||
|
||||
|
||||
@register('audio')
|
||||
def test_list_audioalbums(plex, account=None):
|
||||
music = plex.library.section(AUDIO_SECTION)
|
||||
albums = music.albums()
|
||||
for album in albums:
|
||||
log(2, '%s - %s [%s]' % (album.artist().title, album.title, album.year))
|
||||
|
||||
|
||||
@register('photo')
|
||||
def test_list_photoalbums(plex, account=None):
|
||||
photosection = plex.library.section(PHOTO_SECTION)
|
||||
|
@ -570,7 +578,7 @@ def _video_playback(plex, client):
|
|||
log(2, 'Play..')
|
||||
client.play(mtype); time.sleep(3)
|
||||
log(2, 'Seek to 10m..')
|
||||
client.seekTo(10*60*1000); time.sleep(5)
|
||||
client.seekTo(10 * 60 * 1000); time.sleep(5)
|
||||
log(2, 'Disable Subtitles..')
|
||||
client.setSubtitleStream(0, mtype); time.sleep(10)
|
||||
log(2, 'Load English Subtitles %s..' % subs[0].id)
|
||||
|
|
Loading…
Reference in a new issue