Posts: 9
Joined: Mar 2013
Reputation:
0
I've search google and this forum for the answer, but found nothing. I apologize in advance if this question has already been answered.
I'm learning python, and am trying to create some add-ons for xbmc. In my settings, there is an option to set the HDHomeRun UPnP folder, which is working correctly. I can successfully get the upnp://[address] from the settings and it returns the correct value.
The question I have is:
how do you retrieve the list of files/streams w/in this folder?
Calling the following method, shown below, brings up the list of streams I want in a dialog, so I'm sure there has to be a way to retrieve this data in python.
xbmcgui.Dialog().browse(1, '', 'video', '.strm')
Thanks in advance,
Gunjan
Posts: 9
Joined: Mar 2013
Reputation:
0
I tried that already. I wasn't calling it right, so I was hoping that was the reason why it wasn't working. I was only doing the files = xbmcvfs.listdir(path) not "folders, files = ..."
I'll post the code and log for my hello world add-on.
Code:
# Get the HD Homerun UPnP address
url = utils.getSetting('hdhomerun_folder')
utils.log("URL: " + url)
# Parse the files in the hdhomerun folder
folders, files = xbmcvfs.listdir(url)
if files is not None:
utils.log("Parsing the files. Total found: ", len(files))
for file in files:
utils.log(file)
# Ensure it ends w/ 'Cable TV'
if(not url.endswith("Cable TV/")):
url += "Cable TV/"
utils.log("URL Updated: " + url)
# Parse the files in the hdhomerun folder
folders, files = xbmcvfs.listdir(url)
if files is not None:
utils.log("Parsing the files. Total found: ", len(files))
for file in files:
utils.log(file)
Log:
20:25:46 T:860 NOTICE: service.tvguide.hdhomerun: Hello World!!!
20:25:46 T:860 NOTICE: service.tvguide.hdhomerun: URL: upnp://938319DE-1113-38E4-8D72-B0AFFAED2C92/
20:25:51 T:860 ERROR: XFILE::CDirectory::GetDirectory - Error getting upnp://938319DE-1113-38E4-8D72-B0AFFAED2C92/
20:25:51 T:860 NOTICE: service.tvguide.hdhomerun: URL Updated: upnp://938319DE-1113-38E4-8D72-B0AFFAED2C92/Cable TV/
20:25:51 T:860 ERROR: XFILE::CDirectory::GetDirectory - Error getting upnp://938319DE-1113-38E4-8D72-B0AFFAED2C92/Cable TV/
Posts: 9
Joined: Mar 2013
Reputation:
0
2013-03-16, 17:00
(This post was last modified: 2013-03-17, 00:59 by djgonzo81.)
Submitted a push request to allow the xbmcvfs.listdir([url]) method to return upnp://[address] files. I hope it gets pushed through.
Posts: 173
Joined: Jan 2012
Reputation:
12
It would also be nice to have that functionality in other parts of the module. Maybe if it is merged you could also add that? At the moment I don't need it, but there will eventually be people that want to, especially since Gotham focuses largely on UPnP playback.