Author: duncan
Date: Wed Jan 23 15:13:10 2008
New Revision: 10308

Log:
Stop the trace-back when the variables have not been defined
Bit of a code clean-up and added debug messages


Modified:
   branches/rel-1-7/freevo/src/image/plugins/flickr.py
   branches/rel-1-7/freevo/src/video/plugins/youtube.py
   branches/rel-1/freevo/src/image/plugins/flickr.py
   branches/rel-1/freevo/src/video/plugins/youtube.py

Modified: branches/rel-1-7/freevo/src/image/plugins/flickr.py
==============================================================================
--- branches/rel-1-7/freevo/src/image/plugins/flickr.py (original)
+++ branches/rel-1-7/freevo/src/image/plugins/flickr.py Wed Jan 23 15:13:10 2008
@@ -95,69 +95,82 @@
     |   ("id2", "description2"),
     |    ...
     | ]
-    | FLICKR_DIR = "/tmp/"
     | FLICKR_KEY = "your flickr key"
+    | FLICKR_DIR = "/tmp/"
     | FLICKR_LIMIT = 20
     """
     def __init__(self):
+        _debug_('PluginInterface.__init__()', 2)
         if not config.USE_NETWORK:
             self.reason = 'USE_NETWORK not enabled'
             return
-        if not config.FLICKR_PICTURES:
+        if not hasattr(config, 'FLICKR_PICTURES') or not 
config.FLICKR_PICTURES:
             self.reason = 'FLICKR_PICTURES not defined'
             return
-        if not config.FLICKR_KEY:
+        if not hasattr(config, 'FLICKR_KEY') or not config.FLICKR_KEY:
             self.reason = 'FLICKR_KEY not defined'
             return
-        if not config.FLICKR_DIR:
-            config.FLICKR_DIR = "/tmp/"
 
         if not os.path.isdir(config.FLICKR_DIR):
             os.mkdir(config.FLICKR_DIR, 
stat.S_IMODE(os.stat(config.FREEVO_CACHEDIR)[stat.ST_MODE]))
 
         plugin.MainMenuPlugin.__init__(self)
 
+
     def config(self):
         """returns the config variables used by this plugin"""
+        _debug_('config()', 2)
         return [
             ('FLICKR_PICTURES', None, 'id and description to get pictures'),
-            ('FLICKR_DIR', config.FREEVO_CACHEDIR + '/flickr', 'directory to 
save flickr pictures'),
             ('FLICKR_KEY', None, 'Your flickr key api to access 
www.flickr.com'),
+            ('FLICKR_DIR', config.FREEVO_CACHEDIR + '/flickr', 'directory to 
save flickr pictures'),
             ('FLICKR_LIMIT', 20, 'Max number of pictures to show'),
         ]
 
+
     def items(self, parent):
+        _debug_('items(parent=%r)' % (parent), 2)
         return [ FlickImage(parent) ]
 
+
+
 class FlickImage(Item):
     """Main Class"""
 
     def __init__(self, parent):
+        _debug_('FlickImage.__init__(parent=%r)' % (parent), 2)
         Item.__init__(self, parent, skin_type='image')
         self.name = _('Flickr pictures')
         self.title = _('Flickr pictures')
         self.type = 'flickr'
         self.info = { 'name' : 'Flickr', 'description' : 'Flickr pictures', 
'title' : 'Flickr' }
 
-    # Only one action, return user list
+
     def actions(self):
         """Only one action, return user list"""
+        _debug_('actions()', 2)
         return [ (self.userlist, 'Flickr pictures') ]
 
+
     def userlist(self, arg=None, menuw=None):
         """Menu for choose user"""
+        _debug_('userlist(arg=%r, menuw=%r)' % (arg, menuw), 2)
         users = []
         for id,description in config.FLICKR_PICTURES:
             users.append(menu.MenuItem(description, self.imagelist, (id, 
description)))
         menuw.pushmenu(menu.Menu(_("Choose please"), users))
 
+
     def imagelist(self, arg=None, menuw=None):
         """Menu for choose image"""
+        _debug_('imagelist(arg=%r, menuw=%r)' % (arg, menuw), 2)
         items = image_list(self, _("Retrieving image list"), arg[0])
         menuw.pushmenu(menu.Menu(_('Images available'), items))
 
-    # Save in file and watch it
+
     def showimage(self, arg=None, menuw=None):
+        """Save in file and watch it"""
+        _debug_('showimage(arg=%r, menuw=%r)' % (arg, menuw), 2)
         file = config.FLICKR_DIR + "/" + arg[2].replace("-","_") + ".jpg"
         if not os.path.exists(file):
             box = PopupBox(_("Downloading picture \"") + arg[0] + '"', 
width=600)
@@ -170,10 +183,14 @@
         #imagen = image.viewer.ImageViewer()
         #image.viewer.ImageViewer.view(imagen,imgitem)
 
+
 def image_list(parent, title, user):
     """Get the image list for a specific user"""
+    _debug_('image_list(parent=%r, title=%r, user=%r)' % (parent, title, 
user), 2)
     items = []
-    web = 
'http://www.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&user_id='
 + user + '&format=json&api_key=' + config.FLICKR_KEY + '&per_page=' + 
str(config.FLICKR_LIMIT) + '&page=1&extras=original_format'
+    web = 
'http://www.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&user_id='
 + user + \
+        '&format=json&api_key=' + config.FLICKR_KEY + '&per_page=' + 
str(config.FLICKR_LIMIT) + \
+        '&page=1&extras=original_format'
     url=urllib.urlopen(web)
     flickr=url.read()
     flickr=flickr.replace("jsonFlickrApi(","");
@@ -182,11 +199,12 @@
             #items.append(ImageItem(y[1],parent,foto["title"]))
 
         mi = menu.MenuItem(foto["title"], parent.showimage, 0)
-        mi.arg = (foto["title"],"http://farm3.static.flickr.com/"; + 
foto["server"] + "/" + foto["id"] + "_" + foto["originalsecret"] +  
"_o.jpg",foto["id"])
-        imagen = "http://farm3.static.flickr.com/"; + foto["server"] + "/" + 
foto["id"] + "_" + foto["secret"] +  "_m.jpg"
-        file = config.FLICKR_DIR + "/" + foto["id"].replace("-","_") + "_t.jpg"
+        mi.arg = (foto["title"],"http://farm3.static.flickr.com/"; + 
foto["server"] + "/" + \
+            foto["id"] + "_" + foto["originalsecret"] +  "_o.jpg",foto["id"])
+        imagen = 'http://farm3.static.flickr.com/' + foto['server'] + '/' + 
foto['id'] + '_' + foto['secret'] + '_m.jpg'
+        file = config.FLICKR_DIR + '/' + foto['id'].replace('-','_') + '_t.jpg'
         if not os.path.exists(file):
-            box = PopupBox(_("Downloading thumbnail for picture \"") + 
foto["title"] + '"', width=800)
+            box = PopupBox(_('Downloading thumbnail for picture "') + 
foto['title'] + '"', width=800)
             box.show()
             urllib.urlretrieve(imagen,file)
             box.destroy()

Modified: branches/rel-1-7/freevo/src/video/plugins/youtube.py
==============================================================================
--- branches/rel-1-7/freevo/src/video/plugins/youtube.py        (original)
+++ branches/rel-1-7/freevo/src/video/plugins/youtube.py        Wed Jan 23 
15:13:10 2008
@@ -97,10 +97,11 @@
     | YOUTUBE_DIR = '/tmp/'
     """
     def __init__(self):
