totem r5784 - in trunk: . src/plugins/youtube



Author: pwithnall
Date: Sat Oct 25 14:52:09 2008
New Revision: 5784
URL: http://svn.gnome.org/viewvc/totem?rev=5784&view=rev

Log:
2008-10-25  Philip Withnall  <philip tecnocode co uk>

	* src/plugins/youtube/youtube.py: Patch from Matthew Adams
	<roguestar191 comcast net> to use read() instead of readline() 
when
	searching for the t-param in YouTube searches, in order to 
reduce the
	number of regexp searches.



Modified:
   trunk/ChangeLog
   trunk/src/plugins/youtube/youtube.py

Modified: trunk/src/plugins/youtube/youtube.py
==============================================================================
--- trunk/src/plugins/youtube/youtube.py	(original)
+++ trunk/src/plugins/youtube/youtube.py	Sat Oct 25 14:52:09 2008
@@ -207,21 +207,19 @@
 		regexp1 = re.compile ("swfArgs.*\"t\": \"([^\"]+)\"")
 		regexp2 = re.compile ("</head>")
 
-		line = stream.readline ()
-		while (line != ""):
+		contents = stream.read ()
+		if contents != "":
 			"""Check for the t parameter, which is now in a JavaScript array on the video page"""
-			matches = regexp1.search (line)
+			matches = regexp1.search (contents)
 			if (matches != None):
 				stream.close ()
 				return matches.group (1)
 
 			"""Check to see if we've come to the end of the <head> tag; in which case, we should give up"""
-			if (regexp2.search (line) != None):
+			if (regexp2.search (contents) != None):
 				stream.close ()
 				return ""
 
-			line = stream.readline ()
-
 		stream.close ()
 		return ""
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]