For what it is worth, I'm kind of trying to do something similar -- calling on m3u file lists from folders. Except I have two folders and am listing the m3us in each folder. Here is what I'm using and it appears to be working:
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_one', 'foldername': 'Live Action'})
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_two', 'foldername': 'Archived Action'})
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_one':
foldername = args['foldername'][0]
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/lax_sports.m3u'
li = xbmcgui.ListItem('Live College Sports Streams', iconImage='http://ih.constantcontact.com/fs135/1011240049692/img/926.jpg?a=1115274511239')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
foldername = args['foldername'][0]
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/Patriot_League_Live.m3u'
li = xbmcgui.ListItem('Live Patriot League Action', iconImage='https://lh5.ggpht.com/7C7IfdBbqag-jLDjF5fSkDG_Hhbq4IrRpMBoj5kVSgieUgd0B3FbiGv7pwedOPn5o5w=w170')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
elif mode[0] == 'folder_two':
foldername = args['foldername'][0]
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/BostonU.m3u'
li = xbmcgui.ListItem('Boston University NCAA Lacrosse', iconImage='http://img.new.livestream.com/events/0000000000396bc3/1d155b31-cfa4-4126-b1e8-8ad0da16ba7a_170x255.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/Bucknell.m3u'
li = xbmcgui.ListItem('Bucknell NCAA Lacrosse', iconImage='http://img.new.livestream.com/events/0000000000396baf/17ad425c-2a3b-45f2-bede-67068b3e4df7_170x255.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/Colgate.m3u'
li = xbmcgui.ListItem('Colgate NCAA Lacrosse', iconImage='http://img.new.livestream.com/events/0000000000396bdf/d3399d5c-65cb-421b-9bee-33b25b5bcc99_170x255.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/Holy_Cross.m3u'
li = xbmcgui.ListItem('Holy Cross NCAA Lacrosse', iconImage='http://img.new.livestream.com/events/0000000000396ba1/283864cb-ca43-4dfe-95a0-859e0b3e5113_170x255.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/Lehigh.m3u'
li = xbmcgui.ListItem('Lehigh NCAA Lacrosse', iconImage='http://img.new.livestream.com/events/0000000000396c03/14d377bd-8d2a-4e37-aeed-6c83a4df4db6_170x255.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/Loyola.m3u'
li = xbmcgui.ListItem('Loyola NCAA Lacrosse', iconImage='http://img.new.livestream.com/events/0000000000396c32/4301279b-5fb4-40c0-b188-6e1995f91d2c_170x255.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
url = 'https://raw.githubusercontent.com/janus247/Lax-Bro-Entertainment/master/M3U%20files/Navy.m3u'
li = xbmcgui.ListItem('Navy NCAA Lacrosse', iconImage='http://img.new.livestream.com/events/0000000000396c1c/df6eef56-f9ea-4627-91dc-3e8b0986a9ad_170x255.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
Hope this helps. It's just an adaptation of the folder tutorial. I'm using the "raw" github hosted m3us as folder items.