Modificato il sistema di calcolo dell'url di streaming

Leonardo Robol [2009-11-08 13:04]
Modificato il sistema di calcolo dell'url di streaming
Filename
RaiTV/ChannelLoader.py
RaiTV/VideoWidget.py
diff --git a/RaiTV/ChannelLoader.py b/RaiTV/ChannelLoader.py
index e224386..c4fffb7 100644
--- a/RaiTV/ChannelLoader.py
+++ b/RaiTV/ChannelLoader.py
@@ -91,7 +91,20 @@ class ChannelList():

         r = urllib2.urlopen(req)
         mms = r.read()
+        print mms
         mms = re.search(r"HREF=\"(\S*)\"", mms).group(1)
+
+        ## Provo a vedere se la rai mi ha rifilato un http, spacciandolo
+        ## per un mms. Chissà perché poi... -.-
+        u = re.sub(r"mms://", "http://", mms)
+        req = urllib2.Request(u, None, {'User-Agent': self.UA})
+
+        r = urllib2.urlopen(req)
+        reference = re.findall(r"http://(\S*)", r.read(1024))
+        if reference is not []:
+            ## Se è così ci serve mms over http
+            mms = "mmsh://" + reference[0]
+
         print "mms url // " + mms
         return mms

diff --git a/RaiTV/VideoWidget.py b/RaiTV/VideoWidget.py
index de26db3..58dcb41 100644
--- a/RaiTV/VideoWidget.py
+++ b/RaiTV/VideoWidget.py
@@ -107,8 +107,6 @@ class VideoWidget(gtk.DrawingArea):
         ## Ci permettiamo di disegnare sopra il filmato
         ## se e solo se non c'è un filmato che sta andando! :)

-        print self.playing
-
         if not self.playing:
             cr = self.window.cairo_create()
             ## Non facciamo lavoro extra e coloriamo solo ciò
@@ -186,8 +184,9 @@ class VideoWidget(gtk.DrawingArea):

     def repaint(self):

-        width, height = self.window.get_size()
-        self.queue_draw_area(0,0,width,height)
+        if self.window is not None:
+            width, height = self.window.get_size()
+            self.queue_draw_area(0,0,width,height)


ViewGit