2010-09-01, 22:30
Hi
Please apply this patch to the IPlayer addon which allows the user to select the stream quality at playback time. It simply adds 4 'Play H.264 (XXXkb)' options to the context menu.
Cheers
Daniel
diff -ru plugin.video.iplayer.base/default.py plugin.video.iplayer/default.py
--- plugin.video.iplayer.base/default.py 2010-09-01 21:03:26.896706727 +0100
+++ plugin.video.iplayer/default.py 2010-09-01 21:25:19.756706868 +0100
@@ -146,13 +146,14 @@
label = args.get('label', [None])[0]
deletesearch = args.get('deletesearch', [None])[0]
radio = args.get('radio', [None])[0]
+ pref = args.get('pref', [None])[0]
feed = None
if feed_channel:
feed = iplayer.feed('auto', channel=feed_channel, atoz=feed_atoz, radio=radio)
elif feed_atoz:
feed = iplayer.feed(tvradio or 'auto', atoz=feed_atoz, radio=radio)
- return (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio)
+ return (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio, pref)
def list_feeds(feeds, tvradio='tv', radio=None):
xbmcplugin.addSortMethod(handle=PLUGIN_HANDLE, sortMethod=xbmcplugin.SORT_METHOD_TRACKNUM )
@@ -397,6 +398,21 @@
iconImage='defaultVideo.png',
thumbnailImage=thumbnail)
+ menuitems = []
+ cmd = "XBMC.RunPlugin(%s?&pid=%s&pref=%s)" % (sys.argv[0], urllib.quote_plus(programme.pid), urllib.quote_plus('h264 480'))
+ menuitems.append( ('Play H.264 (480kb)', cmd) )
+
+ cmd = "XBMC.RunPlugin(%s?&pid=%s&pref=%s)" % (sys.argv[0], urllib.quote_plus(programme.pid), urllib.quote_plus('h264 800'))
+ menuitems.append( ('Play H.264 (800kb)', cmd) )
+
+ cmd = "XBMC.RunPlugin(%s?&pid=%s&pref=%s)" % (sys.argv[0], urllib.quote_plus(programme.pid), urllib.quote_plus('h264 1500'))
+ menuitems.append( ('Play H.264 (1500kb)', cmd) )
+
+ cmd = "XBMC.RunPlugin(%s?&pid=%s&pref=%s)" % (sys.argv[0], urllib.quote_plus(programme.pid), urllib.quote_plus('h264 3200'))
+ menuitems.append( ('Play H.264 (3200kb)', cmd) )
+
+ listitem.addContextMenuItems( menuitems )
+
datestr = programme.updated[:10]
date=datestr[8:10] + '/' + datestr[5:7] + '/' +datestr[:4]#date ==dd/mm/yyyy
@@ -781,7 +797,7 @@
fw.close()
return outfile
-def watch(feed, pid, showDialog):
+def watch(feed, pid, pref, showDialog):
times = []
times.append(['start',time.clock()])
@@ -838,7 +854,8 @@
pDialog.update(50, 'Fetching video stream info')
if pDialog.iscanceled(): raise
times.append(['update dialog',time.clock()])
- pref = get_setting_videostream(channel)
+ if pref == None:
+ pref = get_setting_videostream(channel)
times.append(['get_setting_videostream',time.clock()])
opref = pref
if showDialog:
@@ -1100,8 +1117,8 @@
if addoncompat.get_setting('progcount') == 'false': progcount = False
# get current state parameters
- (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio) = read_url()
- logging.info( (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio) )
+ (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio, pref) = read_url()
+ logging.info( (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio, pref) )
# update feed category
if feed and category:
@@ -1111,7 +1128,7 @@
if pid:
showDialog = addoncompat.get_setting('displaydialog') == 'true'
if not label:
- watch(feed, pid, showDialog)
+ watch(feed, pid, pref, showDialog)
else:
pref = get_setting_videostream(label)
bitrate = pref.split(' ')[1]
Please apply this patch to the IPlayer addon which allows the user to select the stream quality at playback time. It simply adds 4 'Play H.264 (XXXkb)' options to the context menu.
Cheers
Daniel
diff -ru plugin.video.iplayer.base/default.py plugin.video.iplayer/default.py
--- plugin.video.iplayer.base/default.py 2010-09-01 21:03:26.896706727 +0100
+++ plugin.video.iplayer/default.py 2010-09-01 21:25:19.756706868 +0100
@@ -146,13 +146,14 @@
label = args.get('label', [None])[0]
deletesearch = args.get('deletesearch', [None])[0]
radio = args.get('radio', [None])[0]
+ pref = args.get('pref', [None])[0]
feed = None
if feed_channel:
feed = iplayer.feed('auto', channel=feed_channel, atoz=feed_atoz, radio=radio)
elif feed_atoz:
feed = iplayer.feed(tvradio or 'auto', atoz=feed_atoz, radio=radio)
- return (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio)
+ return (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio, pref)
def list_feeds(feeds, tvradio='tv', radio=None):
xbmcplugin.addSortMethod(handle=PLUGIN_HANDLE, sortMethod=xbmcplugin.SORT_METHOD_TRACKNUM )
@@ -397,6 +398,21 @@
iconImage='defaultVideo.png',
thumbnailImage=thumbnail)
+ menuitems = []
+ cmd = "XBMC.RunPlugin(%s?&pid=%s&pref=%s)" % (sys.argv[0], urllib.quote_plus(programme.pid), urllib.quote_plus('h264 480'))
+ menuitems.append( ('Play H.264 (480kb)', cmd) )
+
+ cmd = "XBMC.RunPlugin(%s?&pid=%s&pref=%s)" % (sys.argv[0], urllib.quote_plus(programme.pid), urllib.quote_plus('h264 800'))
+ menuitems.append( ('Play H.264 (800kb)', cmd) )
+
+ cmd = "XBMC.RunPlugin(%s?&pid=%s&pref=%s)" % (sys.argv[0], urllib.quote_plus(programme.pid), urllib.quote_plus('h264 1500'))
+ menuitems.append( ('Play H.264 (1500kb)', cmd) )
+
+ cmd = "XBMC.RunPlugin(%s?&pid=%s&pref=%s)" % (sys.argv[0], urllib.quote_plus(programme.pid), urllib.quote_plus('h264 3200'))
+ menuitems.append( ('Play H.264 (3200kb)', cmd) )
+
+ listitem.addContextMenuItems( menuitems )
+
datestr = programme.updated[:10]
date=datestr[8:10] + '/' + datestr[5:7] + '/' +datestr[:4]#date ==dd/mm/yyyy
@@ -781,7 +797,7 @@
fw.close()
return outfile
-def watch(feed, pid, showDialog):
+def watch(feed, pid, pref, showDialog):
times = []
times.append(['start',time.clock()])
@@ -838,7 +854,8 @@
pDialog.update(50, 'Fetching video stream info')
if pDialog.iscanceled(): raise
times.append(['update dialog',time.clock()])
- pref = get_setting_videostream(channel)
+ if pref == None:
+ pref = get_setting_videostream(channel)
times.append(['get_setting_videostream',time.clock()])
opref = pref
if showDialog:
@@ -1100,8 +1117,8 @@
if addoncompat.get_setting('progcount') == 'false': progcount = False
# get current state parameters
- (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio) = read_url()
- logging.info( (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio) )
+ (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio, pref) = read_url()
+ logging.info( (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio, pref) )
# update feed category
if feed and category:
@@ -1111,7 +1128,7 @@
if pid:
showDialog = addoncompat.get_setting('displaydialog') == 'true'
if not label:
- watch(feed, pid, showDialog)
+ watch(feed, pid, pref, showDialog)
else:
pref = get_setting_videostream(label)
bitrate = pref.split(' ')[1]