+        _debug_('PluginInterface.__init__()', 2)
         if not config.USE_NETWORK:
             self.reason = 'USE_NETWORK not enabled'
             return
-        if not config.YOUTUBE_VIDEOS:
+        if not hasattr(config, 'YOUTUBE_VIDEOS') or not config.YOUTUBE_VIDEOS:
             self.reason = 'YOUTUBE_VIDEOS not defined'
             return
         plugin.MainMenuPlugin.__init__(self)
@@ -111,6 +112,7 @@
 
     def config(self):
         """returns the config variables used by this plugin"""
+        _debug_('config()', 2)
         return [
             ('YOUTUBE_VIDEOS', None, 'id and description to get/watch videos 
of youtube'),
             ('YOUTUBE_DIR', config.FREEVO_CACHEDIR + '/youtube', 'directory to 
save youtube videos'),
@@ -119,6 +121,7 @@
 
 
     def items(self, parent):
+        _debug_('items(parent=%r)' % (parent), 2)
         return [ YoutubeVideo(parent) ]
 
 
@@ -127,6 +130,7 @@
     """Create a VideoItem for play"""
 
     def __init__(self, name, url, parent):
+        _debug_('YoutubeVideoItem.__init__(name=%r, url=%r, parent=%r)' % 
(name, url, parent), 2)
         VideoItem.__init__(self, url, parent)
         self.name = name
         self.type = 'youtube'
@@ -137,6 +141,7 @@
     """Main Class"""
 
     def __init__(self, parent):
+        _debug_('YoutubeVideo.__init__(parent=%r)' % (parent), 2)
         # look for a default player
         for p in plugin.getbyname(plugin.VIDEO_PLAYER, True):
             if config.VIDEO_PREFERED_PLAYER == p.name:
@@ -148,29 +153,36 @@
 
     def actions(self):
         """Only one action, return user list"""
+        _debug_('actions()', 2)
         return [ (self.userlist, 'Video youtube') ]
 
 
     def userlist(self, arg=None, menuw=None):
         """Menu for choose user"""
+        _debug_('userlist(arg=%r, menuw=%r)' % (arg, menuw), 2)
         users = []
         for user, description in config.YOUTUBE_VIDEOS:
             users.append(menu.MenuItem(description, self.videolist, (user, 
description)))
-        users.append(menu.MenuItem("Search video",self.search_video,0))
+        users.append(menu.MenuItem('Search video',self.search_video,0))
         menuw.pushmenu(menu.Menu(_('Choose please'), users))
+
+
     def search_video(self, arg=None, menuw=None):
-        txt = TextEntryScreen((_('Search'),self.search_list),_("Search"))
+        _debug_('search_video(arg=%r, menuw=%r)' % (arg, menuw), 2)
+        txt = TextEntryScreen((_('Search'),self.search_list),_('Search'))
         txt.show(menuw)
 
 
     def videolist(self, arg=None, menuw=None):
         """Menu for video"""
+        _debug_('videolist(arg=%r, menuw=%r)' % (arg, menuw), 2)
         items = self.video_list(_('Retrieving video list'), arg[0])
         menuw.pushmenu(menu.Menu(_('Videos available'), items))
 
 
     def downloadvideo(self, arg=None, menuw=None):
         """Download video (if necessary) and watch it"""
+        _debug_('downloadvideo(arg=%r, menuw=%r)' % (arg, menuw), 2)
         filename =  config.YOUTUBE_DIR + '/' + arg[1].replace('-', '_') + 
'.flv'
         if not os.path.exists(filename):
             box = PopupBox(text=_('Downloading video'), width=950)
@@ -192,22 +204,25 @@
         playvideo2.player_rating = 10
         playvideo2.menuw = menuw
         playvideo2.play()
+
+
     def search_list(parent, menuw, text=""):
         """Get the video list for a specific user"""
+        _debug_('search_list(parent=%r, menuw=%r, text=%r)' % (parent, menuw, 
text), 2)
         items = []
-        feed = "http://gdata.youtube.com/feeds/videos/-/"; + text
+        feed = 'http://gdata.youtube.com/feeds/videos/-/' + text
         service = gdata.service.GDataService(server='gdata.youtube.com')
         box = PopupBox(text=_('Loading video list'))
         box.show()
         for video in service.GetFeed(feed).entry:
-            date = video.published.text.split("T")
-            id = video.link[1].href.split("watch?v=");
-            mi = menu.MenuItem(date[0] + " " + video.title.text, 
parent.downloadvideo, id[1])
+            date = video.published.text.split('T')
+            id = video.link[1].href.split('watch?v=');
+            mi = menu.MenuItem(date[0] + ' ' + video.title.text, 
parent.downloadvideo, id[1])
             mi.arg = (video.title.text, id[1])
             text = util.htmlenties2txt(video.content)
             mi.description = re.search('<span>([^\<]*)<',text).group(1)
             tempimage = re.search('src="([^\"]*)"',text).group(1)
-            file = config.YOUTUBE_DIR + "/" + id[1].replace("-","_") + ".jpg"
+            file = config.YOUTUBE_DIR + '/' + id[1].replace('-','_') + '.jpg'
             if not os.path.exists(file):
                 aimage = urllib.urlretrieve(tempimage,file)
             mi.image = file
@@ -215,22 +230,24 @@
         box.destroy()
         menuw.pushmenu(menu.Menu(_('Videos available'), items))
 
+
     def video_list(parent, title, user):
         """Get the video list for a specific user"""
+        _debug_('video_list(parent=%r, title=%r, user=%r)' % (parent, title, 
user), 2)
         items = []
         feed = 'http://gdata.youtube.com/feeds/users/' + user + 
'/uploads?orderby=updated'
         service = gdata.service.GDataService(server='gdata.youtube.com')
         box = PopupBox(text=_('Loading video list'))
         box.show()
         for video in service.GetFeed(feed).entry:
-            date = video.published.text.split("T")
-            id = video.link[1].href.split("watch?v=");
-            mi = menu.MenuItem(date[0] + " " + video.title.text, 
parent.downloadvideo, id[1])
+            date = video.published.text.split('T')
+            id = video.link[1].href.split('watch?v=');
+            mi = menu.MenuItem(date[0] + ' ' + video.title.text, 
parent.downloadvideo, id[1])
             mi.arg = (video.title.text, id[1])
             text = util.htmlenties2txt(video.content)
             mi.description = re.search('<span>([^\<]*)<',text).group(1)
             tempimage = re.search('src="([^\"]*)"',text).group(1)
-            file = config.YOUTUBE_DIR + "/" + id[1].replace("-","_") + ".jpg"
+            file = config.YOUTUBE_DIR + '/' + id[1].replace('-','_') + '.jpg'
             if not os.path.exists(file):
                 aimage = urllib.urlretrieve(tempimage,file)
             mi.image = file

Modified: branches/rel-1/freevo/src/image/plugins/flickr.py
==============================================================================
--- branches/rel-1/freevo/src/image/plugins/flickr.py   (original)
+++ branches/rel-1/freevo/src/image/plugins/flickr.py   Wed Jan 23 15:13:10 2008
@@ -95,69 +95,82 @@
     |   ("id2", "description2"),
     |    ...
     | ]
-    | FLICKR_DIR = "/tmp/"
     | FLICKR_KEY = "your flickr key"
+    | FLICKR_DIR = "/tmp/"
     | FLICKR_LIMIT = 20
     """
     def __init__(self):
+        _debug_('PluginInterface.__init__()', 2)
         if not config.USE_NETWORK:
             self.reason = 'USE_NETWORK not enabled'
             return
-        if not config.FLICKR_PICTURES:
+        if not hasattr(config, 'FLICKR_PICTURES') or not 
config.FLICKR_PICTURES:
             self.reason = 'FLICKR_PICTURES not defined'
             return
-        if not config.FLICKR_KEY:
+        if not hasattr(config, 'FLICKR_KEY') or not config.FLICKR_KEY:
             self.reason = 'FLICKR_KEY not defined'
             return
-        if not config.FLICKR_DIR:
-            config.FLICKR_DIR = "/tmp/"
 
         if not os.path.isdir(config.FLICKR_DIR):
             os.mkdir(config.FLICKR_DIR, 
stat.S_IMODE(os.stat(config.FREEVO_CACHEDIR)[stat.ST_MODE]))
 
         plugin.MainMenuPlugin.__init__(self)
 
+
     def config(self):
         """returns the config variables used by this plugin"""
+        _debug_('config()', 2)
         return [
             ('FLICKR_PICTURES', None, 'id and description to get pictures'),
-            ('FLICKR_DIR', config.FREEVO_CACHEDIR + '/flickr', 'directory to 
save flickr pictures'),
             ('FLICKR_KEY', None, 'Your flickr key api to access 
www.flickr.com'),
+            ('FLICKR_DIR', config.FREEVO_CACHEDIR + '/flickr', 'directory to 
save flickr pictures'),
             ('FLICKR_LIMIT', 20, 'Max number of pictures to show'),
         ]
 
+
     def items(self, parent):
+        _debug_('items(parent=%r)' % (parent), 2)
         return [ FlickImage(parent) ]
 
+
+
 class FlickImage(Item):
     """Main Class"""
 
     def __init__(self, parent):
+        _debug_('FlickImage.__init__(parent=%r)' % (parent), 2)
         Item.__init__(self, parent, skin_type='image')
         self.name = _('Flickr pictures')
         self.title = _('Flickr pictures')
         self.type = 'flickr'
         self.info = { 'name' : 'Flickr', 'description' : 'Flickr pictures', 
'title' : 'Flickr' }
 
-    # Only one action, return user list
+
     def actions(self):
         """Only one action, return user list"""
+        _debug_('actions()', 2)
         return [ (self.userlist, 'Flickr pictures') ]
 
+
     def userlist(self, arg=None, menuw=None):
         """Menu for choose user"""
+        _debug_('userlist(arg=%r, menuw=%r)' % (arg, menuw), 2)
         users = []
         for id,description in config.FLICKR_PICTURES:
             users.append(menu.MenuItem(description, self.imagelist, (id, 
description)))
         menuw.pushmenu(menu.Menu(_("Choose please"), users))
 
+
     def imagelist(self, arg=None, menuw=None):
         """Menu for choose image"""
+        _debug_('imagelist(arg=%r, menuw=%r)' % (arg, menuw), 2)
         items = image_list(self, _("Retrieving image list"), arg[0])
         menuw.pushmenu(menu.Menu(_('Images available'), items))
 
-    # Save in file and watch it
+
     def showimage(self, arg=None, menuw=None):
+        """Save in file and watch it"""
+        _debug_('showimage(arg=%r, menuw=%r)' % (arg, menuw), 2)
         file = config.FLICKR_DIR + "/" + arg[2].replace("-","_") + ".jpg"
         if not os.path.exists(file):
             box = PopupBox(_("Downloading picture \"") + arg[0] + '"', 
width=600)
@@ -170,10 +183,14 @@
         #imagen = image.viewer.ImageViewer()
         #image.viewer.ImageViewer.view(imagen,imgitem)
 
+
 def image_list(parent, title, user):
     """Get the image list for a specific user"""
+    _debug_('image_list(parent=%r, title=%r, user=%r)' % (parent, title, 
user), 2)
     items = []
-    web = 
'http://www.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&user_id='
 + user + '&format=json&api_key=' + config.FLICKR_KEY + '&per_page=' + 
str(config.FLICKR_LIMIT) + '&page=1&extras=original_format'
+    web = 
'http://www.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&user_id='
 + user + \
+        '&format=json&api_key=' + config.FLICKR_KEY + '&per_page=' + 
str(config.FLICKR_LIMIT) + \
+        '&page=1&extras=original_format'
     url=urllib.urlopen(web)
     flickr=url.read()
     flickr=flickr.replace("jsonFlickrApi(","");
@@ -182,11 +199,12 @@
             #items.append(ImageItem(y[1],parent,foto["title"]))
 
         mi = menu.MenuItem(foto["title"], parent.showimage, 0)
-        mi.arg = (foto["title"],"http://farm3.static.flickr.com/"; + 
foto["server"] + "/" + foto["id"] + "_" + foto["originalsecret"] +  
"_o.jpg",foto["id"])
-        imagen = "http://farm3.static.flickr.com/"; + foto["server"] + "/" + 
foto["id"] + "_" + foto["secret"] +  "_m.jpg"
-        file = config.FLICKR_DIR + "/" + foto["id"].replace("-","_") + "_t.jpg"
+        mi.arg = (foto["title"],"http://farm3.static.flickr.com/"; + 
foto["server"] + "/" + \
+            foto["id"] + "_" + foto["originalsecret"] +  "_o.jpg",foto["id"])
+        imagen = 'http://farm3.static.flickr.com/' + foto['server'] + '/' + 
foto['id'] + '_' + foto['secret'] + '_m.jpg'
+        file = config.FLICKR_DIR + '/' + foto['id'].replace('-','_') + '_t.jpg'
         if not os.path.exists(file):
-            box = PopupBox(_("Downloading thumbnail for picture \"") + 
foto["title"] + '"', width=800)
+            box = PopupBox(_('Downloading thumbnail for picture "') + 
foto['title'] + '"', width=800)
             box.show()
             urllib.urlretrieve(imagen,file)
             box.destroy()

Modified: branches/rel-1/freevo/src/video/plugins/youtube.py
==============================================================================
--- branches/rel-1/freevo/src/video/plugins/youtube.py  (original)
+++ branches/rel-1/freevo/src/video/plugins/youtube.py  Wed Jan 23 15:13:10 2008
@@ -97,10 +97,11 @@
     | YOUTUBE_DIR = '/tmp/'
     """
     def __init__(self):
+        _debug_('PluginInterface.__init__()', 2)
         if not config.USE_NETWORK:
             self.reason = 'USE_NETWORK not enabled'
             return
-        if not config.YOUTUBE_VIDEOS:
+        if not hasattr(config, 'YOUTUBE_VIDEOS') or not config.YOUTUBE_VIDEOS:
             self.reason = 'YOUTUBE_VIDEOS not defined'
             return
         plugin.MainMenuPlugin.__init__(self)
@@ -111,6 +112,7 @@
 
     def config(self):
         """returns the config variables used by this plugin"""
+        _debug_('config()', 2)
         return [
             ('YOUTUBE_VIDEOS', None, 'id and description to get/watch videos 
of youtube'),
             ('YOUTUBE_DIR', config.FREEVO_CACHEDIR + '/youtube', 'directory to 
save youtube videos'),
@@ -119,6 +121,7 @@
 
 
     def items(self, parent):
+        _debug_('items(parent=%r)' % (parent), 2)
         return [ YoutubeVideo(parent) ]
 
 
@@ -127,6 +130,7 @@
     """Create a VideoItem for play"""
 
     def __init__(self, name, url, parent):
+        _debug_('YoutubeVideoItem.__init__(name=%r, url=%r, parent=%r)' % 
(name, url, parent), 2)
         VideoItem.__init__(self, url, parent)
         self.name = name
         self.type = 'youtube'
@@ -137,6 +141,7 @@
     """Main Class"""
 
     def __init__(self, parent):
+        _debug_('YoutubeVideo.__init__(parent=%r)' % (parent), 2)
         # look for a default player
         for p in plugin.getbyname(plugin.VIDEO_PLAYER, True):
             if config.VIDEO_PREFERED_PLAYER == p.name:
@@ -148,29 +153,36 @@
 
     def actions(self):
         """Only one action, return user list"""
+        _debug_('actions()', 2)
         return [ (self.userlist, 'Video youtube') ]
 
 
     def userlist(self, arg=None, menuw=None):
         """Menu for choose user"""
+        _debug_('userlist(arg=%r, menuw=%r)' % (arg, menuw), 2)
         users = []
         for user, description in config.YOUTUBE_VIDEOS:
             users.append(menu.MenuItem(description, self.videolist, (user, 
description)))
-        users.append(menu.MenuItem("Search video",self.search_video,0))
+        users.append(menu.MenuItem('Search video',self.search_video,0))
         menuw.pushmenu(menu.Menu(_('Choose please'), users))
+
+
     def search_video(self, arg=None, menuw=None):
-        txt = TextEntryScreen((_('Search'),self.search_list),_("Search"))
+        _debug_('search_video(arg=%r, menuw=%r)' % (arg, menuw), 2)
+        txt = TextEntryScreen((_('Search'),self.search_list),_('Search'))
         txt.show(menuw)
 
 
     def videolist(self, arg=None, menuw=None):
         """Menu for video"""
+        _debug_('videolist(arg=%r, menuw=%r)' % (arg, menuw), 2)
         items = self.video_list(_('Retrieving video list'), arg[0])
         menuw.pushmenu(menu.Menu(_('Videos available'), items))
 
 
     def downloadvideo(self, arg=None, menuw=None):
         """Download video (if necessary) and watch it"""
+        _debug_('downloadvideo(arg=%r, menuw=%r)' % (arg, menuw), 2)
         filename =  config.YOUTUBE_DIR + '/' + arg[1].replace('-', '_') + 
'.flv'
         if not os.path.exists(filename):
             box = PopupBox(text=_('Downloading video'), width=950)
@@ -192,22 +204,25 @@
         playvideo2.player_rating = 10
         playvideo2.menuw = menuw
         playvideo2.play()
+
+
     def search_list(parent, menuw, text=""):
         """Get the video list for a specific user"""
+        _debug_('search_list(parent=%r, menuw=%r, text=%r)' % (parent, menuw, 
text), 2)
         items = []
-        feed = "http://gdata.youtube.com/feeds/videos/-/"; + text
+        feed = 'http://gdata.youtube.com/feeds/videos/-/' + text
         service = gdata.service.GDataService(server='gdata.youtube.com')
         box = PopupBox(text=_('Loading video list'))
         box.show()
         for video in service.GetFeed(feed).entry:
-            date = video.published.text.split("T")
-            id = video.link[1].href.split("watch?v=");
-            mi = menu.MenuItem(date[0] + " " + video.title.text, 
parent.downloadvideo, id[1])
+            date = video.published.text.split('T')
+            id = video.link[1].href.split('watch?v=');
+            mi = menu.MenuItem(date[0] + ' ' + video.title.text, 
parent.downloadvideo, id[1])
             mi.arg = (video.title.text, id[1])
             text = util.htmlenties2txt(video.content)
             mi.description = re.search('<span>([^\<]*)<',text).group(1)
             tempimage = re.search('src="([^\"]*)"',text).group(1)
-            file = config.YOUTUBE_DIR + "/" + id[1].replace("-","_") + ".jpg"
+            file = config.YOUTUBE_DIR + '/' + id[1].replace('-','_') + '.jpg'
             if not os.path.exists(file):
                 aimage = urllib.urlretrieve(tempimage,file)
             mi.image = file
@@ -215,22 +230,24 @@
         box.destroy()
         menuw.pushmenu(menu.Menu(_('Videos available'), items))
 
+
     def video_list(parent, title, user):
         """Get the video list for a specific user"""
+        _debug_('video_list(parent=%r, title=%r, user=%r)' % (parent, title, 
user), 2)
         items = []
         feed = 'http://gdata.youtube.com/feeds/users/' + user + 
'/uploads?orderby=updated'
         service = gdata.service.GDataService(server='gdata.youtube.com')
         box = PopupBox(text=_('Loading video list'))
         box.show()
         for video in service.GetFeed(feed).entry:
-            date = video.published.text.split("T")
-            id = video.link[1].href.split("watch?v=");
-            mi = menu.MenuItem(date[0] + " " + video.title.text, 
parent.downloadvideo, id[1])
+            date = video.published.text.split('T')
+            id = video.link[1].href.split('watch?v=');
+            mi = menu.MenuItem(date[0] + ' ' + video.title.text, 
parent.downloadvideo, id[1])
             mi.arg = (video.title.text, id[1])
             text = util.htmlenties2txt(video.content)
             mi.description = re.search('<span>([^\<]*)<',text).group(1)
             tempimage = re.search('src="([^\"]*)"',text).group(1)
-            file = config.YOUTUBE_DIR + "/" + id[1].replace("-","_") + ".jpg"
+            file = config.YOUTUBE_DIR + '/' + id[1].replace('-','_') + '.jpg'
             if not os.path.exists(file):
                 aimage = urllib.urlretrieve(tempimage,file)
             mi.image = file

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to