2015-09-05, 20:18
I am trying to use the tutorial to create an add on that has live and archived sporting events using rtmp links that I have mined.
My problem is that the tutorial explains a method of making multiple folders, but following that method puts the same file in both folder.
The above example puts the live rtmp stream in both the "live" and "archived" folders. I'm trying to understand how to place some files in the "live action" folder and others in the "archived action" folder. For instance, the link above would go in the "live action" folder and rtmp://o1.stretchinternet.com:1935/ondemand/mp4:cnu/cnu-214573-v.mp4 and rtmp://o1.stretchinternet.com:1935/ondemand/mp4tevenson/stevenson-216769-v.mp4 would go in the "archived action" folder.
I realize that this is probably very basic, but please indulge me if you would be so kind.
My problem is that the tutorial explains a method of making multiple folders, but following that method puts the same file in both folder.
Code:
import sys
import urllib
import urlparse
import xbmcgui
import xbmcplugin
base_url = sys.argv[0]
addon_handle = int(sys.argv[1])
args = urlparse.parse_qs(sys.argv[2][1:])
xbmcplugin.setContent(addon_handle, 'movies')
def build_url(query):
return base_url + '?' + urllib.urlencode(query)
mode = args.get('mode', None)
if mode is None:
url = build_url({'mode': 'folder', 'foldername': 'Folder One'})
li = xbmcgui.ListItem('Live Action', iconImage='http://www.garnishmusicproduction.com/wp-content/uploads/2010/09/Live-Stream.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)
url = build_url({'mode': 'folder', 'foldername': 'Folder Two'})
li = xbmcgui.ListItem('Archived Action', iconImage='http://www.iconeasy.com/icon/png/File%20Type/Pull%20Tab%20Archives/archive.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)
xbmcplugin.endOfDirectory(addon_handle)
elif mode[0] == 'folder':
foldername = args['foldername'][0]
url = 'rtmp://23.108.15.5:1935/flash1/salisburyvideo'
li = xbmcgui.ListItem('Salisbury v. Merchent Marine Mens Soccer', iconImage='http://alumni.salisbury.edu/resource/resmgr/images/sammy_logo.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
The above example puts the live rtmp stream in both the "live" and "archived" folders. I'm trying to understand how to place some files in the "live action" folder and others in the "archived action" folder. For instance, the link above would go in the "live action" folder and rtmp://o1.stretchinternet.com:1935/ondemand/mp4:cnu/cnu-214573-v.mp4 and rtmp://o1.stretchinternet.com:1935/ondemand/mp4tevenson/stevenson-216769-v.mp4 would go in the "archived action" folder.
I realize that this is probably very basic, but please indulge me if you would be so kind.