Code review comment for lp://staging/~samuel-buffet/entertainer/ftx2

Revision history for this message
Samuel Buffet (samuel-buffet) wrote :

Right, thanks for that catch Matt.

So, now the get_texture is reintroduced and return None if there's no art available for the currently playing media.

Then, the main screen display the *default-art* in the preview area.

The same philosophy is used in other screens.

new diff :

=== modified file 'entertainerlib/frontend/gui/screens/main_screen.py'
--- entertainerlib/frontend/gui/screens/main_screen.py 2008-12-08 17:26:56 +0000
+++ entertainerlib/frontend/gui/screens/main_screen.py 2009-01-08 09:38:04 +0000
@@ -110,6 +110,8 @@

         # Video preview of current media
         video_texture = player.get_texture()
+ if video_texture == None:
+ video_texture = Texture(self.theme.getImage("default_album_art"))
         width, height = video_texture.get_size()
         x_ratio = (self.PREVIEW_WIDTH - 50) / float(width)
         y_ratio = (self.PREVIEW_HEIGHT - 50) / float(height)

=== modified file 'entertainerlib/frontend/media_player.py'
--- entertainerlib/frontend/media_player.py 2008-12-14 20:01:49 +0000
+++ entertainerlib/frontend/media_player.py 2009-01-08 15:37:51 +0000
@@ -4,7 +4,7 @@
 __copyright__ = "2007, Lauri Taimila"
 __author__ = "Lauri Taimila <email address hidden>"

-# import order is important here since Clutter 0.8,
+# import order is important here since Clutter 0.8,
 # see the pyclutter README for details

 import cluttergst
@@ -13,6 +13,7 @@

 from entertainerlib.frontend.gui.widgets.texture import Texture
 from entertainerlib.frontend.medialibrary.playable import Playable
+from entertainerlib.utils.logger import Logger

 class MediaPlayer(object):
     """
@@ -58,6 +59,8 @@
         self.repeat = False # Repeat mode
         self.playing = False # Is media player currently playing

+ self.logger = Logger().getLogger('frontend.MediaPlayer')
+
         self.video_texture = cluttergst.VideoTexture()
         self.playbin = self.video_texture.get_playbin()
         self.bus = self.playbin.get_bus()
@@ -72,8 +75,6 @@
         Callback function that is called every time when message occurs on
         Gstreamer messagebus.
         """
- # TODO: Figure out what needs to be done (if anything) with the bus
- # variable on callback
         if message.type == gst.MESSAGE_EOS:
             if self.media.get_type() == Playable.VIDEO_STREAM \
                 or self.playlist is None:
@@ -81,6 +82,12 @@
                 self.video_texture.set_property("position", 0)
             else:
                 self.next()
+ elif message.type == gst.MESSAGE_ERROR:
+ self.video_texture.set_playing(False)
+ self.video_texture.set_property("position", 0)
+ err, debug = message.parse_error()
+ self.logger.error("Error: %(err)s, %(debug)s" % \
+ {'err': err, 'debug': debug})

     def set_playlist(self, playlist):
         """
@@ -502,5 +509,5 @@
                 texture = Texture(url)
                 return texture
             else:
- pass #FIXME: Return default album art
+ return None

« Back to merge proposal