Commit c4bc7305 authored by Philip Withnall's avatar Philip Withnall Committed by Philip Withnall

Resolve the video URI of YouTube videos when loading search results,

2008-07-09  Philip Withnall  <philip@tecnocode.co.uk>

	* src/plugins/youtube/youtube.py: Resolve the video URI of 
YouTube
	videos when loading search results, rather than when playing 
them
	to ensure URIs added to the playlist are correct. (Closes: 
#541916)


svn path=/trunk/; revision=5501
parent 9b339cc5
2008-07-09 Philip Withnall <philip@tecnocode.co.uk>
* src/plugins/youtube/youtube.py: Resolve the video URI of YouTube
videos when loading search results, rather than when playing them
to ensure URIs added to the playlist are correct. (Closes: #541916)
2008-06-27 Bastien Nocera <hadess@hadess.net>
* src/backend/bacon-video-widget.h: Kill bacon_video_widget_can_play
......
......@@ -25,7 +25,7 @@ class DownloadThread (threading.Thread):
class YouTube (totem.Plugin):
def __init__ (self):
totem.Plugin.__init__(self)
totem.Plugin.__init__ (self)
self.debug = False
self.gstreamer_plugins_present = True
......@@ -90,7 +90,7 @@ class YouTube (totem.Plugin):
totem_object.add_sidebar_page ("youtube", _("YouTube"), self.vbox)
"""Set up the service"""
self.service = gdata.service.GDataService (None, None, "HOSTED_OR_GOOGLE", None, None, "gdata.youtube.com")
self.service = gdata.service.GDataService (account_type = "HOSTED_OR_GOOGLE", server = "gdata.youtube.com")
def deactivate (self, totem):
totem.remove_sidebar_page ("youtube")
def setup_treeview (self, treeview_name):
......@@ -174,28 +174,6 @@ class YouTube (totem.Plugin):
self.totem.get_main_window ())
return False
model, rows = treeview.get_selection ().get_selected_rows ()
iter = model.get_iter (rows[0])
youtube_id = model.get_value (iter, 3)
"""Get the video stream MRL"""
location = self.check_url_for_redirects ("/v/" + urllib.quote (youtube_id))
if location != False:
mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + urllib.quote (re.match (".*[?&]t=([^&]+)", location).groups ()[0]) + self.get_fmt_string ()
"""location_check = self.check_url_for_redirects (mrl)
if location_check != False:
mrl = location_check
else:
mrl = "http://www.youtube.com" + mrl"""
else:
"""Leave it as taken from the GData feed"""
mrl = False
if mrl != False:
model.set_value (iter, 2, mrl)
return True
def on_open_in_web_browser_activated (self, action):
model, rows = self.treeview[self.current_treeview_name].get_selection ().get_selected_rows ()
......@@ -282,6 +260,18 @@ class YouTube (totem.Plugin):
"""Don't leak the temporary file"""
os.unlink (filename)
"""Get the video stream MRL"""
location = self.check_url_for_redirects ("/v/" + urllib.quote (youtube_id))
if location != False:
mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + urllib.quote (re.match (".*[?&]t=([^&]+)", location).groups ()[0]) + self.get_fmt_string ()
"""location_check = self.check_url_for_redirects (mrl)
if location_check != False:
mrl = location_check
else:
mrl = "http://www.youtube.com" + mrl"""
self.liststore[treeview_name].append ([pixbuf, entry.title.text, mrl, youtube_id])
return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment