Skip to content

Commit

Permalink
only update art if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
sualfred committed Jan 25, 2020
1 parent 10ed6a4 commit 7fbb05c
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions resources/lib/player_monitor.py
Expand Up @@ -254,36 +254,47 @@ def get_songartworks(self):
art = {}
try:
songdetails = json_call('AudioLibrary.GetSongDetails',
properties=['art', 'albumid'],
params={'songid': int(xbmc.getInfoLabel('MusicPlayer.DBID'))},
)
properties=['art', 'albumid'],
params={'songid': int(xbmc.getInfoLabel('MusicPlayer.DBID'))},
)

songdetails = songdetails['result']['songdetails']
art['fanart'] = songdetails['art'].get('fanart', '')
art['thumb'] = songdetails['art'].get('thumb', '')
art['clearlogo'] = songdetails['art'].get('clearlogo') or songdetails['art'].get('logo')
fanart = songdetails['art'].get('fanart')
thumb = songdetails['art'].get('thumb')
clearlogo = songdetails['art'].get('clearlogo') or songdetails['art'].get('logo')

This comment has been minimized.

Copy link
@DaveTBlake

DaveTBlake Jan 25, 2020

@sualfred have you consdered being more generic with art types rather than fixed to fanart, thumb and clearlogo types? Art types are no longer hard coded in core. I mean just loop through all the types returned in the "art" property. Only a thought :)

This comment has been minimized.

Copy link
@sualfred

sualfred Jan 25, 2020

Author Owner

good point. will change that.

This comment has been minimized.

Copy link
@sualfred

sualfred Jan 25, 2020

Author Owner

@DaveTBlake
It seems that you have fixed it in Leia somewhere in the past and I don't need this at all ^^ Added this function back in the Krypton days.

This comment has been minimized.

Copy link
@DaveTBlake

DaveTBlake Jan 25, 2020

Quite possible :)
I really don't know what your script is doing or why, just noticed the hard coded art types.

This comment has been minimized.

Copy link
@sualfred

sualfred Jan 25, 2020

Author Owner

Back in Krypton artworks were not filled correctly. Discart, logo, thumbnail were missing if playback has been started from a widget.


if not xbmc.getInfoLabel('Player.Art(fanart)') and fanart:
art['fanart'] = fanart
if not xbmc.getInfoLabel('Player.Art(thumb)') and thumb:
art['thumb'] = thumb
if not xbmc.getInfoLabel('Player.Art(clearlogo)') and clearlogo:
art['clearlogo'] = clearlogo

except Exception:
return

try:
albumdetails = json_call('AudioLibrary.GetAlbumDetails',
properties=['art'],
params={'albumid': int(songdetails['albumid'])},
)
properties=['art'],
params={'albumid': int(songdetails['albumid'])},
)

albumdetails = albumdetails['result']['albumdetails']
discart = albumdetails['art'].get('discart') or albumdetails['art'].get('logo')
art['discart'] = discart
art['album.discart'] = discart

if not xbmc.getInfoLabel('Player.Art(discart)') and discart:
art['discart'] = discart
if not xbmc.getInfoLabel('Player.Art(album.discart)') and discart:
art['album.discart'] = discart

except Exception:
pass

item = xbmcgui.ListItem()
item.setPath(PLAYER.getPlayingFile())
item.setArt(art)
PLAYER.updateInfoTag(item)
if art:
item = xbmcgui.ListItem()
item.setPath(PLAYER.getPlayingFile())
item.setArt(art)
PLAYER.updateInfoTag(item)


def get_art_info(self,clear=False):
Expand Down

0 comments on commit 7fbb05c

Please sign in to comment.