mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Remove findLocations util function; All locations plural; Fix tests
This commit is contained in:
parent
4b8f82291b
commit
9052cf7be2
3 changed files with 8 additions and 15 deletions
|
@ -127,14 +127,11 @@ class Movie(Video, Playable):
|
|||
return bool(self.viewCount > 0)
|
||||
|
||||
@property
|
||||
def location(self):
|
||||
def locations(self):
|
||||
""" This does not exist in plex xml response but is added to have a common
|
||||
interface to get the location of the Movie/Show/Episode
|
||||
"""
|
||||
files = [i.file for i in self.iterParts() if i]
|
||||
if len(files) == 1:
|
||||
files = files[0]
|
||||
return files
|
||||
return [p.file for p in self.iterParts() if p]
|
||||
|
||||
def download(self, savepath=None, keep_orginal_name=False, **kwargs):
|
||||
downloaded = []
|
||||
|
@ -440,15 +437,11 @@ class Episode(Video, Playable):
|
|||
return self.fetchItem(self.grandparentKey)
|
||||
|
||||
@property
|
||||
def location(self):
|
||||
def locations(self):
|
||||
""" This does not exist in plex xml response but is added to have a common
|
||||
interface to get the location of the Movie/Show
|
||||
"""
|
||||
# Note this should probably belong to some parent.
|
||||
files = [i.file for i in self.iterParts() if i]
|
||||
if len(files) == 1:
|
||||
files = files[0]
|
||||
return files
|
||||
return [p.file for p in self.iterParts() if p]
|
||||
|
||||
def _prettyfilename(self):
|
||||
return '%s.S%sE%s' % (self.grandparentTitle.replace(' ', '.'),
|
||||
|
|
|
@ -12,7 +12,7 @@ def test_audio_Artist_attr(a_artist):
|
|||
assert m.key == '/library/metadata/20'
|
||||
assert m.librarySectionID == '3'
|
||||
assert m.listType == 'audio'
|
||||
assert m.location == '/media/music/unmastered_impulses'
|
||||
assert m.locations == ['/media/music/unmastered_impulses']
|
||||
assert m.ratingKey == 20
|
||||
assert m._server._baseurl == 'http://138.68.157.5:32400'
|
||||
assert m.similar == []
|
||||
|
|
|
@ -47,7 +47,7 @@ def test_video_Movie_download(monkeydownload, tmpdir, a_movie):
|
|||
|
||||
def test_video_Movie_attrs_as_much_as_possible(a_movie_section):
|
||||
m = a_movie_section.get('Cars')
|
||||
assert m.location == '/media/movies/cars/cars.mp4'
|
||||
assert m.locations == ['/media/movies/cars/cars.mp4']
|
||||
assert str(m.addedAt.date()) == '2017-01-17'
|
||||
assert m.art == '/library/metadata/2/art/1484690715'
|
||||
assert m.audienceRating == 7.9
|
||||
|
@ -255,7 +255,7 @@ def test_video_Show_attrs(a_show):
|
|||
assert str(m.lastViewedAt.date()) == '2017-01-22'
|
||||
assert m.leafCount == 9
|
||||
assert m.listType == 'video'
|
||||
assert m.location == '/media/tvshows/the 100'
|
||||
assert m.locations == ['/media/tvshows/the 100']
|
||||
assert str(m.originallyAvailableAt.date()) == '2014-03-19'
|
||||
assert m.rating == 8.1
|
||||
assert m.ratingKey == 12
|
||||
|
@ -290,7 +290,7 @@ def test_video_Show_location(pms):
|
|||
s = pms.library.section('TV Shows').get('The 100')
|
||||
# This will require a reload since the xml from http://138.68.157.5:32400/library/sections/2/all
|
||||
# Does not contain a location
|
||||
assert s.location == '/media/tvshows/the 100'
|
||||
assert s.locations == ['/media/tvshows/the 100']
|
||||
|
||||
def test_video_Show_reload(pms):
|
||||
s = pms.library.section('TV Shows').get('Game of Thrones')
|
||||
|
|
Loading…
Reference in a new issue