View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#171
Originally Posted by daperl View Post
@marxian

Search results were very poor until I made the following changes:

Code:
-- cutetubewindows.py.orig	2010-11-22 22:51:33.000000000 -0800
+++ cutetubewindows.py	2010-11-22 22:52:20.000000000 -0800
@@ -477,10 +477,10 @@
         self.show() 
         searchTerms = self.searchString.replace(" ", "+")
         if username == None:
-            self.videoFeed = "http://gdata.youtube.com/feeds/api/videos?vq=<%22" + searchTerms + "%22>&orderby=" + searchOrder
+            self.videoFeed = "http://gdata.youtube.com/feeds/api/videos?vq=" + searchTerms + "&orderby=" + searchOrder
             self.actionSearch.setVisible(True)
         else:
-            self.videoFeed = "http://gdata.youtube.com/feeds/api/videos?author=" + username + "&vq=<%22" + searchTerms + "%22>&orderby=" + searchOrder
+            self.videoFeed = "http://gdata.youtube.com/feeds/api/videos?author=" + username + "&vq=" + searchTerms + "&orderby=" + searchOrder
 	print 'videoFeed',self.videoFeed
         self.yt = youtubeservice.YouTubeVideoFeed(self, self.videoFeed)
         self.connect(self.yt, SIGNAL("dataLoaded(PyQt_PyObject)"), self.addVideo)
Now search is poppin'!

You rock!
Of course! I left the '<' and '>' characters in the search terms. Doh. I'll change it. It also means I can use string formatting rather than concatenation.

As for the random crashing. It is stable when using
Code:
run-standalone.sh /opt/cutetube/cutetube.py
but crashes randomly when executing via the .desktop file.
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub

Last edited by marxian; 2010-11-23 at 12:15.