mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 11:43:13 +00:00
Fix thing I broke
This commit is contained in:
parent
c75db1df10
commit
e5fc43a85f
2 changed files with 23 additions and 8 deletions
|
@ -7,7 +7,7 @@ from datetime import datetime
|
|||
from plexapi.compat import quote, urlencode
|
||||
from plexapi.exceptions import NotFound, UnknownType, Unsupported
|
||||
from threading import Thread
|
||||
|
||||
from plexapi import log
|
||||
|
||||
# Search Types - Plex uses these to filter specific media types when searching.
|
||||
SEARCHTYPES = {'movie':1, 'show':2, 'season':3, 'episode':4, 'artist':8, 'album':9, 'track':10}
|
||||
|
@ -53,17 +53,20 @@ class PlexPartialObject(object):
|
|||
return '<%s:%s:%s>' % (clsname, key, title)
|
||||
|
||||
def __getattr__(self, attr):
|
||||
if attr == 'key' or self.__dict__.get(attr) != NA:
|
||||
return self.__dict__.get(attr)
|
||||
if self.isPartialObject():
|
||||
self.reload()
|
||||
return self.__dict__[attr]
|
||||
if attr == 'key' or self.__dict__.get(attr) or self.isFullObject():
|
||||
return self.__dict__.get(attr, NA)
|
||||
self.reload()
|
||||
return self.__dict__.get(attr, NA)
|
||||
|
||||
def __setattr__(self, attr, value):
|
||||
if value != NA or self.isFullObject():
|
||||
super(PlexPartialObject, self).__setattr__(attr, value)
|
||||
|
||||
def _loadData(self, data):
|
||||
raise Exception('Abstract method not implemented.')
|
||||
|
||||
def isFullObject(self):
|
||||
return not self.key or self.initpath == self.key
|
||||
return not self.key or self.key == self.initpath
|
||||
|
||||
def isPartialObject(self):
|
||||
return not self.isFullObject()
|
||||
|
|
|
@ -337,6 +337,18 @@ def test_create_playlist(plex, account=None):
|
|||
playlist.delete()
|
||||
|
||||
|
||||
@register('playlist,client')
|
||||
def test_play_playlist(plex, account=None):
|
||||
client = safe_client(CLIENT, CLIENT_BASEURL, plex)
|
||||
artist = plex.library.section(AUDIO_SECTION).get(AUDIO_ARTIST)
|
||||
album = artist.album(AUDIO_ALBUM)
|
||||
print(album.__dict__)
|
||||
playlist = plex.createPlaylist('test_play_playlist', album)
|
||||
try:
|
||||
print(playlist)
|
||||
finally:
|
||||
playlist.delete()
|
||||
|
||||
#-----------------------
|
||||
# Metadata
|
||||
#-----------------------
|
||||
|
@ -461,7 +473,7 @@ def test_stream_url(plex, account=None):
|
|||
def test_list_audioalbums(plex, account=None):
|
||||
music = plex.library.section(AUDIO_SECTION)
|
||||
albums = music.albums()
|
||||
for album in albums:
|
||||
for album in albums[:10]:
|
||||
log(2, '%s - %s [%s]' % (album.artist().title, album.title, album.year))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue