Author: duncan
Date: Thu Jan 10 15:16:05 2008
New Revision: 10277

Log:
[ 1868425 ] A patch to itv plugin for youtube video feeds
Patch from macxg applied


Modified:
   branches/rel-1-7/freevo/ChangeLog
   branches/rel-1-7/freevo/src/plugins/itv.py
   branches/rel-1-7/freevo/src/video/videoitem.py
   branches/rel-1/freevo/ChangeLog
   branches/rel-1/freevo/src/plugins/itv.py
   branches/rel-1/freevo/src/video/videoitem.py

Modified: branches/rel-1-7/freevo/ChangeLog
==============================================================================
--- branches/rel-1-7/freevo/ChangeLog   (original)
+++ branches/rel-1-7/freevo/ChangeLog   Thu Jan 10 15:16:05 2008
@@ -23,6 +23,7 @@
  * New Youtube video plug-in (F#1864496)
  * Updated cdbackup plug-in with CD_RIP_FMT to set the encoding format 
(F#1857460)
  * Updated encoding server to save the output to ENCODINGSERVER_SAVE_DIR when 
set (F#1865522)
+ * Updated itv plug-in for youtube video feeds (F#1868425)
  * Updated re-encode plug-in and encoding core with additional features 
(F#1868764)
  * Updated recordings manager plug-in to add thumbnail support (F#1857397)
  * Updated recordserver to default watched/keep status (F#1857395)

Modified: branches/rel-1-7/freevo/src/plugins/itv.py
==============================================================================
--- branches/rel-1-7/freevo/src/plugins/itv.py  (original)
+++ branches/rel-1-7/freevo/src/plugins/itv.py  Thu Jan 10 15:16:05 2008
@@ -1,7 +1,8 @@
 # -*- coding: iso-8859-1 -*-
 # -----------------------------------------------------------------------
-# itv.py - a simple plugin to view rss Video
+# Plugin to view RSS Video
 # -----------------------------------------------------------------------
+# $Id$
 #
 # Notes:
 # Todo:
@@ -71,14 +72,24 @@
     | plugin.activate('itv', level=45)
     |
     | ITV_LOCATIONS = [
-    |     ('JT LCI 18h', 'http://tf1.lci.fr/xml/rss/0,,14,00.xml'),
-    |     ('JT i>Tele', 
'http://podcast12.streamakaci.com/iTELE/iTELElejournal.xml'),
-    |     ('Flash Equipe', 'http://www.lequipe.fr/Podcast/flashETV_rss.xml'),
-    |     ('M�t�o LCI', 'http://tf1.fr/xml/rss/0,,23,00.xml'),
-    |     ('M�t�o France 2', 'file:///home/henri2/.freevo/meteo.xml')
+    |     ('JT LCI 18h', 'http://tf1.lci.fr/xml/rss/0,,14,00.xml',''),
+    |     ('JT i>Tele', 
'http://podcast12.streamakaci.com/iTELE/iTELElejournal.xml',''),
+    |     ('Flash Equipe', 
'http://www.lequipe.fr/Podcast/flashETV_rss.xml',''),
+    |     ('M�t�o LCI', 'http://tf1.fr/xml/rss/0,,23,00.xml',''),
+    |     ('M�t�o France 2', 'file:///home/henri2/.freevo/meteo.xml','')
+    |     ('YouTube - Today most viewed', 
'http://youtube.com/rss/global/top_viewed_today.rss', 'youtube')
     | ]
 
+    To see YouTube feeds you must have the script youtube-dl 
(http://www.arrakis.es/~rggi3/youtube-dl/)
+    on the system path and you can add the following to local_conf.py:
+
+    |
+    | YOUTUBE_USER='your_yuotube_account_name'
+    | YOUTUBE_PASSWORD='yout_youtube_password'
+    |
+
     For a full list of tested sites, see 'Docs/plugins/itv.txt'.
+    For YouTube feeds you shall see http://www.youtube.com/rssls.
     """
 
     def __init__(self):
@@ -89,11 +100,11 @@
 
     def config(self):
         return [('ITV_LOCATIONS', [
-                ('JT LCI 18h', 'http://tf1.lci.fr/xml/rss/0,,14,00.xml'),
-                ('JT i>Tele', 
'http://podcast12.streamakaci.com/iTELE/iTELElejournal.xml'),
-                ('Flash Equipe', 
'http://www.lequipe.fr/Podcast/flashETV_rss.xml'),
-                ('M�t�o LCI', 'http://tf1.fr/xml/rss/0,,23,00.xml'),
-                ('M�t�o France 2', 'file:///home/henri2/.freevo/meteo.xml')],
+                ('JT LCI 18h', 'http://tf1.lci.fr/xml/rss/0,,14,00.xml',''),
+                ('JT i>Tele', 
'http://podcast12.streamakaci.com/iTELE/iTELElejournal.xml',''),
+                ('Flash Equipe', 
'http://www.lequipe.fr/Podcast/flashETV_rss.xml',''),
+                ('M�t�o LCI', 'http://tf1.fr/xml/rss/0,,23,00.xml',''),
+                ('M�t�o France 2', 
'file:///home/henri2/.freevo/meteo.xml','')],
                  'where to get the news')]
 
     def items(self, parent):
@@ -170,13 +181,17 @@
                             description = c.firstChild.data
                         #################################
                         # Ajout pour identifier le lien de la video
-                        if c.localName == 'enclosure':
-                            attrs = c.attributes
-                            for attrName in attrs.keys():
-                                attrNode = attrs.get(attrName)
-                                attrValue = attrNode.nodeValue
-                                if 'url' in attrName:
-                                    link = attrValue
+                        if self.mode == 'youtube':
+                            if c.localName == 'link':
+                                link='youtube:'+c.firstChild.data
+                        else:
+                            if c.localName == 'enclosure':
+                                attrs = c.attributes
+                                for attrName in attrs.keys():
+                                    attrNode = attrs.get(attrName)
+                                    attrValue = attrNode.nodeValue
+                                    if 'url' in attrName:
+                                        link = attrValue
 
                 if title:
                     headlines.append((title, link, description))
@@ -250,6 +265,7 @@
             headlines_site_item = HeadlinesSiteItem(self)
             headlines_site_item.name = location[0]
             headlines_site_item.url = location[1]
+            headlines_site_item.mode = location[2]
             headlines_site_item.location_index = 
config.ITV_LOCATIONS.index(location)
             headlines_sites += [ headlines_site_item ]
         if (len(headlines_sites) == 0):

Modified: branches/rel-1-7/freevo/src/video/videoitem.py
==============================================================================
--- branches/rel-1-7/freevo/src/video/videoitem.py      (original)
+++ branches/rel-1-7/freevo/src/video/videoitem.py      Thu Jan 10 15:16:05 2008
@@ -1,6 +1,6 @@
 # -*- coding: iso-8859-1 -*-
 # -----------------------------------------------------------------------
-# videoitem.py - Item for video objects
+# Item for video objects
 # -----------------------------------------------------------------------
 # $Id$
 #
@@ -336,6 +336,17 @@
                 items = [ (self.dvd_vcd_title_menu, _('VCD title list')),
                           (self.play, _('Play default track')) ]
         else:
+            if self.url.startswith('youtube:'):
+                popup=PopupBox('Resolving YouTube video URL....')
+                popup.show()
+                if hasattr(config,'YOUTUBE_USER'):
+                    cmdline='youtube-dl -g -u '+config.YOUTUBE_USER+' -p 
'+config.YOUTUBE_PASSWORD+' '
+                else:
+                    cmdline='youtube-dl -g '
+                pipe=os.popen(cmdline+self.url[8:])
+                self.url=pipe.readline()
+                pipe.close()
+                popup.hide()
             items = [ (self.play, _('Play')) ]
 
         items.append((self.show_details, _('Full description')))

Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Thu Jan 10 15:16:05 2008
@@ -26,6 +26,7 @@
  * New Youtube video plug-in (F#1864496)
  * Updated cdbackup plug-in with CD_RIP_FMT to set the encoding format 
(F#1857460)
  * Updated encoding server to save the output to ENCODINGSERVER_SAVE_DIR when 
set (F#1865522)
+ * Updated itv plug-in for youtube video feeds (F#1868425)
  * Updated re-encode plug-in and encoding core with additional features 
(F#1868764)
  * Updated recordings manager plug-in to add thumbnail support (F#1857397)
  * Updated recordserver to default watched/keep status (F#1857395)

Modified: branches/rel-1/freevo/src/plugins/itv.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/itv.py    (original)
+++ branches/rel-1/freevo/src/plugins/itv.py    Thu Jan 10 15:16:05 2008
@@ -1,7 +1,8 @@
 # -*- coding: iso-8859-1 -*-
 # -----------------------------------------------------------------------
-# itv.py - a simple plugin to view rss Video
+# Plugin to view RSS Video
 # -----------------------------------------------------------------------
+# $Id$
 #
 # Notes:
 # Todo:
@@ -71,14 +72,24 @@
     | plugin.activate('itv', level=45)
     |
     | ITV_LOCATIONS = [
-    |     ('JT LCI 18h', 'http://tf1.lci.fr/xml/rss/0,,14,00.xml'),
-    |     ('JT i>Tele', 
'http://podcast12.streamakaci.com/iTELE/iTELElejournal.xml'),
-    |     ('Flash Equipe', 'http://www.lequipe.fr/Podcast/flashETV_rss.xml'),
-    |     ('M�t�o LCI', 'http://tf1.fr/xml/rss/0,,23,00.xml'),
-    |     ('M�t�o France 2', 'file:///home/henri2/.freevo/meteo.xml')
+    |     ('JT LCI 18h', 'http://tf1.lci.fr/xml/rss/0,,14,00.xml',''),
+    |     ('JT i>Tele', 
'http://podcast12.streamakaci.com/iTELE/iTELElejournal.xml',''),
+    |     ('Flash Equipe', 
'http://www.lequipe.fr/Podcast/flashETV_rss.xml',''),
+    |     ('M�t�o LCI', 'http://tf1.fr/xml/rss/0,,23,00.xml',''),
+    |     ('M�t�o France 2', 'file:///home/henri2/.freevo/meteo.xml','')
+    |     ('YouTube - Today most viewed', 
'http://youtube.com/rss/global/top_viewed_today.rss', 'youtube')
     | ]
 
+    To see YouTube feeds you must have the script youtube-dl 
(http://www.arrakis.es/~rggi3/youtube-dl/)
+    on the system path and you can add the following to local_conf.py:
+
+    |
+    | YOUTUBE_USER='your_yuotube_account_name'
+    | YOUTUBE_PASSWORD='yout_youtube_password'
+    |
+
     For a full list of tested sites, see 'Docs/plugins/itv.txt'.
+    For YouTube feeds you shall see http://www.youtube.com/rssls.
     """
 
     def __init__(self):
@@ -89,11 +100,11 @@
 
     def config(self):
         return [('ITV_LOCATIONS', [
-                ('JT LCI 18h', 'http://tf1.lci.fr/xml/rss/0,,14,00.xml'),
-                ('JT i>Tele', 
'http://podcast12.streamakaci.com/iTELE/iTELElejournal.xml'),
-                ('Flash Equipe', 
'http://www.lequipe.fr/Podcast/flashETV_rss.xml'),
-                ('M�t�o LCI', 'http://tf1.fr/xml/rss/0,,23,00.xml'),
-                ('M�t�o France 2', 'file:///home/henri2/.freevo/meteo.xml')],
+                ('JT LCI 18h', 'http://tf1.lci.fr/xml/rss/0,,14,00.xml',''),
+                ('JT i>Tele', 
'http://podcast12.streamakaci.com/iTELE/iTELElejournal.xml',''),
+                ('Flash Equipe', 
'http://www.lequipe.fr/Podcast/flashETV_rss.xml',''),
+                ('M�t�o LCI', 'http://tf1.fr/xml/rss/0,,23,00.xml',''),
+                ('M�t�o France 2', 
'file:///home/henri2/.freevo/meteo.xml','')],
                  'where to get the news')]
 
     def items(self, parent):
@@ -170,13 +181,17 @@
                             description = c.firstChild.data
                         #################################
                         # Ajout pour identifier le lien de la video
-                        if c.localName == 'enclosure':
-                            attrs = c.attributes
-                            for attrName in attrs.keys():
-                                attrNode = attrs.get(attrName)
-                                attrValue = attrNode.nodeValue
-                                if 'url' in attrName:
-                                    link = attrValue
+                        if self.mode == 'youtube':
+                            if c.localName == 'link':
+                                link='youtube:'+c.firstChild.data
+                        else:
+                            if c.localName == 'enclosure':
+                                attrs = c.attributes
+                                for attrName in attrs.keys():
+                                    attrNode = attrs.get(attrName)
+                                    attrValue = attrNode.nodeValue
+                                    if 'url' in attrName:
+                                        link = attrValue
 
                 if title:
                     headlines.append((title, link, description))
@@ -250,6 +265,7 @@
             headlines_site_item = HeadlinesSiteItem(self)
             headlines_site_item.name = location[0]
             headlines_site_item.url = location[1]
+            headlines_site_item.mode = location[2]
             headlines_site_item.location_index = 
config.ITV_LOCATIONS.index(location)
             headlines_sites += [ headlines_site_item ]
         if (len(headlines_sites) == 0):

Modified: branches/rel-1/freevo/src/video/videoitem.py
==============================================================================
--- branches/rel-1/freevo/src/video/videoitem.py        (original)
+++ branches/rel-1/freevo/src/video/videoitem.py        Thu Jan 10 15:16:05 2008
@@ -1,6 +1,6 @@
 # -*- coding: iso-8859-1 -*-
 # -----------------------------------------------------------------------
-# videoitem.py - Item for video objects
+# Item for video objects
 # -----------------------------------------------------------------------
 # $Id$
 #
@@ -336,6 +336,17 @@
                 items = [ (self.dvd_vcd_title_menu, _('VCD title list')),
                           (self.play, _('Play default track')) ]
         else:
+            if self.url.startswith('youtube:'):
+                popup=PopupBox('Resolving YouTube video URL....')
+                popup.show()
+                if hasattr(config,'YOUTUBE_USER'):
+                    cmdline='youtube-dl -g -u '+config.YOUTUBE_USER+' -p 
'+config.YOUTUBE_PASSWORD+' '
+                else:
+                    cmdline='youtube-dl -g '
+                pipe=os.popen(cmdline+self.url[8:])
+                self.url=pipe.readline()
+                pipe.close()
+                popup.hide()
             items = [ (self.play, _('Play')) ]
 
         items.append((self.show_details, _('Full description')))

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to