v20 listitem.setInfo('video', {'path': }) vs setPath(path='') vs setProper('path', )
#2
(2021-04-16, 09:59)jiamengnan Wrote: I want set the listitem path to realpath for get videoinfo in skin, 
I use the following 3 set functions, but got plugin://plugin.name by $INFO[Listitem,Path] in skin,
what's the diff?
listitem.setInfo(''video', {'path': curr_dir})
listitem.setPath(path=fullpathname)
listitem.setProperty('Path', curr_dir)
How set path or how get realpath like /home/kodi/abc.mp4 in MyVideo.xml?
Try this for Kodi 18 and below:

path = os.path.join(xbmc.translatePath("special://abc.mp4"))

For Kodi 19:

path = os.path.join(xbmcvfs.translatePath("special://abc.mp4"))

special:// gets you to Kodi's root path.  Add to it to get further into the file system.  Here's some documentation which may help.

This approach works across operating systems which support Kodi.. 


If you are wanting to stay within your addon path another option is:

addon = xbmcaddon.Addon()

path=addon.getAddonInfo("path") + '/resources/media/abc.mp4'


or better yet to your question of using InfoLabels, here's a sample of what each looks like.  I did some quick instrumentation on my addon whicih pulls content from a uPNP server so you can see the differences:

xbmc.getInfoLabel("ListItem.FileNameAndPath") = plugin://plugin.video.mezzmo/?contentdirectory=http%3a%2f%2f192.168.0.34%3a53168%2fContentDirectory%2fcontrol&mode=server&objectID=taz1l0z1l13&parentID=0

xbmc.getInfoLabel("ListItem.Path") = plugin://plugin.video.mezzmo/

xbmc.getInfoLabel("ListItem.FolderPath") = plugin://plugin.video.mezzmo/?contentdirectory=http%3a%2f%2f192.168.0.34%3a53168%2fContentDirectory%2fcontrol&mode=server&objectID=taz1l0z1l13&parentID=0


xbmc.getInfoLabel("ListItem.Path")  gives the same result as  addon.getAddonInfo("path"), the root of your addon.



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


Messages In This Thread
RE: listitem.setInfo('video', {'path': }) vs setPath(path='') vs setProper('path', ) - by jbinkley60 - 2021-04-16, 11:13
Logout Mark Read Team Forum Stats Members Help
listitem.setInfo('video', {'path': }) vs setPath(path='') vs setProper('path', )0