Solved Get DB lookup info (DBID, DBTYPE) from Python ListItem
#1
The new context menu item add-ons in Isengard pass along the selected item as sys.listitem, and I would like to get DBID and DBTYPE from it, so that I can look up the selected item via JSON-RPC or pass it along to another script.

xbmc.getInfoLabel('ListItem.XX') isn't always accurate (details and test add-on, 3rd post), and the docs do say to use sys.listitem, so I think these should be available from the Python ListItem.

Solution: Kodi 18 Leia added getDbId() and getMediaType() to InfoTagVideo, so this info is now available via sys.listitem.getVideoInfoTag().getDbId() and sys.listitem.getVideoInfoTag().getMediaType(). Huzzah!
Reply
#2
Hello.

It seems I cannot use getDbId, can't figure out why...

I've noticed this has been introduced in v17. I'm using Kodi 17.6.

I'm trying to get the id of the song currently playing. I do the following:
infoTag=xbmc.Player().getMusicInfoTag()
xbmc.log(infoTag.getDbId()) #error

If I do ' '.join(dir(infoTag)

i get:
__class__ __delattr__ __doc__ __format__ __getattribute__ __hash__ __init__ __new__ __reduce__ __reduce_ex__ __repr__ __setattr__ __sizeof__ __str__ __subclasshook__ getAlbum getAlbumArtist getArtist getComment getDisc getDuration getGenre getLastPlayed getListeners getLyrics getPlayCount getRating getReleaseDate getTitle getTrack getURL getUserRating

Any hints on this?

Bye and thanks, Luís
Reply
#3
i've double-checked and it turns out our docs are wrong (my bad).
this feature wasn't added in v17, but in v18.

i tested your code above and it does work fine in kodi leia.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#4
So the bug is in the docs...

Will you handle this issue, or shall I raise it to someone else?

Bye, Luís
Reply
#5
yup, i'll fix the docs.
https://github.com/xbmc/xbmc/pull/15264
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
Get DB lookup info (DBID, DBTYPE) from Python ListItem0