Skip to content

Commit 168f1d3

Browse files
authored
Add attribute for Sonic Analysis (#814)
* adding new attribute found in Albums and Tracks when Sonically Analyzed * update docstring and add property hasSonicAnalysis
1 parent 9f9e235 commit 168f1d3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

plexapi/audio.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Audio(PlexPartialObject):
2828
librarySectionTitle (str): :class:`~plexapi.library.LibrarySection` title.
2929
listType (str): Hardcoded as 'audio' (useful for search filters).
3030
moods (List<:class:`~plexapi.media.Mood`>): List of mood objects.
31+
musicAnalysisVersion (int): The Plex music analysis version for the item.
3132
ratingKey (int): Unique key identifying the item.
3233
summary (str): Summary of the artist, album, or track.
3334
thumb (str): URL to thumbnail image (/library/metadata/<ratingKey>/thumb/<thumbid>).
@@ -59,6 +60,7 @@ def _loadData(self, data):
5960
self.librarySectionTitle = data.attrib.get('librarySectionTitle')
6061
self.listType = 'audio'
6162
self.moods = self.findItems(data, media.Mood)
63+
self.musicAnalysisVersion = utils.cast(int, data.attrib.get('musicAnalysisVersion'))
6264
self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
6365
self.summary = data.attrib.get('summary')
6466
self.thumb = data.attrib.get('thumb')
@@ -78,6 +80,11 @@ def _defaultSyncTitle(self):
7880
""" Returns str, default title for a new syncItem. """
7981
return self.title
8082

83+
@property
84+
def hasSonicAnalysis(self):
85+
""" Returns True if the audio has been sonically analyzed. """
86+
return self.musicAnalysisVersion == 1
87+
8188
def sync(self, bitrate, client=None, clientId=None, limit=None, title=None):
8289
""" Add current audio (artist, album or track) as sync item for specified device.
8390
See :func:`~plexapi.myplex.MyPlexAccount.sync` for possible exceptions.

0 commit comments

Comments
 (0)