2015-11-20, 15:08
Hi all,
In my quest to get Kodi to do what I want, I have now seen myself forced to enter into service script territory.
But it seems I need help with my workaround, as things are perhaps not what they appear to be?
getMusicInfoTag often returns information from the last played song - I would think it should return info from the song about to play.
Anyways, How would I make sure I get the information from the song (about to) play?
With the code posted, the window properties I set with info from the getMusicInfoTag are really often filled with info from the previous played track!
SOLUTION: Added xbmc.sleep(200) to the code.
(WINDOW is set to the home window)
16.0-BETA2 Git:20151115-07f691e
In my quest to get Kodi to do what I want, I have now seen myself forced to enter into service script territory.
But it seems I need help with my workaround, as things are perhaps not what they appear to be?
getMusicInfoTag often returns information from the last played song - I would think it should return info from the song about to play.
Anyways, How would I make sure I get the information from the song (about to) play?
With the code posted, the window properties I set with info from the getMusicInfoTag are really often filled with info from the previous played track!
Code:
# MEDIA PLAYER INTERCEPTOR
class PlayerEvents(xbmc.Player) :
def onPlayBackStarted(self):
xbmc.sleep(200) #<!-- The workaround solution..
MUSICINFOTAG = xbmc.Player().getMusicInfoTag()
TIT = MUSICINFOTAG.getTitle()
GEN = MUSICINFOTAG.getGenre()
WINDOW.setProperty( 'mediaPlayerCurrentTitle', TIT)
WINDOW.setProperty( 'mediaPlayerCurrentCover', GEN)
SOLUTION: Added xbmc.sleep(200) to the code.
(WINDOW is set to the home window)
16.0-BETA2 Git:20151115-07f691e