v19 How to update audio stream info tags? Working for v20, not v19.
#1
This has been frustrating me for days. I'm writing a CBC Radio plugin and want to update the currently playing item since it is a stream and not individual tracks. I have not been able to figure this out on v19 however after updating my dev instance to v20, I fixed it in like 20 min. Since my main box is v19, I'd rather have this working for both versions.

The following is after the stream has started playing. I have no problem setting the initial info (i.e., what is currently playing when the stream starts), the problem is updating said info when the track changes, and only in v19.

This works (v20):

Code:
player = xbmc.Player()
play_item = player.getPlayingItem()
tag = play_item.getMusicInfoTag()
tag.setAlbum(album)
tag.setArtist(artist)
tag.setTitle(song)
tag.setComment(f"{show} with {host}")
player.updateInfoTag(play_item)

I cannot get this to work (v19):

Code:
player = xbmc.Player()
play_item = xbmcgui.ListItem()
play_item.setPath(player.getPlayingFile())
play_item.setInfo('music', {'album': album, 'artist': artist, 'title': song, 'comment': f"{show} with {host}"})
player.updateInfoTag(play_item)

I'm following the docs here: https://alwinesch.github.io/group__pytho...33afd6ff14
As well as several forum posts which all say basically the same thing.

What am I missing here?

Thanks.
Reply
#2
(2023-08-30, 14:51)ihemingway Wrote: I cannot get this to work (v19):
 
Code:
player = xbmc.Player()
play_item = xbmcgui.ListItem()
play_item.setPath(player.getPlayingFile())
play_item.setInfo('music', {'album': album, 'artist': artist, 'title': song, 'comment': f"{show} with {host}"})
player.updateInfoTag(play_item)
I'm following the docs here: https://alwinesch.github.io/group__pytho...33afd6ff14
As well as several forum posts which all say basically the same thing.

What am I missing here?

Thanks.

I'd try removing your comment from the Kodi 19 setInfo dictionary and see if it starts working.  If so I think your dictionary pair comment value may need to be formatted differently into a single string variable.  It's been a bit since I did this in Kodi 19 and in looking at my code I have for the comment variable I had to format it to get it to work (i.e. comment = "string1 " + str(var1) + " string2 " + str(var2)   etc...) .  My code is a bit kludgy but it works.



Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#3
(2023-08-31, 11:12)jbinkley60 Wrote:
(2023-08-30, 14:51)ihemingway Wrote: I cannot get this to work (v19):
 
Code:
player = xbmc.Player()
play_item = xbmcgui.ListItem()
play_item.setPath(player.getPlayingFile())
play_item.setInfo('music', {'album': album, 'artist': artist, 'title': song, 'comment': f"{show} with {host}"})
player.updateInfoTag(play_item)
I'm following the docs here: https://alwinesch.github.io/group__pytho...33afd6ff14 retro bowl
As well as several forum posts which all say basically the same thing.

What am I missing here?

Thanks.

I'd try removing your comment from the Kodi 19 setInfo dictionary and see if it starts working.  If so I think your dictionary pair comment value may need to be formatted differently into a single string variable.  It's been a bit since I did this in Kodi 19 and in looking at my code I have for the comment variable I had to format it to get it to work (i.e. comment = "string1 " + str(var1) + " string2 " + str(var2)   etc...) .  My code is a bit kludgy but it works.



Thanks,

Jeff

The code you provided for v20 looks correct, but for v19, there might be a difference in how the metadata is updated.

In Kodi v19, you might need to use a different approach to update the metadata of the currently playing item.
Reply
#4
(2023-08-30, 14:51)ihemingway Wrote: This has been frustrating me for days. I'm writing a CBC Radio plugin and want to update the currently playing item since it is a stream and not individual tracks. I have not been able to figure this out on v19 however after updating my dev instance to v20, I fixed it in like 20 min. Since my main box is v19, I'd rather have this working for both versions.

The following is after the stream has started playing. I have no problem setting the initial info (i.e., what is currently playing when the stream starts), the problem is updating said info when the track changes, and only in v19.

This works (v20):

Code:
player = xbmc.Player()
play_item = player.getPlayingItem()
tag = play_item.getMusicInfoTag()
tag.setAlbum(album)
tag.setArtist(artist)
tag.setTitle(song)
tag.setComment(f"{show} with {host}")
player.updateInfoTag(play_item)

I cannot get this to work (v19):

Code:
player = xbmc.Player()
play_item = xbmcgui.ListItem()
play_item.setPath(player.getPlayingFile())
play_item.setInfo('music', {'album': album, 'artist': artist, 'title': song, 'comment': f"{show} with {host}"})
player.updateInfoTag(play_item)

I'm following the docs here: https://alwinesch.github.io/group__pytho...33afd6ff14 retro bowl
As well as several forum posts which all say basically the same thing.

What am I missing here?

Thanks.

The code you provided for v20 looks correct, but for v19, there might be a difference in how the metadata is updated.

In Kodi v19, you might need to use a different approach to update the metadata of the currently playing item.
Reply

Logout Mark Read Team Forum Stats Members Help
How to update audio stream info tags? Working for v20, not v19.0