v20 "Please use the respective setter in InfoTagMusic." - But it doesn't work?
#1
I'm currently using Player.updateInfoTag() to update the song metadata and artwork in the player. Since v20, I'm seeing this message in the logs a lot:
Quote:Setting most music properties through ListItem.setInfo() is deprecated and might be removed in future Kodi versions. Please use the respective setter in InfoTagMusic.
According to the documentation, this should work (at least for the song metadata):
Quote:tag = xbmc.Player().getMusicInfoTag()
tag.setArtist('Foo')
tag.setTitle('Bar')
Unfortunately it doesn't. Did I miss something really obvious?
Reply
#2
(2023-03-11, 00:16)alxndr Wrote: I'm currently using Player.updateInfoTag() to update the song metadata and artwork in the player. Since v20, I'm seeing this message in the logs a lot:
Quote:Setting most music properties through ListItem.setInfo() is deprecated and might be removed in future Kodi versions. Please use the respective setter in InfoTagMusic.
According to the documentation, this should work (at least for the song metadata):
Quote:tag = xbmc.Player().getMusicInfoTag()
tag.setArtist('Foo')
tag.setTitle('Bar')
Unfortunately it doesn't. Did I miss something really obvious?

This thread should help.


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
Thanks, I did see that thread, but unfortunately it didn't contain any helpful information. It's also about InfoTagVideo, while I'm using InfoTagMusic, and maybe there are different issues in the implementation? Hence this thread.
Reply
#4
(2023-03-11, 14:38)alxndr Wrote: Thanks, I did see that thread, but unfortunately it didn't contain any helpful information. It's also about InfoTagVideo, while I'm using InfoTagMusic, and maybe there are different issues in the implementation? Hence this thread.

It's all part of the same, new setters were introduced in Nexus for videos, music and pictures. Artists and title have new setters, hence the delrecation messages. The old methods still work but only for so long. You can see an example of how I handled it here beginning on line 795.


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
#5
Thanks for the link! If I understand your code correctly, you are calling xbmcplugin.addDirectoryItem() after modifying i.e. a MusicInfoTag, which I guess adds or overwrites the metadata in a location that is relevant to your add-on.

I'm not trying to manage directory entries, though, I just need to update the metadata that is being displayed by the Player. This works perfectly fine right now by calling Player.updateInfoTag(). The error message seems to imply that I need to call Player.getMusicInfoTag(), which "Returns the MusicInfoTag of the current playing 'Song'" and use its setters, which doesn't seem to have any effect.

I wonder if this is a code or a documentation issue? If Kodi is going to remove Player.updateInfoTag() without providing a sufficient alternative, that's going to kill my add-on.
Reply
#6
(2023-03-12, 15:11)alxndr Wrote: Thanks for the link! If I understand your code correctly, you are calling xbmcplugin.addDirectoryItem() after modifying i.e. a MusicInfoTag, which I guess adds or overwrites the metadata in a location that is relevant to your add-on.

I'm not trying to manage directory entries, though, I just need to update the metadata that is being displayed by the Player. This works perfectly fine right now by calling Player.updateInfoTag(). The error message seems to imply that I need to call Player.getMusicInfoTag(), which "Returns the MusicInfoTag of the current playing 'Song'" and use its setters, which doesn't seem to have any effect.

I wonder if this is a code or a documentation issue? If Kodi is going to remove Player.updateInfoTag() without providing a sufficient alternative, that's going to kill my add-on.

Ok.  I understand now.  It is still the same issue but after what you posted I see I have a similar issue in my play trailer function.   I hadn't noticed it before.  My current code is:


python:
        lititle = "Trailer  #" + trselect + " - " + mtitle
        li = xbmcgui.ListItem(lititle)
        li.setInfo('video', {'Title': lititle})
        li.setArt({'thumb': icon, 'poster': icon})
        xbmc.Player().play(itemurl, li)

