- fix hd stream detection after recent Youtube changes.
authorMladen Horvat <acid-burn@opendreambox.org>
Thu, 19 Nov 2009 22:12:56 +0000 (22:12 +0000)
committerMladen Horvat <acid-burn@opendreambox.org>
Thu, 19 Nov 2009 22:12:56 +0000 (22:12 +0000)
- increase search history to 30 entries and add the last search as first history entry and not reversed as it was before. This should be more intuitive. Thx Helge Böhme.

mytube/src/MyTubeService.py
mytube/src/plugin.py

index 3c99690..6bac303 100755 (executable)
@@ -13,7 +13,6 @@ from twisted.internet import reactor
 from urllib2 import Request, URLError, HTTPError, urlopen as urlopen2
 from socket import gaierror,error
 import re, os, sys, socket
 from urllib2 import Request, URLError, HTTPError, urlopen as urlopen2
 from socket import gaierror,error
 import re, os, sys, socket
-#import urllib
 from urllib import quote, unquote_plus, unquote   #FancyURLopener,
 import cookielib
 from httplib import HTTPConnection,CannotSendRequest,BadStatusLine,HTTPException
 from urllib import quote, unquote_plus, unquote   #FancyURLopener,
 import cookielib
 from httplib import HTTPConnection,CannotSendRequest,BadStatusLine,HTTPException
@@ -196,7 +195,7 @@ class MyTubeFeedEntry():
                        print "[MyTube] No valid mp4-url found"
                        return mrl
 
                        print "[MyTube] No valid mp4-url found"
                        return mrl
 
-               if "isHDAvailable = true" in watchvideopage:
+               if "'IS_HD_AVAILABLE': true" in watchvideopage:
                        isHDAvailable = True
                        print "HD AVAILABLE"
                else:
                        isHDAvailable = True
                        print "HD AVAILABLE"
                else:
index 9ccb46b..f49486d 100755 (executable)
@@ -891,10 +891,10 @@ class MyTubePlayerMainScreen(Screen, ConfigListScreen):
                if self.History[0] == '':
                        del self.History[0]
                print "self.History im add",self.History
                if self.History[0] == '':
                        del self.History[0]
                print "self.History im add",self.History
-               if config.plugins.mytube.search.searchTerm.value not in self.History:
-                       self.History.append((config.plugins.mytube.search.searchTerm.value))
-               self.History.reverse()
-               if len(self.History) == 15:
+               if config.plugins.mytube.search.searchTerm.value in self.History:
+                       self.History.remove((config.plugins.mytube.search.searchTerm.value))
+               self.History.insert(0,(config.plugins.mytube.search.searchTerm.value))
+               if len(self.History) == 30:
                        self.History.pop()
                config.plugins.mytube.general.history.value = ",".join(self.History)
                config.plugins.mytube.general.history.save()
                        self.History.pop()
                config.plugins.mytube.general.history.value = ",".join(self.History)
                config.plugins.mytube.general.history.save()