v20 listitem.setInfo('video', {'path': }) vs setPath(path='') vs setProper('path', )
#3
(2021-04-16, 11:13)jbinkley60 Wrote:
(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
I try xbmcvfs.translatePath("special://" + fullpathname), cant work. result as before.
==
I open video filelist in skin.estuary, has mediaflag  bottombar with video info. note: $INFO[Listitem.Path] = /home/jia  this time.
I want not change skin, just write plugin to list files for a special folder, /home/jia/  and subdirs and files in subdirs...
but it can't show mediaflag bottombar in my listitem page, I found $INFO[Listitem.Path] = plugin://plugin.my 
I think can't show mediaflag bottombar because the listitem var path is not equal the real path like /home/jia/subdirs, so I want to set listitem.path
If set listitem.path correctly, listitem show function will read file info for bottombar show, it works? [question 1]
Files path in Folder is special real path, /home/jia, has no relations with addon folder or plugin folder.

If this set oper can change the lsititem.path. which command work? setInfo, setPath, setProperty? [question 2]

jia
Reply


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