I'll play with it today and post an answer.


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
#7
(2023-03-12, 15:11)alxndr Wrote: Thanks for the link! If I understand your code correctly, you are calling xbmcplugin.addDirectoryItem() after modifying i.e. a MusicInfoTag, which I guess adds or overwrites the metadata in a location that is relevant to your add-on.

I'm not trying to manage directory entries, though, I just need to update the metadata that is being displayed by the Player. This works perfectly fine right now by calling Player.updateInfoTag(). The error message seems to imply that I need to call Player.getMusicInfoTag(), which "Returns the MusicInfoTag of the current playing 'Song'" and use its setters, which doesn't seem to have any effect.

I wonder if this is a code or a documentation issue? If Kodi is going to remove Player.updateInfoTag() without providing a sufficient alternative, that's going to kill my add-on.

Ok, here's how i have modified mine code and it works:

python:
        lititle = "Trailer  #" + trselect + " - " + mtitle
        li = xbmcgui.ListItem(lititle)
        if int(get_installedversion()) == 19:
            li.setInfo('video', {'Title': lititle})
        else:
            linfo = li.getVideoInfoTag()
            linfo.setTitle(lititle)
        li.setArt({'thumb': icon, 'poster': icon})
        xbmc.Player().play(itemurl, li)

If you are changing the title to something already playing then the two lines become:

python:

    linfo = xbmc.Player().getVideoInfoTag()
    linfo.setTitle(lititle)

In my case I set it ahead of calling the player.  So for you it would be:

python:
minfo = Player.getMusicInfoTag()
minfo.setTitle(yourTitleVariable)



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
#8
(2023-03-12, 16:45)jbinkley60 Wrote: In my case I set it ahead of calling the player.  So for you it would be:

python:
minfo = Player.getMusicInfoTag()
minfo.setTitle(yourTitleVariable)
That's pretty much what I tried (unsuccessfully) after reading the documentation. It eventually occurred to me that I might have misunderstood the setters to be a direct interface to the Player, so I tried this:
python:

            player = xbmc.Player()
            item = player.getPlayingItem()
            tag = item.getMusicInfoTag()
            tag.setArtist('Foo')
            tag.setTitle('Bar')
            player.updateInfoTag(item)
And that finally worked. So you basically replace the Item.setInfo('music', xyz) call with Item.getMusicInfoTag() and modifying that.

Thanks for your replies, they did push me in the right direction!
Reply
#9
(2023-03-13, 00:22)alxndr Wrote: That's pretty much what I tried (unsuccessfully) after reading the documentation. It eventually occurred to me that I might have misunderstood the setters to be a direct interface to the Player, so I tried this:
python:

            player = xbmc.Player()
            item = player.getPlayingItem()
            tag = item.getMusicInfoTag()
            tag.setArtist('Foo')
            tag.setTitle('Bar')
            player.updateInfoTag(item)
And that finally worked. So you basically replace the Item.setInfo('music', xyz) call with Item.getMusicInfoTag() and modifying that.

Thanks for your replies, they did push me in the right direction!

Great.  Glad you got it working and provided a solution.

Nice job,

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
#10
I'm having a similar issue, but with GameInfoTags, so I thought I'd ask here.

I previously could set info and a 'gameclient' (player) using this method:
python:

li = xbmcgui.ListItem(label='Test1 Label',label2='Test1 Label 2',offscreen=True)
info_dict = {'title':'Packman',
'platform':'Arcade',
'genres':['Platformer'],
'publisher':'Namco',
'overview':'This is just a test',
'year':2023,
'gameclient':'game.libretro.mame2003_plus'}
li.setInfo('game',info_dict)
xbmc.Player().play(item=game_path,listitem=li)
This would start playing the game with game.libretro.mame2003_plus.
xml:

RetroPlayer[PLAYER]: Opening: packman.zip

The equivalent in v20 would be:
python:

