addDirectoryItem - how to show content of a network folder? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: addDirectoryItem - how to show content of a network folder? (/showthread.php?tid=82642) |
addDirectoryItem - how to show content of a network folder? - zakmes - 2010-10-06 Hello, assuming i use the following code: Code: def addDir(name,url,iconimage): Code: addDir('The Matrix', 'smb://192.168.0.1/Movies/IMDB top 30/30 - The Matrix/', '') it adds the folder, but when i open it, it is empty.. how can i show within this created folder the content of the folder of the network path? thanks in advance, zakmes - ppic - 2010-10-06 what the goal ? you're confusing virtual and real directory structure. - zakmes - 2010-10-06 well, the goal is to parse xml from a local network share search engine and list the results. i have everything working, except this. what i want is: create a virtual folder ('The Matrix') which links to the real folder ('smb://192.168.0.1/Movies/IMDB top 30/30 - The Matrix/'). i also would like to browse this folder then, if it has subfolders and list all the files in this folder + any subfolders. like i am used to it from the normal video component of xbmc, where i also can add some smb shares and browse them. - ppic - 2010-10-06 so you have to define a path see os.path, you should have all you need there. - zakmes - 2010-10-06 ok, thanks for your hint. i used this code, but unfortunately it does not work with samba shares: Quote:15:41:31 T:4488 M:1013493760 NOTICE: folderContents = os.listdir(path) well, i found this: http://forum.xbmc.org/showthread.php?tid=20310 but an code snippet would help a lot.. 2006 is 4 yrs ago, is there anything new accessing samba shares from python? last question for comprehension: is the url parameter of the addDirectoryItem function used for the virtual file system? - ppic - 2010-10-06 you have access to it via xbmc vfs, strange for your problem, but can you try this: Code: os.listdir(path.strip("u'")) - zakmes - 2010-10-06 mh, the error does not change that much: Quote:17:15:25 T:6900 M:1077940224 NOTICE: folderContents = os.listdir(path.strip("u'")) anyway: i think i can solve it using httpapi, but my main problem stays: i want to add a file as a link and play it by clicking on it, how? - ppic - 2010-10-06 ho my bad !!! can you try without "*.*" in your path? step by step please, let's resolve that then see the rest - zakmes - 2010-10-06 well, the thing is that i my path string does not contain "*.*", i think it is added by the os.listdir function... i solved that with httpapi: Code: response = xbmc.executehttpapi("GetDirectory(" + path + ")") and now, i can browse through all network directories, so that works.. now i just want the file to be played when i click on it and i am done - ppic - 2010-10-06 for that, if you want to have some stuff and information on what you wanna play, you need to pass a listitem to xbmc.Player().play (or something around that) playableVideoItem = xbmcgui.ListItem( name , path = trailer) xbmc.Player().play(trailer, playableVideoItem, False) this will only show name when pressing "i" when playing the video. see the xbmc python documentation for more informations. - zakmes - 2010-10-06 okay, but how do i get the player to play the item, as soon as i click on it? - ppic - 2010-10-06 change "isFolder=True" to "isFolder=False" - zakmes - 2010-10-07 thanks. when i run this on the xbox (newest xbmc4xbox build from today) i get the following error: Code: 10:01:13 M: 30380032 ERROR: programdatabase: error finding active trainer for 0 (select * from trainers where idTitle=0 and Active=1) any idea? - spiff - 2010-10-07 you're trying to run it as a program plugin. the program window can only handle... programs. it's a video plugin. - zakmes - 2010-10-07 and that does the trick, not it works! thanks! |