mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Add support for artist popular tracks (#1453)
* Add artist popular tracks * Test artist popular tracks
This commit is contained in:
parent
e23cd8d158
commit
075e7d7e12
3 changed files with 22 additions and 1 deletions
|
@ -281,6 +281,21 @@ class Artist(
|
|||
filepaths += track.download(_savepath, keep_original_name, **kwargs)
|
||||
return filepaths
|
||||
|
||||
def popularTracks(self):
|
||||
""" Returns a list of :class:`~plexapi.audio.Track` popular tracks by the artist. """
|
||||
filters = {
|
||||
'album.subformat!': 'Compilation,Live',
|
||||
'artist.id': self.ratingKey,
|
||||
'group': 'title',
|
||||
'ratingCount>>': 0,
|
||||
}
|
||||
return self.section().search(
|
||||
libtype='track',
|
||||
filters=filters,
|
||||
sort='ratingCount:desc',
|
||||
limit=100
|
||||
)
|
||||
|
||||
def station(self):
|
||||
""" Returns a :class:`~plexapi.playlist.Playlist` artist radio station or `None`. """
|
||||
key = f'{self.key}?includeStations=1'
|
||||
|
|
|
@ -2823,7 +2823,8 @@ class FilteringType(PlexObject):
|
|||
additionalFields.extend([
|
||||
('duration', 'integer', 'Duration'),
|
||||
('viewOffset', 'integer', 'View Offset'),
|
||||
('label', 'tag', 'Label')
|
||||
('label', 'tag', 'Label'),
|
||||
('ratingCount', 'integer', 'Rating Count'),
|
||||
])
|
||||
elif self.type == 'collection':
|
||||
additionalFields.extend([
|
||||
|
|
|
@ -88,6 +88,11 @@ def test_audio_Artist_hubs(artist):
|
|||
assert isinstance(hubs, list)
|
||||
|
||||
|
||||
def test_audio_Artist_popularTracks(artist):
|
||||
tracks = artist.popularTracks()
|
||||
assert len(tracks)
|
||||
|
||||
|
||||
def test_audio_Artist_mixins_edit_advanced_settings(artist):
|
||||
test_mixins.edit_advanced_settings(artist)
|
||||
|
||||
|
|
Loading…
Reference in a new issue