li = xbmcgui.ListItem(label='Test1 Label',label2='Test1 Label 2',offscreen=True)
gameinfo = li.getGameInfoTag()
gameinfo.setTitle('Packman')
gameinfo.setPlatform('Packman')
gameinfo.setGenres(['Platformer'])
gameinfo.setPublisher('Namco')
gameinfo.setOverview('This is just a test')
gameinfo.setYear(2023)
gameinfo.setGameClient('game.libretro.mame2003_plus')
xbmc.Player().play(item=game_path,listitem=li)

But the game doesn't play. The log shows:
xml:

CPlayerCoreFactory::GetPlayers(packman.zip)
VideoPlayer::OpenFile: packman.zip

And playing fails since its trying to open the game with the video player. It seems like the info isn't being set as i want it to. Is this a bug, or am i doing it wrong?
Reply
#11
(2023-03-23, 16:47)zachmorris Wrote: And playing fails since its trying to open the game with the video player. It seems like the info isn't being set as i want it to. Is this a bug, or am i doing it wrong?

I don't see anything obviously wrong.  The first block of code plays the game (although I don''t see an li.setInfo call in it) but the second block doesn't under Kodi 20 ?   If so, try commenting out lines 2-9 in the second block of code and see if it plays.  If so, uncomment them one at a time.  I doubt this is a setter issue but I've not done anything with GameInfoTags.  Does debug tell you anything ?


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
#12
(2023-03-23, 17:13)jbinkley60 Wrote: I don't see anything obviously wrong.  The first block of code plays the game (although I don''t see an li.setInfo call in it) but the second block doesn't under Kodi 20 ?   If so, try commenting out lines 2-9 in the second block of code and see if it plays.  If so, uncomment them one at a time.  I doubt this is a setter issue but I've not done anything with GameInfoTags.  Does debug tell you anything ?
Thanks,
Jeff

The first block of code does have a setInfo. The example is updated (bad brevity editing on my part).
Commenting the info out of the v20 version results in the same failure, which is what I feel like the issue is - that the info isn't being set to the listitem as I expect it to be.

I added for troubleshooting:
python:

print('Game client is {}'.format(gameinfo.getGameClient()))
And can see the setter is setting the game client. I can't query the playing item to see if the player sees the same info, since it never plays.

Edit: I see that the player class doesn't even have a getGameInfoTag method, which might be the issue.
Reply
#13
i wonder if it can be set with setproperty

would take 2 seconds to find out, li.setProperty('gameclient', 'game.libretro.mame2003_plus')
Reply
#14
No dice there either. SetProperty doesn't work.

I also notice that this doesn't work:
python:

xbmc.log(msg='zach_tester: Test started.', level=xbmc.LOGDEBUG)
gameinfo = li.getGameInfoTag()
gameinfo.setTitle('Packman')
gameinfo.setPlatform('Packman')
gameinfo.setGenres(['Platformer'])
gameinfo.setPublisher('Namco')
gameinfo.setOverview('This is just a test')
gameinfo.setYear(2023)
gameinfo.setGameClient('game.libretro.mame2003_plus')
xbmc.log(msg='zach_tester: Game client is {}'.format(gameinfo.getGameClient()), level=xbmc.LOGDEBUG)

#Try to get it again
gameinfo2 = li.getGameInfoTag()
xbmc.log(msg='zach_tester: Game client is {}'.format(gameinfo2.getGameClient()), level=xbmc.LOGDEBUG)
xbmc.log(msg='zach_tester: Test completed', level=xbmc.LOGDEBUG)

Results in:
xml:

zach_tester: Test started.
zach_tester: Game client is game.libretro.mame2003_plus
zach_tester: Game client is
zach_tester: Test completed

So it seems like i'm doing something wrong, but i dont know what it is.
Reply
#15
what i dont see is where type is being set

try....

gameinfo.setMediaType('game')

or something similar, since its trying to open game as 'video' it seems it does not know it's of type 'game'
Reply

Logout Mark Read Team Forum Stats Members Help
"Please use the respective setter in InfoTagMusic." - But it doesn't work?0