media_player.kodi extra attributes for tvshow and music media (#6622)
* media_player.kodi extra attributes for tvshow and music media * removed extra whitespaces/CR * Kodi - add extra attributes #6250 (removed music attributes) * Restored music attributes, this is ready for merge * linting amended * Fix Kodi artist support * Copy-paste error * Fix for non-music artist lookup Kodi returns an emtpy list on videos, so we need to be able to handle that as well.
This commit is contained in:
parent
198a234468
commit
2c8a06bfbe
1 changed files with 40 additions and 1 deletions
|
@ -316,7 +316,8 @@ class KodiDevice(MediaPlayerDevice):
|
|||
|
||||
self._item = (yield from self.server.Player.GetItem(
|
||||
player_id,
|
||||
['title', 'file', 'uniqueid', 'thumbnail', 'artist']
|
||||
['title', 'file', 'uniqueid', 'thumbnail', 'artist',
|
||||
'albumartist', 'showtitle', 'album', 'season', 'episode']
|
||||
))['item']
|
||||
else:
|
||||
self._properties = {}
|
||||
|
@ -398,6 +399,44 @@ class KodiDevice(MediaPlayerDevice):
|
|||
return self._item.get(
|
||||
'title', self._item.get('label', self._item.get('file')))
|
||||
|
||||
@property
|
||||
def media_series_title(self):
|
||||
"""Title of series of current playing media, TV show only."""
|
||||
return self._item.get('showtitle')
|
||||
|
||||
@property
|
||||
def media_season(self):
|
||||
"""Season of current playing media, TV show only."""
|
||||
return self._item.get('season')
|
||||
|
||||
@property
|
||||
def media_episode(self):
|
||||
"""Episode of current playing media, TV show only."""
|
||||
return self._item.get('episode')
|
||||
|
||||
@property
|
||||
def media_album_name(self):
|
||||
"""Album name of current playing media, music track only."""
|
||||
return self._item.get('album')
|
||||
|
||||
@property
|
||||
def media_artist(self):
|
||||
"""Artist of current playing media, music track only."""
|
||||
artists = self._item.get('artist', [])
|
||||
if len(artists) > 0:
|
||||
return artists[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def media_album_artist(self):
|
||||
"""Album artist of current playing media, music track only."""
|
||||
artists = self._item.get('albumartist', [])
|
||||
if len(artists) > 0:
|
||||
return artists[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag media player features that are supported."""
|
||||
|
|
Loading…
Add table
Reference in a new issue