Merge lp:~rockstar/entertainer/kill-fixmes into lp:entertainer

Proposed by Paul Hummer
Status: Merged
Merged at revision: not available
Proposed branch: lp:~rockstar/entertainer/kill-fixmes
Merge into: lp:entertainer
Diff against target: None lines
To merge this branch: bzr merge lp:~rockstar/entertainer/kill-fixmes
Reviewer Review Type Date Requested Status
Samuel Buffet (community) Approve
Matt Layman Approve
Review via email: mp+3474@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

First of all, please review my more-pylint-fun branch, as this branch depends
on that one.

While working on the more-pylint-fun branch, I noticed that all of the FIXME
comments had to do entirely with incomplete functionality that will never be
implemented in its current form (like in the backend) or asking questions that
really didn't need to be asked, like "Is this safe?" where, if it weren't safe,
we would get a bug filed.

I basically just removed the FIXME lines, and enabled the avoidance of FIXME in
pylint. My next branch will probably address a bunch of the TODO issues, which
seem to have a bit more complication to them.

--
Paul Hummer
http://theironlion.net
1024/862FF08F C921 E962 58F8 5547 6723 0E8C 1C4D 8AC5 862F F08F

Revision history for this message
Matt Layman (mblayman) wrote :

 approve merge_conditional

This branch looks fine, but I have a couple of comments about the pylintrc. You've removed W0511 but still have the XXX comment.

I see that you removed TODO and XXX from the things to check. Do you think you could add an XXX comment indicating that we plan on adding TODO back to the list of things to check.

review: Approve
Revision history for this message
Samuel Buffet (samuel-buffet) wrote :
Download full text (8.6 KiB)

This branch is also merged with *more-pylint-fun*.

So as long as *more-pylint-fun* is okay I approve this one as well.

Paul, thanks to clean the bug tracker and remove all that.

here is a diff against *more-pylint-fun*

=== modified file 'entertainerlib/backend/components/mediacache/image_cache.py'
--- entertainerlib/backend/components/mediacache/image_cache.py 2009-02-07 22:12:25 +0000
+++ entertainerlib/backend/components/mediacache/image_cache.py 2009-02-08 20:31:58 +0000
@@ -107,8 +107,6 @@
         if self.isFileInCache(filename):
             self.removeFile(filename)
             self.addFile(filename)
- #FIXME: This is maybe too expensive method for this purpose!
- # Try to optimise it.

     def addDirectory(self, path):
         """
@@ -165,7 +163,6 @@
         """
         self.removeDirectory(path)
         self.addDirectory(path)
- #FIXME: This is very expensive method to call! Try to optimise it.

     def isFileInCache(self, filename):
         """Check if file is already in cache. Returns boolean value."""
@@ -250,12 +247,10 @@
             a_title = path[path.rfind('/')+1:].replace('_',' ').title()
             a_description = ""

- #FIXME: If not found we could generate fancy album thumb
         if os.path.exists(album_thumb):
             thumbnailer = ImageThumbnailer(album_thumb)
             thumbnailer.create_thumbnail()
             a_hash = thumbnailer.get_hash()
- del thumbnailer #FIXME: Does this make any sense?
         else:
             a_hash = ""

=== modified file 'entertainerlib/backend/components/mediacache/video_cache.py'
--- entertainerlib/backend/components/mediacache/video_cache.py 2009-02-07 22:12:25 +0000
+++ entertainerlib/backend/components/mediacache/video_cache.py 2009-02-08 20:31:58 +0000
@@ -239,7 +239,6 @@
         thash = thumbnailer.get_hash()
         del thumbnailer

- #FIXME: read resolution, length etc. from video file and add to db
         self.__db_cursor.execute("""INSERT INTO videofile(filename, hash)
                                     VALUES (:fn, :hash)""",
                                     { 'fn': filename, 'hash': thash, } )

=== modified file 'entertainerlib/frontend/gui/screens/photo_albums.py'
--- entertainerlib/frontend/gui/screens/photo_albums.py 2009-02-07 21:43:35 +0000
+++ entertainerlib/frontend/gui/screens/photo_albums.py 2009-02-08 20:31:58 +0000
@@ -106,7 +106,7 @@
                 nro_of_photos = str(nro_of_photos)
             item = TextMenuItem(0.4393, 0.0781, album.get_title(),
                 nro_of_photos)
- item.set_userdata(album) #FIXME: Should we use URLs as KEYS?
+ item.set_userdata(album)
             self.menu.add_actor(item)

         self.add(self.menu)

=== modified file 'entertainerlib/frontend/gui/screens/video_osd.py'
--- entertainerlib/frontend/gui/screens/video_osd.py 2009-02-03 23:37:57 +0000
+++ entertainerlib/frontend/gui/screens/video_osd.py 2009-02-08 20:31:58 +0000
@@ -212,8 +212,6 @@
         if event_type == UserEvent.PLAYER_STOP:
             self.display_progress_bar(hide_after_delay=False)
             self.pause_texture.hide()
- #FIXME
- ...

Read more...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'entertainerlib/backend/backend_server.py'
--- entertainerlib/backend/backend_server.py 2009-02-07 00:44:47 +0000
+++ entertainerlib/backend/backend_server.py 2009-02-08 07:01:25 +0000
@@ -6,8 +6,6 @@
6__author__ = "Lauri Taimila <lauri@taimila.com>"6__author__ = "Lauri Taimila <lauri@taimila.com>"
7__version__ = "0.1"7__version__ = "0.1"
88
9import sys
10
11import gobject9import gobject
1210
13from entertainerlib.utils.configuration import Configuration11from entertainerlib.utils.configuration import Configuration
@@ -46,6 +44,7 @@
46 self.config = Configuration()44 self.config = Configuration()
47 self.logger = Logger().getLogger('backend.BackendServer')45 self.logger = Logger().getLogger('backend.BackendServer')
48 self.message_bus = MessageBus()46 self.message_bus = MessageBus()
47 self._port = self.config.get_port()
4948
50 # Connection server - Thread that listens incoming socket connections49 # Connection server - Thread that listens incoming socket connections
51 self.connection_server = None50 self.connection_server = None
@@ -69,34 +68,19 @@
6968
70 def initialize_configuration(self):69 def initialize_configuration(self):
71 """Initialize configuration"""70 """Initialize configuration"""
72 try:71 cfg_dict = {
73 cfg_dict = { MessageType.CONTENT_CONF_UPDATED :72 MessageType.CONTENT_CONF_UPDATED : MessagePriority.VERY_HIGH,
74 MessagePriority.VERY_HIGH,73 MessageType.PREFERENCES_CONF_UPDATED : MessagePriority.VERY_HIGH
75 MessageType.PREFERENCES_CONF_UPDATED :74 }
76 MessagePriority.VERY_HIGH }75 self.message_bus.registerMessageHandler(self.config, cfg_dict)
77 self.message_bus.registerMessageHandler(self.config, cfg_dict)76 self.logger.debug("Configuration intialized successfully")
78 self.logger.debug("Configuration intialized successfully")
79 except:
80 print "Couldn't read configuration file! Execution aborted..."
81 sys.exit(1)
8277
83 def initialize_connection_server(self):78 def initialize_connection_server(self):
84 """Initialize connection server."""79 """Initialize connection server."""
85 try:80 self.connection_server = ConnectionServer(self._port,
86 self._port = self.config.get_port()81 self.message_bus)
87 self.connection_server = ConnectionServer(self._port,82 # Start listening incoming connections
88 self.message_bus)83 self.connection_server.start()
89 # Start listening incoming connections
90 self.connection_server.start()
91 except:
92 self.logger.error("ConnectionServer initialization failed!")
93 message = 'Error occured. Please see '
94 message += self.config.ENTERTAINER_LOG
95 message += ' for more information. This is probably not a fatal'
96 message += ' error. Just wait one minute and try again.'
97 print message
98 print "Execution aborted!"
99 sys.exit(1)
10084
101 def initialize_scheduler(self):85 def initialize_scheduler(self):
102 """Initialize message scheduler."""86 """Initialize message scheduler."""
10387
=== modified file 'entertainerlib/backend/components/feeds/feed_fetcher.py'
--- entertainerlib/backend/components/feeds/feed_fetcher.py 2009-02-06 08:13:48 +0000
+++ entertainerlib/backend/components/feeds/feed_fetcher.py 2009-02-07 21:43:35 +0000
@@ -52,14 +52,9 @@
52 last_update = datetime(dt[0], dt[1], dt[2],52 last_update = datetime(dt[0], dt[1], dt[2],
53 dt[3], dt[4], dt[5])53 dt[3], dt[4], dt[5])
54 except AttributeError:54 except AttributeError:
55 try:55 dt = data.entries[0].date_parsed
56 dt = data.entries[0].date_parsed56 last_update = datetime(dt[0], dt[1], dt[2],
57 last_update = datetime(dt[0], dt[1], dt[2],57 dt[3], dt[4], dt[5])
58 dt[3], dt[4], dt[5])
59 except:
60 self.logger.warning("Couldn't determine feed date of " \
61 + data.feed.title)
62 continue # Skip to the next feed
6358
64 #Check if this feed has new entries59 #Check if this feed has new entries
65 db_cursor.execute("""SELECT date,time60 db_cursor.execute("""SELECT date,time
6661
=== modified file 'entertainerlib/backend/components/mediacache/image_cache.py'
--- entertainerlib/backend/components/mediacache/image_cache.py 2009-02-06 08:13:48 +0000
+++ entertainerlib/backend/components/mediacache/image_cache.py 2009-02-08 08:44:46 +0000
@@ -57,37 +57,26 @@
57 thumb_file = os.path.join(self.config.IMAGE_THUMB_DIR, element)57 thumb_file = os.path.join(self.config.IMAGE_THUMB_DIR, element)
58 try:58 try:
59 os.remove(thumb_file)59 os.remove(thumb_file)
60 except:60 except OSError:
61 self.logger.error(61 self.logger.error(
62 "Media manager couldn't remove thumbnail : %s"62 "Media manager couldn't remove thumbnail : %s"
63 % thumb_file)63 % thumb_file)
64 try:64 os.remove(self.config.IMAGE_DB)
65 os.remove(self.config.IMAGE_DB)65 self._createImageCacheDatabase()
66 self._createImageCacheDatabase()
67 except:
68 raise IOError("Couldn't clear image cache")
6966
7067
71 def addFile(self, filename):68 def addFile(self, filename):
72 """69 """
73 Add image file to the cache. Do nothing if file is already cached.70 Add image file to the cache. Do nothing if file is already cached.
74 """71 """
75 try:72 filename = filename.encode('utf8')
76 filename = filename.encode('utf8')73 if (not self.isFileInCache(filename) and
77 if (not self.isFileInCache(filename) and74 self.isSupportedFormat(filename)):
78 self.isSupportedFormat(filename)):75 # Do not add album thumbnail to images
79 # Do not add album thumbnail to images76 if (filename[filename.rfind('/') +1:filename.rfind('.')] ==
80 if (filename[filename.rfind('/') +1:filename.rfind('.')] ==77 ".entertainer_album"):
81 ".entertainer_album"):78 return
82 return79 self._addJPEGfile(filename)
83 try:
84 self._addJPEGfile(filename)
85 except Exception, e:
86 self.logger.error("Couldn't cache file: " + filename)
87 self.logger.debug("Exception: " + str(e.message))
88 except Exception, e:
89 self.logger.error("Problem With " + filename)
90 self.logger.error("Exception: " + e.message)
9180
92 def removeFile(self, filename):81 def removeFile(self, filename):
93 """82 """
@@ -105,7 +94,7 @@
105 thumb = os.path.join(self.config.IMAGE_THUMB_DIR, name)94 thumb = os.path.join(self.config.IMAGE_THUMB_DIR, name)
106 try:95 try:
107 os.remove(thumb)96 os.remove(thumb)
108 except:97 except OSError:
109 self.logger.error("Couldn't remove thumbnail: " + thumb)98 self.logger.error("Couldn't remove thumbnail: " + thumb)
110 self.db_cursor.execute("""DELETE99 self.db_cursor.execute("""DELETE
111 FROM image100 FROM image
@@ -118,8 +107,6 @@
118 if self.isFileInCache(filename):107 if self.isFileInCache(filename):
119 self.removeFile(filename)108 self.removeFile(filename)
120 self.addFile(filename)109 self.addFile(filename)
121 #FIXME: This is maybe too expensive method for this purpose!
122 # Try to optimise it.
123110
124 def addDirectory(self, path):111 def addDirectory(self, path):
125 """112 """
@@ -153,10 +140,7 @@
153 WHERE filename LIKE '""" + path + "%'")140 WHERE filename LIKE '""" + path + "%'")
154 for row in self.db_cursor:141 for row in self.db_cursor:
155 thumb_file = row[0] + ".jpg"142 thumb_file = row[0] + ".jpg"
156 try:143 os.remove(os.path.join(self.config.IMAGE_THUMB_DIR, thumb_file))
157 os.remove(os.path.join(self.config.IMAGE_THUMB_DIR, thumb_file))
158 except:
159 pass
160144
161 # Remove folder thumbnails145 # Remove folder thumbnails
162 self.db_cursor.execute("""SELECT hash146 self.db_cursor.execute("""SELECT hash
@@ -164,10 +148,7 @@
164 WHERE path LIKE '""" + path + "%'")148 WHERE path LIKE '""" + path + "%'")
165 for row in self.db_cursor:149 for row in self.db_cursor:
166 thumb_file = row[0] + ".jpg"150 thumb_file = row[0] + ".jpg"
167 try:151 os.remove(os.path.join(self.config.IMAGE_THUMB_DIR, thumb_file))
168 os.remove(os.path.join(self.config.IMAGE_THUMB_DIR, thumb_file))
169 except:
170 pass
171152
172 # Clean cache database153 # Clean cache database
173 self.db_cursor.execute(154 self.db_cursor.execute(
@@ -182,7 +163,6 @@
182 """163 """
183 self.removeDirectory(path)164 self.removeDirectory(path)
184 self.addDirectory(path)165 self.addDirectory(path)
185 #FIXME: This is very expensive method to call! Try to optimise it.
186166
187 def isFileInCache(self, filename):167 def isFileInCache(self, filename):
188 """Check if file is already in cache. Returns boolean value."""168 """Check if file is already in cache. Returns boolean value."""
@@ -260,19 +240,17 @@
260 inf_f = open(album_info)240 inf_f = open(album_info)
261 a_title = inf_f.readline()[6:]241 a_title = inf_f.readline()[6:]
262 a_description = inf_f.readline()[12:]242 a_description = inf_f.readline()[12:]
263 except:243 except IOError:
264 a_title = path[path.rfind('/')+1:].replace('_',' ').title()244 a_title = path[path.rfind('/')+1:].replace('_',' ').title()
265 a_description = ""245 a_description = ""
266 else:246 else:
267 a_title = path[path.rfind('/')+1:].replace('_',' ').title()247 a_title = path[path.rfind('/')+1:].replace('_',' ').title()
268 a_description = ""248 a_description = ""
269249
270 #FIXME: If not found we could generate fancy album thumb
271 if os.path.exists(album_thumb):250 if os.path.exists(album_thumb):
272 thumbnailer = ImageThumbnailer(album_thumb)251 thumbnailer = ImageThumbnailer(album_thumb)
273 thumbnailer.create_thumbnail()252 thumbnailer.create_thumbnail()
274 a_hash = thumbnailer.get_hash()253 a_hash = thumbnailer.get_hash()
275 del thumbnailer #FIXME: Does this make any sense?
276 else:254 else:
277 a_hash = ""255 a_hash = ""
278256
@@ -302,13 +280,10 @@
302 str(tmp.day), str(tmp.hour) + ":" + str(tmp.minute) + ":" +280 str(tmp.day), str(tmp.hour) + ":" + str(tmp.minute) + ":" +
303 str(tmp.second)]281 str(tmp.second)]
304282
305 try:283 # Generate name from filename
306 title, description = self._readMetadataFile(filename)284 tmp = filename[filename.rfind('/') + 1 : filename.rfind('.')]
307 except:285 title = tmp.replace('_',' ').title() # Make title more attractive
308 # Generate name from filename286 description = "" # No description for this image file
309 tmp = filename[filename.rfind('/') + 1 : filename.rfind('.')]
310 title = tmp.replace('_',' ').title() # Make title more attractive
311 description = "" # No description for this image file
312287
313 im = Image.open(filename)288 im = Image.open(filename)
314 width, height = im.size289 width, height = im.size
@@ -346,27 +321,3 @@
346 VALUES(?,?,?,?,?,?,?,?,?,?)""", db_row)321 VALUES(?,?,?,?,?,?,?,?,?,?)""", db_row)
347 self.db_conn.commit()322 self.db_conn.commit()
348323
349 def _readMetadataFile(self, filename):
350 """
351 Reads image title and description from explicite metadata file if
352 the file exists. If file doesn't exist, this method throws an
353 exception, which indicates to the caller that metadata should be
354 received from some place else.
355 """
356 # Generate metadata filename
357 abs_path = filename[:filename.rfind('/') + 1] # Cut filename off
358 img_file = filename[filename.rfind('/') + 1:] # Cut path off
359 metadata_file = abs_path + "." + img_file[:img_file.rfind('.')] + \
360 ".info"
361
362 if os.path.exists(metadata_file):
363 try:
364 info_file = open(metadata_file)
365 title = info_file.readline()[6:]
366 description = info_file.readline()[12:]
367 return title, description
368 except:
369 raise Exception("Couldn't read existing metadata file.")
370 else:
371 raise Exception("Metadata file doesn't exist.")
372
373324
=== modified file 'entertainerlib/backend/components/mediacache/music_cache.py'
--- entertainerlib/backend/components/mediacache/music_cache.py 2009-02-06 08:13:48 +0000
+++ entertainerlib/backend/components/mediacache/music_cache.py 2009-02-07 21:43:35 +0000
@@ -55,34 +55,20 @@
55 """55 """
56 covers = os.listdir(self.config.ALBUM_ART_DIR)56 covers = os.listdir(self.config.ALBUM_ART_DIR)
57 for element in covers:57 for element in covers:
58 try:58 os.remove(os.path.join(self.config.ALBUM_ART_DIR, element))
59 os.remove(os.path.join(self.config.ALBUM_ART_DIR, element))59
60 except:60 os.remove(self.config.MUSIC_DB)
61 pass61 self.__createMusicCacheDatabase()
62 try:
63 os.remove(self.config.MUSIC_DB)
64 self.__createMusicCacheDatabase()
65 except:
66 raise IOError("Couldn't clear music cache")
6762
68 def addFile(self, filename):63 def addFile(self, filename):
69 """Add audio file to the cache."""64 """Add audio file to the cache."""
70 try:65 filename = filename.encode('utf8')
71 filename = filename.encode('utf8')66 if (not self.isFileInCache(filename) and
72 if (not self.isFileInCache(filename) and67 self.isSupportedFormat(filename)):
73 self.isSupportedFormat(filename)):68 if self.__getFileExtension(filename) == "mp3":
74 try:69 self.__addMP3file(filename)
75 if self.__getFileExtension(filename) == "mp3":70 elif self.__getFileExtension(filename) == "ogg":
76 self.__addMP3file(filename)71 self.__addOGGfile(filename)
77 elif self.__getFileExtension(filename) == "ogg":
78 self.__addOGGfile(filename)
79 except Exception, e:
80 self.logger.error("Couldn't cache file: " + filename)
81 self.logger.debug("Exception: " + e.message)
82 except Exception, e:
83 self.logger.error("Problem With " + filename)
84 self.logger.error("Exception: " + e.message)
85
8672
87 def removeFile(self, filename):73 def removeFile(self, filename):
88 """Remove audio file from the cache."""74 """Remove audio file from the cache."""
@@ -111,7 +97,7 @@
111 try:97 try:
112 os.remove(os.path.join(self.config.ALBUM_ART_DIR,98 os.remove(os.path.join(self.config.ALBUM_ART_DIR,
113 albumart_file))99 albumart_file))
114 except:100 except OSError:
115 self.logger.error("Couldn't remove albumart: " +101 self.logger.error("Couldn't remove albumart: " +
116 os.path.join(self.config.ALBUM_ART_DIR, albumart_file))102 os.path.join(self.config.ALBUM_ART_DIR, albumart_file))
117103
@@ -181,7 +167,7 @@
181 try:167 try:
182 os.remove(os.path.join(self.config.ALBUM_ART_DIR,168 os.remove(os.path.join(self.config.ALBUM_ART_DIR,
183 albumart_file))169 albumart_file))
184 except:170 except OSError:
185 self.logger.error(171 self.logger.error(
186 "Couldn't remove albumart: " +172 "Couldn't remove albumart: " +
187 os.path.join(self.config.ALBUM_ART_DIR, albumart_file))173 os.path.join(self.config.ALBUM_ART_DIR, albumart_file))
@@ -264,12 +250,8 @@
264 - Get tags250 - Get tags
265 - Insert data to the music cache database251 - Insert data to the music cache database
266 """252 """
267 try:253 mp3_file = eyeD3.Mp3AudioFile(filename, eyeD3.ID3_ANY_VERSION)
268 mp3_file = eyeD3.Mp3AudioFile(filename, eyeD3.ID3_ANY_VERSION)254 tags = mp3_file.getTag()
269 tags = mp3_file.getTag()
270 except:
271 self.logger.error("Couldn't read ID3tags: " + filename)
272 return
273255
274 if tags is None:256 if tags is None:
275 self.logger.error("Couldn't read ID3tags: " + filename)257 self.logger.error("Couldn't read ID3tags: " + filename)
@@ -297,11 +279,8 @@
297 title = self.__DEFAULT['title']279 title = self.__DEFAULT['title']
298280
299 # Get track genre281 # Get track genre
300 try:282 genre = str(tags.getGenre())
301 genre = str(tags.getGenre())283 if genre is None or len(genre) == 0:
302 if genre is None or len(genre) == 0:
303 genre = self.__DEFAULT['genre']
304 except:
305 genre = self.__DEFAULT['genre']284 genre = self.__DEFAULT['genre']
306285
307 # Get track number286 # Get track number
@@ -357,12 +336,8 @@
357 - Get tags336 - Get tags
358 - Insert data to the music cache database337 - Insert data to the music cache database
359 """338 """
360 try:339 ogg_file = ogg.vorbis.VorbisFile(filename)
361 ogg_file = ogg.vorbis.VorbisFile(filename)340 info = ogg_file.comment().as_dict()
362 info = ogg_file.comment().as_dict()
363 except:
364 self.logger.error("Couldn't index file: " + filename)
365 return
366341
367 # Get length342 # Get length
368 length = round(ogg_file.time_total(-1))343 length = round(ogg_file.time_total(-1))
369344
=== modified file 'entertainerlib/backend/components/mediacache/video_cache.py'
--- entertainerlib/backend/components/mediacache/video_cache.py 2009-02-06 08:13:48 +0000
+++ entertainerlib/backend/components/mediacache/video_cache.py 2009-02-08 08:44:46 +0000
@@ -49,34 +49,19 @@
49 covers = os.listdir(self.config.MOVIE_ART_DIR)49 covers = os.listdir(self.config.MOVIE_ART_DIR)
50 for element in covers:50 for element in covers:
51 if element[-3:] == "jpg":51 if element[-3:] == "jpg":
52 try:52 os.remove(os.path.join(self.config.MOVIE_ART_DIR, element))
53 os.remove(os.path.join(self.config.MOVIE_ART_DIR, element))
54 except:
55 self.logger.error(
56 "Media manager couldn't remove movie cover.")
5753
58 try:54 os.remove(self.config.VIDEO_DB)
59 os.remove(self.config.VIDEO_DB)
60 except:
61 pass
62 self.__createVideoCacheDatabase()55 self.__createVideoCacheDatabase()
6356
64 def addFile(self, filename):57 def addFile(self, filename):
65 """58 """
66 This method adds a new file to the cache.59 This method adds a new file to the cache.
67 """60 """
68 try:61 filename = filename.encode('utf8')
69 filename = filename.encode('utf8')62 if not self.isFileInCache(filename) and \
70 if not self.isFileInCache(filename) and \63 self.isSupportedFormat(filename):
71 self.isSupportedFormat(filename):64 self._addVideoFile(filename)
72 try:
73 self._addVideoFile(filename)
74 except Exception, e:
75 self.logger.error("Couldn't cache file: " + filename)
76 self.logger.debug("Exception: " + e.message)
77 except Exception, e:
78 self.logger.error("Problem With " + filename)
79 self.logger.error("Exception: " + e.message)
8065
81 def removeFile(self, filename):66 def removeFile(self, filename):
82 """67 """
@@ -116,15 +101,9 @@
116101
117 # Remove thumbnail and cover art102 # Remove thumbnail and cover art
118 if os.path.exists(art) and not self.__hasSeriesEpisodes(series):103 if os.path.exists(art) and not self.__hasSeriesEpisodes(series):
119 try:104 os.remove(art)
120 os.remove(art)
121 except:
122 self.logger.error("Couldn't remove movie art" + art)
123 if os.path.exists(thumb):105 if os.path.exists(thumb):
124 try:106 os.remove(thumb)
125 os.remove(thumb)
126 except:
127 self.logger.error("Couldn't remove thumbnail" + thumb)
128107
129 def updateFile(self, filename):108 def updateFile(self, filename):
130 """109 """
@@ -255,17 +234,11 @@
255 def _addVideoFile(self, filename):234 def _addVideoFile(self, filename):
256 """Add video file to the video cache."""235 """Add video file to the video cache."""
257 # Generate thumbnail236 # Generate thumbnail
258 try:237 thumbnailer = VideoThumbnailer(filename)
259 thumbnailer = VideoThumbnailer(filename)238 thumbnailer.create_thumbnail()
260 thumbnailer.create_thumbnail()239 thash = thumbnailer.get_hash()
261 thash = thumbnailer.get_hash()240 del thumbnailer
262 del thumbnailer
263 except Exception, e:
264 thash = None
265 self.logger.error("Problem Creating Thumbnail: " + filename)
266 self.logger.debug("Exception: " + e.message)
267241
268 #FIXME: read resolution, length etc. from video file and add to db
269 self.__db_cursor.execute("""INSERT INTO videofile(filename, hash)242 self.__db_cursor.execute("""INSERT INTO videofile(filename, hash)
270 VALUES (:fn, :hash)""",243 VALUES (:fn, :hash)""",
271 { 'fn': filename, 'hash': thash, } )244 { 'fn': filename, 'hash': thash, } )
@@ -279,11 +252,7 @@
279 def __searchMetadata(self, filename):252 def __searchMetadata(self, filename):
280 """Search metadata for video file from the Internet."""253 """Search metadata for video file from the Internet."""
281 search_thread = None254 search_thread = None
282 try:255 search_thread = VideoMetadataSearch(filename)
283 search_thread = VideoMetadataSearch(filename)
284 except:
285 self.logger.error(
286 "Invalid TV-Series episode filename detected: " + filename)
287256
288 if search_thread is not None:257 if search_thread is not None:
289 search_thread.start()258 search_thread.start()
290259
=== modified file 'entertainerlib/backend/components/mediacache/video_metadata_search.py'
--- entertainerlib/backend/components/mediacache/video_metadata_search.py 2008-12-07 20:41:05 +0000
+++ entertainerlib/backend/components/mediacache/video_metadata_search.py 2009-02-07 22:12:25 +0000
@@ -102,11 +102,7 @@
102 Search metadata from IMDB and update video cache database.102 Search metadata from IMDB and update video cache database.
103 """103 """
104 search_results = []104 search_results = []
105 try:105 search_results = self.IMDb.search_movie(self.title)
106 search_results = self.IMDb.search_movie(self.title)
107 except:
108 self.logger.error("IMDB search failed")
109 return # Network error or too many results to handle
110106
111 if len(search_results) == 0:107 if len(search_results) == 0:
112 return # No matches for this search108 return # No matches for this search
@@ -114,69 +110,42 @@
114 if search_results[0]['kind'] == "movie":110 if search_results[0]['kind'] == "movie":
115 # We trust that the first search result is the best111 # We trust that the first search result is the best
116 movie = search_results[0]112 movie = search_results[0]
117 try:113 self.IMDb.update(movie)
118 self.IMDb.update(movie)
119 except:
120 self.logger.error(
121 "Metadata search failed for: " + self.filename)
122 return
123114
124 video_type = "MOVIE"115 video_type = "MOVIE"
125 try:116 title = movie['title']
126 title = movie['title']117 year = movie['year']
127 year = movie['year']118 # convert to 5-stars rating
128 # convert to 5-stars rating119 rating = round(float(movie['rating']) / 2)
129 rating = round(float(movie['rating']) / 2)120
130121 genres = ','.join(movie['genres'])
131 genres = ','.join(movie['genres'])122 plot_outline = movie['plot outline']
132 try:123
133 plot_outline = movie['plot outline']124 plot_string = movie['plot'][0]
134 except:125 plot = plot_string[plot_string.rfind("::")+2:].lstrip()
135 plot_outline = ""126
136127 # IMDb returns sometimes list and sometimes string
137 try:128 if(type(plot)) is list:
138 plot_string = movie['plot'][0]129 plot = plot[0]
139 plot = plot_string[plot_string.rfind("::")+2:].lstrip()130 if(type(plot_outline)) is list:
140 except:131 plot_outline = plot_outline[0]
141 plot = _("Plot not available")132
142133 runtime = movie['runtime'][0]
143 # IMDb returns sometimes list and sometimes string134 int(runtime) # Raises exception if not integer
144 if(type(plot)) is list:135 p = self._get_persons(movie)
145 plot = plot[0]136 row = (video_type, title, "", runtime, genres, rating,
146 if(type(plot_outline)) is list:137 year, plot_outline, plot, 0, 0, p[0], p[1], p[2],
147 plot_outline = plot_outline[0]138 p[3], p[4], p[5], p[6], p[7], p[8], self.filename)
148139 self._update_video_cache(row)
149 try:140
150 runtime = movie['runtime'][0]141 # Download and save cover art
151 int(runtime) # Raises exception if not integer142 self._download_cover_art(movie['cover url'], title)
152 except:
153 runtime = 0
154 p = self._get_persons(movie)
155 row = (video_type, title, "", runtime, genres, rating,
156 year, plot_outline, plot, 0, 0, p[0], p[1], p[2],
157 p[3], p[4], p[5], p[6], p[7], p[8], self.filename)
158 self._update_video_cache(row)
159
160 # Download and save cover art
161 try:
162 self._download_cover_art(movie['cover url'], title)
163 except:
164 pass
165 except:
166 self.logger.error("Couldn't find metadata from IMDB for: " +
167 self.filename)
168 return
169143
170 elif search_results[0]['kind'] == "tv series":144 elif search_results[0]['kind'] == "tv series":
171 series = search_results[0]145 series = search_results[0]
172 # We trust that the first search result is the best146 # We trust that the first search result is the best
173 try:147 self.IMDb.update(series)
174 self.IMDb.update(series)148 self.IMDb.update(series, "episodes")
175 self.IMDb.update(series, "episodes")
176 except:
177 self.logger.error("Couldn't find metadata from IMDB for: " +
178 self.filename)
179 return
180149
181 video_type = "TV-SERIES"150 video_type = "TV-SERIES"
182 p = self._get_persons(series)151 p = self._get_persons(series)
@@ -186,34 +155,19 @@
186155
187 series_title = series['title']156 series_title = series['title']
188 genres = ','.join(series['genres'])157 genres = ','.join(series['genres'])
189 try:158 time = series['runtime']
190 time = series['runtime']159 runtime = time[0][:time[0].find(":")]
191 runtime = time[0][:time[0].find(":")]160 int(runtime) # This raises exception if runtime is not integer
192 int(runtime) # This raises exception if runtime is not integer161 year = series['series years']
193 except:162 title = series['episodes'][self.season][self.episode]['title']
194 runtime = 0163 plot = series['episodes'][self.season][self.episode]['plot']
195 try:
196 year = series['series years']
197 except:
198 year = series['year']
199 try:
200 title = series['episodes'][self.season][self.episode]['title']
201 except:
202 title = _("%(episode)d. Episode") % {'episode': self.episode}
203 try:
204 plot = series['episodes'][self.season][self.episode]['plot']
205 except:
206 plot = _("No plot outline available")
207 row = (video_type, title, series_title, runtime, genres, rating, \164 row = (video_type, title, series_title, runtime, genres, rating, \
208 year, "", plot, self.season, self.episode, p[0], p[1], \165 year, "", plot, self.season, self.episode, p[0], p[1], \
209 p[2], p[3], p[4], p[5] ,p[6], p[7], p[8], self.filename)166 p[2], p[3], p[4], p[5] ,p[6], p[7], p[8], self.filename)
210 self._update_video_cache(row)167 self._update_video_cache(row)
211168
212 # Download and save cover art169 # Download and save cover art
213 try:170 self._download_cover_art(series['cover url'], series_title)
214 self._download_cover_art(series['cover url'], series_title)
215 except:
216 pass
217 else:171 else:
218 # This file wasn't identified to be a movie or a TV-series episode.172 # This file wasn't identified to be a movie or a TV-series episode.
219 return173 return
@@ -224,36 +178,32 @@
224 @param db_row: List that contains all information we want to store into178 @param db_row: List that contains all information we want to store into
225 cache179 cache
226 """180 """
227 try:181 db_conn = sqlite.connect(self.config.VIDEO_DB)
228 db_conn = sqlite.connect(self.config.VIDEO_DB)182 db_cursor = db_conn.cursor()
229 db_cursor = db_conn.cursor()183 db_cursor.execute("""UPDATE metadata
230 db_cursor.execute("""UPDATE metadata184 SET type=?,
231 SET type=?,185 title=?,
232 title=?,186 series_title=?,
233 series_title=?,187 runtime=?,
234 runtime=?,188 genres=?,
235 genres=?,189 rating=?,
236 rating=?,190 year=?,
237 year=?,191 plot_outline=?,
238 plot_outline=?,192 plot=?,
239 plot=?,193 season=?,
240 season=?,194 episode=?,
241 episode=?,195 actor_1=?,
242 actor_1=?,196 actor_2=?,
243 actor_2=?,197 actor_3=?,
244 actor_3=?,198 actor_4=?,
245 actor_4=?,199 actor_5=?,
246 actor_5=?,200 writer_1=?,
247 writer_1=?,201 writer_2=?,
248 writer_2=?,202 director_1=?,
249 director_1=?,203 director_2=?
250 director_2=?204 WHERE filename=?""", db_row)
251 WHERE filename=?""", db_row)205 db_conn.commit()
252 db_conn.commit()206 db_conn.close()
253 db_conn.close()
254 except Exception, e:
255 self.logger.error("Exception occured during video cache update: " +
256 e.message)
257207
258208
259 def _get_persons(self, movie):209 def _get_persons(self, movie):
@@ -263,42 +213,15 @@
263 @param movie: Movie name213 @param movie: Movie name
264 @return: List of strings containing actors, directors and writers214 @return: List of strings containing actors, directors and writers
265 """215 """
266 try:216 a1 = movie['actors'][0]['name']
267 a1 = movie['actors'][0]['name']217 a2 = movie['actors'][1]['name']
268 except:218 a3 = movie['actors'][2]['name']
269 a1 = ""219 a4 = movie['actors'][3]['name']
270 try:220 a5 = movie['actors'][4]['name']
271 a2 = movie['actors'][1]['name']221 w1 = movie['writer'][0]['name']
272 except:222 w2 = movie['writer'][1]['name']
273 a2 = ""223 d1 = movie['director'][0]['name']
274 try:224 d2 = movie['director'][1]['name']
275 a3 = movie['actors'][2]['name']
276 except:
277 a3 = ""
278 try:
279 a4 = movie['actors'][3]['name']
280 except:
281 a4 = ""
282 try:
283 a5 = movie['actors'][4]['name']
284 except:
285 a5 = ""
286 try:
287 w1 = movie['writer'][0]['name']
288 except:
289 w1 = ""
290 try:
291 w2 = movie['writer'][1]['name']
292 except:
293 w2 = ""
294 try:
295 d1 = movie['director'][0]['name']
296 except:
297 d1 = ""
298 try:
299 d2 = movie['director'][1]['name']
300 except:
301 d2 = ""
302225
303 return [a1, a2, a3, a4, a5, w1, w2, d1, d2]226 return [a1, a2, a3, a4, a5, w1, w2, d1, d2]
304227
@@ -311,10 +234,7 @@
311 # Check if we have cover art for this series or movie already234 # Check if we have cover art for this series or movie already
312 if not os.path.exists(235 if not os.path.exists(
313 os.path.join(self.config.MOVIE_ART_DIR, title + ".jpg")):236 os.path.join(self.config.MOVIE_ART_DIR, title + ".jpg")):
314 try:237 image = urllib.urlopen(url)
315 image = urllib.urlopen(url)
316 except:
317 return
318 dest = open(os.path.join(238 dest = open(os.path.join(
319 self.config.MOVIE_ART_DIR, title + ".jpg"), 'w')239 self.config.MOVIE_ART_DIR, title + ".jpg"), 'w')
320 dest.write(image.read())240 dest.write(image.read())
321241
=== modified file 'entertainerlib/backend/core/client_connection.py'
--- entertainerlib/backend/core/client_connection.py 2008-08-16 04:28:47 +0000
+++ entertainerlib/backend/core/client_connection.py 2009-02-07 21:43:35 +0000
@@ -52,11 +52,7 @@
52 # Receive dictionary52 # Receive dictionary
53 dict_str = self.client.readline()53 dict_str = self.client.readline()
54 dictionary = None54 dictionary = None
55 try:55 dictionary = cPickle.loads(dict_str[:-1])
56 dictionary = cPickle.loads(dict_str[:-1])
57 except:
58 self.logger.error(
59 'Client sent malformed message dict to the backend!')
6056
61 # This client to the message bus if desired57 # This client to the message bus if desired
62 if dictionary != None and len(dictionary) > 0:58 if dictionary != None and len(dictionary) > 0:
@@ -87,10 +83,6 @@
87 @param message: Received Message object83 @param message: Received Message object
88 """84 """
89 message_str = cPickle.dumps(message, cPickle.HIGHEST_PROTOCOL)85 message_str = cPickle.dumps(message, cPickle.HIGHEST_PROTOCOL)
90 try:86 self.client_out.sendall(message_str)
91 self.client_out.sendall(message_str)87 self.client_out.sendall("\nEND_OF_MESSAGE_OBJECT\n")
92 self.client_out.sendall("\nEND_OF_MESSAGE_OBJECT\n")
93 except:
94 self.logger.error(
95 "Socket broken! Client didn't receive a message.")
9688
9789
=== modified file 'entertainerlib/frontend/frontend_client.py'
--- entertainerlib/frontend/frontend_client.py 2009-02-07 19:47:17 +0000
+++ entertainerlib/frontend/frontend_client.py 2009-02-07 22:12:25 +0000
@@ -60,24 +60,14 @@
6060
61 def initialize_backend_connection(self):61 def initialize_backend_connection(self):
62 '''Connect to the backend server.'''62 '''Connect to the backend server.'''
63 try:63 backend_connection = BackendConnection()
64 backend_connection = BackendConnection()64 self.logger.debug('Connected to the Entertainer backend server.')
65 self.logger.debug('Connected to the Entertainer backend server.')
66 except:
67 print 'Couldn\'t connect to the backend server. Execution aborted!'
68 print 'Make sure that Entertainer backend server is up and running.'
69 sys.exit(1)
7065
71 return backend_connection66 return backend_connection
7267
73 def quit_frontend(self):68 def quit_frontend(self):
74 '''Clean up the connection to the backend then close the frontend.'''69 '''Clean up the connection to the backend then close the frontend.'''
75 try:70 self.backend_connection.close_connection()
76 self.backend_connection.close_connection()
77 except Exception, e:
78 print 'Error closing Backend Connection:', e.message
79 print 'Closing anyway'
80 sys.exit(0)
8171
82 gtk.main_quit()72 gtk.main_quit()
83 sys.exit(0)73 sys.exit(0)
8474
=== modified file 'entertainerlib/frontend/gui/screens/audio_play.py'
--- entertainerlib/frontend/gui/screens/audio_play.py 2009-02-06 08:33:50 +0000
+++ entertainerlib/frontend/gui/screens/audio_play.py 2009-02-08 07:01:25 +0000
@@ -1,4 +1,5 @@
1'''AudioPlay - Screen displays information of currently playing audio'''1'''AudioPlay - Screen displays information of currently playing audio'''
2# pylint: disable-msg=W0221
23
3__licence__ = "GPLv2"4__licence__ = "GPLv2"
4__copyright__ = "2007, Lauri Taimila"5__copyright__ = "2007, Lauri Taimila"
56
=== modified file 'entertainerlib/frontend/gui/screens/disc.py'
--- entertainerlib/frontend/gui/screens/disc.py 2009-02-03 23:37:57 +0000
+++ entertainerlib/frontend/gui/screens/disc.py 2009-02-07 21:43:35 +0000
@@ -81,7 +81,6 @@
81 self._create_album_cover_texture(artist, title)81 self._create_album_cover_texture(artist, title)
82 self._create_list_indicator()82 self._create_list_indicator()
8383
84 # Check if artfile exists. If it doesn't let's make a search for it.
85 art_file = os.path.join(self.config.ALBUM_ART_DIR,84 art_file = os.path.join(self.config.ALBUM_ART_DIR,
86 artist + " - " + title + ".jpg")85 artist + " - " + title + ".jpg")
87 if artist != "Unknown artist" and not os.path.exists(art_file):86 if artist != "Unknown artist" and not os.path.exists(art_file):
@@ -89,7 +88,7 @@
89 self.config.ALBUM_ART_DIR, self._update_albumart)88 self.config.ALBUM_ART_DIR, self._update_albumart)
90 art_search.start()89 art_search.start()
9190
92 except: # No disc in drive91 except IndexError: # No disc in drive
93 no_disc = Label(0.05, "title", 0.5, 0.5, 92 no_disc = Label(0.05, "title", 0.5, 0.5,
94 _("No audio disc in drive"))93 _("No audio disc in drive"))
95 no_disc.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)94 no_disc.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
9695
=== modified file 'entertainerlib/frontend/gui/screens/photo.py'
--- entertainerlib/frontend/gui/screens/photo.py 2009-02-03 23:37:57 +0000
+++ entertainerlib/frontend/gui/screens/photo.py 2009-02-08 07:43:25 +0000
@@ -60,10 +60,8 @@
60 """60 """
61 Change current image. Display image from given index.61 Change current image. Display image from given index.
62 """62 """
63 try:63 if self.texture:
64 self.texture.destroy()64 self.texture.destroy()
65 except AttributeError:
66 pass # No previous texture in memory. No problem, let's continue
6765
68 # Create a new texture and display it66 # Create a new texture and display it
69 image = self.images[index]67 image = self.images[index]
7068
=== modified file 'entertainerlib/frontend/gui/screens/photo_albums.py'
--- entertainerlib/frontend/gui/screens/photo_albums.py 2009-02-03 23:37:57 +0000
+++ entertainerlib/frontend/gui/screens/photo_albums.py 2009-02-08 08:44:46 +0000
@@ -106,7 +106,7 @@
106 nro_of_photos = str(nro_of_photos)106 nro_of_photos = str(nro_of_photos)
107 item = TextMenuItem(0.4393, 0.0781, album.get_title(),107 item = TextMenuItem(0.4393, 0.0781, album.get_title(),
108 nro_of_photos)108 nro_of_photos)
109 item.set_userdata(album) #FIXME: Should we use URLs as KEYS?109 item.set_userdata(album)
110 self.menu.add_actor(item)110 self.menu.add_actor(item)
111111
112 self.add(self.menu)112 self.add(self.menu)
@@ -170,10 +170,7 @@
170 Update album preview. Display preview images from the current album.170 Update album preview. Display preview images from the current album.
171 @param album: Currently selected album in menu171 @param album: Currently selected album in menu
172 """172 """
173 try:173 gobject.source_remove(self.preview_fade)
174 gobject.source_remove(self.preview_fade)
175 except:
176 pass # If there is no image switcher enabled that's ok
177174
178 new = self._create_album_preview(album)175 new = self._create_album_preview(album)
179176
180177
=== modified file 'entertainerlib/frontend/gui/screens/tv_episodes.py'
--- entertainerlib/frontend/gui/screens/tv_episodes.py 2009-02-03 23:37:57 +0000
+++ entertainerlib/frontend/gui/screens/tv_episodes.py 2009-02-08 07:43:25 +0000
@@ -82,11 +82,8 @@
82 """82 """
83 Create a thumbnail texture. This is called as menu is scrolled83 Create a thumbnail texture. This is called as menu is scrolled
84 """84 """
85 try:85 if self.thumb:
86 self.thumb.hide()86 self.thumb.hide()
87 del self.thumb
88 except:
89 pass # No problem, this is just the first time we call this method
9087
91 # Thumbnail. Use cover art if thumbnail doesn't exist88 # Thumbnail. Use cover art if thumbnail doesn't exist
92 menu_item = self.episode_menu.get_current_menuitem()89 menu_item = self.episode_menu.get_current_menuitem()
9390
=== modified file 'entertainerlib/frontend/gui/screens/video_osd.py'
--- entertainerlib/frontend/gui/screens/video_osd.py 2009-02-03 23:37:57 +0000
+++ entertainerlib/frontend/gui/screens/video_osd.py 2009-02-08 08:44:46 +0000
@@ -212,8 +212,6 @@
212 if event_type == UserEvent.PLAYER_STOP:212 if event_type == UserEvent.PLAYER_STOP:
213 self.display_progress_bar(hide_after_delay=False)213 self.display_progress_bar(hide_after_delay=False)
214 self.pause_texture.hide()214 self.pause_texture.hide()
215 #FIXME
216 print "CREATE VIDEO STOPPED SCREEN HERE"
217215
218 # Video aspect ratio changed. Display aspect ratio logo on screen216 # Video aspect ratio changed. Display aspect ratio logo on screen
219 elif event_type == UserEvent.USE_ASPECT_RATIO_1:217 elif event_type == UserEvent.USE_ASPECT_RATIO_1:
220218
=== modified file 'entertainerlib/frontend/gui/widgets/grid_menu.py'
--- entertainerlib/frontend/gui/widgets/grid_menu.py 2009-02-06 08:13:48 +0000
+++ entertainerlib/frontend/gui/widgets/grid_menu.py 2009-02-08 08:44:46 +0000
@@ -202,14 +202,12 @@
202 """202 """
203 Override clutter.Group method. Returns number of menuitems.203 Override clutter.Group method. Returns number of menuitems.
204 """204 """
205 #FIXME: Is this safe?
206 return len(self.items)205 return len(self.items)
207206
208 def get_nth_child(self, index):207 def get_nth_child(self, index):
209 """208 """
210 Override clutter.Group method. Returns one menuitem.209 Override clutter.Group method. Returns one menuitem.
211 """210 """
212 #FIXME: Is this safe?
213 return self.items[index]211 return self.items[index]
214212
215 def get_number_of_items(self):213 def get_number_of_items(self):
@@ -522,7 +520,6 @@
522 # BELOW IS ANIMATION CODE FOR MENU CURSOR. SHOULD CURSOR BE ANIMATED?520 # BELOW IS ANIMATION CODE FOR MENU CURSOR. SHOULD CURSOR BE ANIMATED?
523# if self.animate:521# if self.animate:
524# # Finish previous animation before new522# # Finish previous animation before new
525# # FIXME: Doesn't seem to work as it should
526# if self.cursor_timeline is not None and (523# if self.cursor_timeline is not None and (
527# self.cursor_timeline.is_playing():524# self.cursor_timeline.is_playing():
528# self.cursor_timeline.pause()525# self.cursor_timeline.pause()
@@ -585,7 +582,6 @@
585# y = self.itemgroup.get_y()582# y = self.itemgroup.get_y()
586#583#
587# # Finish previous animation before new584# # Finish previous animation before new
588# # FIXME: Doesn't seem to work as it should
589# if self.content_timeline is not None and (585# if self.content_timeline is not None and (
590# self.content_timeline.is_playing():586# self.content_timeline.is_playing():
591# self.content_timeline.pause()587# self.content_timeline.pause()
592588
=== modified file 'entertainerlib/frontend/gui/widgets/image_menu.py'
--- entertainerlib/frontend/gui/widgets/image_menu.py 2008-12-08 17:26:56 +0000
+++ entertainerlib/frontend/gui/widgets/image_menu.py 2009-02-08 07:43:25 +0000
@@ -62,7 +62,7 @@
62 This method is called when widget is set active or inactive. This62 This method is called when widget is set active or inactive. This
63 method allows widget to react this action.63 method allows widget to react this action.
64 """64 """
65 try:65 if len(self.items):
66 if self.active:66 if self.active:
67 self.cursor.show()67 self.cursor.show()
68 self.items[self.logical_position].set_active(True)68 self.items[self.logical_position].set_active(True)
@@ -71,8 +71,6 @@
71 self.cursor.hide()71 self.cursor.hide()
72 self.items[self.logical_position].set_active(False)72 self.items[self.logical_position].set_active(False)
73 self.set_opacity(128)73 self.set_opacity(128)
74 except:
75 pass # No items in menu
7674
77 def _scale_menuitem(self, menuitem):75 def _scale_menuitem(self, menuitem):
78 """76 """
7977
=== modified file 'entertainerlib/frontend/gui/widgets/menu.py'
--- entertainerlib/frontend/gui/widgets/menu.py 2008-11-19 21:50:24 +0000
+++ entertainerlib/frontend/gui/widgets/menu.py 2009-02-08 08:44:46 +0000
@@ -191,7 +191,6 @@
191 """191 """
192 # Set current menuitem192 # Set current menuitem
193 self.__items[self.__current].set_active(False)193 self.__items[self.__current].set_active(False)
194 #FIXME: What if there is not that many?
195 self.__current = self.__current + 8194 self.__current = self.__current + 8
196 self.__items[self.__current].set_active(True)195 self.__items[self.__current].set_active(True)
197196
198197
=== modified file 'entertainerlib/frontend/gui/widgets/text_menu.py'
--- entertainerlib/frontend/gui/widgets/text_menu.py 2008-11-05 17:38:30 +0000
+++ entertainerlib/frontend/gui/widgets/text_menu.py 2009-02-08 07:43:25 +0000
@@ -47,7 +47,7 @@
47 This method is called when widget is set active or inactive. This47 This method is called when widget is set active or inactive. This
48 method allows widget to react this action.48 method allows widget to react this action.
49 """49 """
50 try:50 if len(self.items):
51 if self.active:51 if self.active:
52 self.cursor.show()52 self.cursor.show()
53 self.items[self.logical_position].set_active(True)53 self.items[self.logical_position].set_active(True)
@@ -56,9 +56,7 @@
56 self.cursor.hide()56 self.cursor.hide()
57 self.items[self.logical_position].set_active(False)57 self.items[self.logical_position].set_active(False)
58 self.set_opacity(128)58 self.set_opacity(128)
59 except:59
60 pass # No items in menu
61
62 def get_index(self, text):60 def get_index(self, text):
63 """61 """
64 Returns index of label with the text as passed, returns -1 if not found62 Returns index of label with the text as passed, returns -1 if not found
6563
=== modified file 'entertainerlib/frontend/media_player.py'
--- entertainerlib/frontend/media_player.py 2009-01-08 15:38:26 +0000
+++ entertainerlib/frontend/media_player.py 2009-02-08 08:44:46 +0000
@@ -235,7 +235,6 @@
235 """235 """
236 if self.playlist is not None:236 if self.playlist is not None:
237 if self.shuffle:237 if self.shuffle:
238 # FIXME: Should we remember order of randomly played tracks
239 self.set_media(self.playlist.get_random(), True)238 self.set_media(self.playlist.get_random(), True)
240 elif self.playlist.has_previous():239 elif self.playlist.has_previous():
241 self.set_media(self.playlist.get_previous(), True)240 self.set_media(self.playlist.get_previous(), True)
242241
=== modified file 'entertainerlib/frontend/medialibrary/music.py'
--- entertainerlib/frontend/medialibrary/music.py 2009-02-07 17:12:21 +0000
+++ entertainerlib/frontend/medialibrary/music.py 2009-02-08 08:44:46 +0000
@@ -63,10 +63,7 @@
63 @return: CompactDisc63 @return: CompactDisc
64 """64 """
65 cdrom = DiscID.open()65 cdrom = DiscID.open()
66 try:66 disc_id = DiscID.disc_id(cdrom)
67 disc_id = DiscID.disc_id(cdrom)
68 except:
69 raise Exception("No media in drive.")
70 return CompactDisc(disc_id)67 return CompactDisc(disc_id)
7168
72 def get_playlists(self):69 def get_playlists(self):
@@ -265,7 +262,6 @@
265 self.title = title262 self.title = title
266 self.total_length = 0263 self.total_length = 0
267264
268 #FIXME: Album needs to be refactored to have no dependence on the db.
269 if not cursor:265 if not cursor:
270 self.db_connection = sqlite.connect(self.config.MUSIC_DB)266 self.db_connection = sqlite.connect(self.config.MUSIC_DB)
271 self.cursor = self.db_connection.cursor()267 self.cursor = self.db_connection.cursor()
@@ -282,7 +278,6 @@
282 self.tracks.append(Track(row[0], row[1], row[2], row[3], self,278 self.tracks.append(Track(row[0], row[1], row[2], row[3], self,
283 row[5], row[6], row[7], row[8], row[9],279 row[5], row[6], row[7], row[8], row[9],
284 row[10], row[11]))280 row[10], row[11]))
285 #self.artist = row[3] #FIXME: Should we set artist somewhere else?
286 self.total_length += int(row[9])281 self.total_length += int(row[9])
287 if len(self.tracks) == 0:282 if len(self.tracks) == 0:
288 raise AlbumHasNoTracks()283 raise AlbumHasNoTracks()
@@ -290,7 +285,6 @@
290285
291 def __str__(self):286 def __str__(self):
292 return self.title287 return self.title
293 #return '%s - %s' % (self.artist, self.title)
294288
295 def get_title(self):289 def get_title(self):
296 """290 """
@@ -447,8 +441,6 @@
447 Get album that contains this Track.441 Get album that contains this Track.
448 @return: Album object442 @return: Album object
449 """443 """
450 #FIXME: when Album constructor removes work-around, get_album needs to
451 # remove the default False and get the cursor from the media library
452 if not isinstance(self.album, Album):444 if not isinstance(self.album, Album):
453 album = Album(self.album, cursor)445 album = Album(self.album, cursor)
454 self.album = album446 self.album = album
@@ -461,9 +453,6 @@
461 Get album art URL of this Track453 Get album art URL of this Track
462 @return: String (or None if there is no album art for this track)454 @return: String (or None if there is no album art for this track)
463 """455 """
464 #FIXME: when Album constructor removes work-around, get_album_art_url
465 # needs to remove the default False and get the cursor from the media
466 # library
467 self.get_album(cursor) # Need to have an album object456 self.get_album(cursor) # Need to have an album object
468457
469 if self.album.has_album_art():458 if self.album.has_album_art():
@@ -599,8 +588,6 @@
599588
600 query_info = CDDB.query(disc_id)[1]589 query_info = CDDB.query(disc_id)[1]
601590
602 # FIXME: query_info contains code that we could use instead of TRY
603 # EXCEPT
604 #See CDDB documentation for more information.591 #See CDDB documentation for more information.
605 #http://cddb-py.sourceforge.net/CDDB/README592 #http://cddb-py.sourceforge.net/CDDB/README
606593
@@ -629,7 +616,7 @@
629 track_title = read_info['TTITLE' + str(i)]616 track_title = read_info['TTITLE' + str(i)]
630 self.tracks.append(CompactDiscTrack(i + 1, track_title,617 self.tracks.append(CompactDiscTrack(i + 1, track_title,
631 length))618 length))
632 except:619 except TypeError:
633 query = query_info[0]620 query = query_info[0]
634 self.artist = query['title'][:query['title'].index(' / ')]621 self.artist = query['title'][:query['title'].index(' / ')]
635 self.album = query['title'][query['title'].index(' / ') + 3:]622 self.album = query['title'][query['title'].index(' / ') + 3:]
636623
=== modified file 'entertainerlib/tests/mock.py'
--- entertainerlib/tests/mock.py 2009-02-04 00:52:34 +0000
+++ entertainerlib/tests/mock.py 2009-02-08 07:01:25 +0000
@@ -268,7 +268,7 @@
268 if make_album:268 if make_album:
269 self.album = MockAlbum(make_track=False)269 self.album = MockAlbum(make_track=False)
270270
271 def get_album(self):271 def get_album(self, cursor=False):
272 '''See `Track.get_album`.'''272 '''See `Track.get_album`.'''
273 return self.album273 return self.album
274274
275275
=== modified file 'entertainerlib/tests/test_feedconfigtools.py'
--- entertainerlib/tests/test_feedconfigtools.py 2009-01-31 21:36:56 +0000
+++ entertainerlib/tests/test_feedconfigtools.py 2009-02-08 07:01:25 +0000
@@ -18,7 +18,7 @@
18class FeedConfigToolsTest(EntertainerTest):18class FeedConfigToolsTest(EntertainerTest):
19 '''Test for entertainerlib.utils.feed_utils FeedConfigTools'''19 '''Test for entertainerlib.utils.feed_utils FeedConfigTools'''
2020
21 def setUp(self, debug=False):21 def setUp(self):
22 """Sets up everything for the test"""22 """Sets up everything for the test"""
23 EntertainerTest.setUp(self)23 EntertainerTest.setUp(self)
2424
2525
=== modified file 'entertainerlib/tests/test_feedentryparser.py'
--- entertainerlib/tests/test_feedentryparser.py 2009-01-31 21:36:56 +0000
+++ entertainerlib/tests/test_feedentryparser.py 2009-02-08 07:01:25 +0000
@@ -7,18 +7,14 @@
77
8import unittest8import unittest
99
10from entertainerlib.utils.logger import Logger
11from entertainerlib.utils.feed_utils import FeedEntryParser10from entertainerlib.utils.feed_utils import FeedEntryParser
1211
12
13class FeedEntryParserTest(unittest.TestCase):13class FeedEntryParserTest(unittest.TestCase):
14 '''Test the FeedEntryParser'''14 '''Test the FeedEntryParser'''
1515
16 def setUp(self, debug=False):16 def setUp(self):
17 """Sets up everything for the test"""17 """Sets up everything for the test"""
18 self.debug = debug
19 if(self.debug):
20 self.logger = Logger('./tests.log').getLogger(
21 'FeedEntryParserTest')
2218
23 #test strings19 #test strings
24 self.testString001 = "<body><b>Hello World</body></b>"20 self.testString001 = "<body><b>Hello World</body></b>"
@@ -33,9 +29,6 @@
33 tags29 tags
34 """30 """
35 output = FeedEntryParser().strip_tags(self.testString001)31 output = FeedEntryParser().strip_tags(self.testString001)
36 if(self.debug):
37 self.logger.debug("EXPECTED: " + self.resultString001)
38 self.logger.debug("OUTPUT: " + output)
39 self.assertEqual(output, self.resultString001)32 self.assertEqual(output, self.resultString001)
4033
41 def testStripTags002(self):34 def testStripTags002(self):
@@ -43,9 +36,6 @@
43 non-default tags36 non-default tags
44 """37 """
45 output = FeedEntryParser().strip_tags(self.testString001, ["body"])38 output = FeedEntryParser().strip_tags(self.testString001, ["body"])
46 if(self.debug):
47 self.logger.debug("EXPECTED: " + self.resultString003)
48 self.logger.debug("OUTPUT: " + output)
49 self.assertEqual(output, self.resultString003)39 self.assertEqual(output, self.resultString003)
5040
51 def testStripNonPangoTags(self):41 def testStripNonPangoTags(self):
@@ -53,16 +43,10 @@
53 non-pango tags from input43 non-pango tags from input
54 """44 """
55 output = FeedEntryParser().strip_non_pango_tags(self.testString002)45 output = FeedEntryParser().strip_non_pango_tags(self.testString002)
56 if(self.debug):
57 self.logger.debug("EXPECTED: " + self.resultString002)
58 self.logger.debug("OUTPUT: " + output)
59 self.assertEqual(output, self.resultString002)46 self.assertEqual(output, self.resultString002)
6047
61 def testConvert(self):48 def testConvert(self):
62 """tests if FeedEntryParser converts input to correct output"""49 """tests if FeedEntryParser converts input to correct output"""
63 output = FeedEntryParser().convert(self.testString002)50 output = FeedEntryParser().convert(self.testString002)
64 if(self.debug):
65 self.logger.debug("EXPECTED: " + self.resultString004)
66 self.logger.debug("OUTPUT: " + output)
67 self.assertEqual(output, self.resultString004)51 self.assertEqual(output, self.resultString004)
6852
6953
=== modified file 'entertainerlib/tests/test_music.py'
--- entertainerlib/tests/test_music.py 2009-02-07 17:12:21 +0000
+++ entertainerlib/tests/test_music.py 2009-02-07 21:43:35 +0000
@@ -251,10 +251,7 @@
251251
252 def setUp(self):252 def setUp(self):
253 TestMusic.setUp(self)253 TestMusic.setUp(self)
254 try:254 self.backend_connection = MockBackendConnection()
255 self.backend_connection = MockBackendConnection()
256 except:
257 print "\nbackend_connection failed"
258 self.musiclibrary = MusicLibrary(self.backend_connection)255 self.musiclibrary = MusicLibrary(self.backend_connection)
259256
260 def tearDown(self):257 def tearDown(self):
261258
=== modified file 'entertainerlib/tests/test_opmlparser.py'
--- entertainerlib/tests/test_opmlparser.py 2009-01-31 21:36:56 +0000
+++ entertainerlib/tests/test_opmlparser.py 2009-02-08 07:01:25 +0000
@@ -9,19 +9,16 @@
9import os9import os
10import xml.parsers.expat10import xml.parsers.expat
1111
12from entertainerlib.utils.logger import Logger
13from entertainerlib.utils.feed_utils import OPMLParser12from entertainerlib.utils.feed_utils import OPMLParser
1413
15THIS_DIR = os.path.dirname(__file__)14THIS_DIR = os.path.dirname(__file__)
1615
16
17class OPMLParserTest(unittest.TestCase):17class OPMLParserTest(unittest.TestCase):
18 '''Test OPMLParser'''18 '''Test OPMLParser'''
1919
20 def setUp(self, debug=False):20 def setUp(self):
21 '''See unittest.TestCase'''21 '''See unittest.TestCase'''
22 self.debug = debug
23 if(self.debug):
24 self.logger = Logger('./tests.log').getLogger('OPMLParserTest')
2522
26 #set up lists and paths23 #set up lists and paths
27 self.testURL = "http://www.scripting.com/feeds/top100.opml"24 self.testURL = "http://www.scripting.com/feeds/top100.opml"
@@ -48,15 +45,10 @@
48 def testGetRssFeeds001(self):45 def testGetRssFeeds001(self):
49 """Check if OPMLParser can parse a normal file"""46 """Check if OPMLParser can parse a normal file"""
50 output = OPMLParser().get_rss_feeds(self.okFilePath)47 output = OPMLParser().get_rss_feeds(self.okFilePath)
51 if(self.debug):
52 self.logger.debug('Expecting the list : ' + str(self.feedList))
53 self.logger.debug('OUTPUT:' + str(output))
54 self.assertEqual(output, self.feedList)48 self.assertEqual(output, self.feedList)
5549
56 def testGetRssFeeds002(self):50 def testGetRssFeeds002(self):
57 """Check if OPMLParser can handle a non-existant file"""51 """Check if OPMLParser can handle a non-existant file"""
58 if(self.debug):
59 self.logger.debug('Expecting an IOError')
60 self.assertRaises(IOError, OPMLParser().get_rss_feeds,52 self.assertRaises(IOError, OPMLParser().get_rss_feeds,
61 self.badFilePath)53 self.badFilePath)
6254
@@ -69,35 +61,23 @@
69 links61 links
70 """62 """
71 output = OPMLParser().get_rss_feeds(self.insideFilePath)63 output = OPMLParser().get_rss_feeds(self.insideFilePath)
72 if(self.debug):
73 self.logger.debug('Expecting the list : ' + str(self.feedList))
74 self.logger.debug('OUTPUT: ' + str(output))
75 self.assertEqual(output, self.feedList)64 self.assertEqual(output, self.feedList)
7665
77 def testGetRssFeeds004(self):66 def testGetRssFeeds004(self):
78 """Check if OPMLParser can handle a file which is not an opml file or67 """Check if OPMLParser can handle a file which is not an opml file or
79 even an xml file68 even an xml file
80 """69 """
81 if(self.debug):
82 self.logger.debug('Expecting an ExpatError')
83 self.assertRaises(xml.parsers.expat.ExpatError,70 self.assertRaises(xml.parsers.expat.ExpatError,
84 OPMLParser().get_rss_feeds, self.notXMLFile)71 OPMLParser().get_rss_feeds, self.notXMLFile)
8572
86 def testGetRssFeeds005(self):73 def testGetRssFeeds005(self):
87 """Check if OPMLParser can handle a URL"""74 """Check if OPMLParser can handle a URL"""
88 output = OPMLParser().get_rss_feeds(self.testURL)75 output = OPMLParser().get_rss_feeds(self.testURL)
89 if(self.debug):
90 self.logger.debug('Expecting anything but []')
91 self.logger.debug('OUTPUT: ' + str(output))
92 self.assertTrue(output != [])76 self.assertTrue(output != [])
9377
94 def testGetLifereaOpml001(self):78 def testGetLifereaOpml001(self):
95 """Check if OPMLParser can pick the opml file for liferea"""79 """Check if OPMLParser can pick the opml file for liferea"""
96 output = OPMLParser().get_liferea_opml(self.singleLifereaFolder)80 output = OPMLParser().get_liferea_opml(self.singleLifereaFolder)
97 if(self.debug):
98 self.logger.debug('Expecting the string : ' +
99 self.singleLifereaFolder+"/.liferea/feedlist.opml")
100 self.logger.debug('OUTPUT: ' + output)
101 self.assertEqual(output,81 self.assertEqual(output,
102 self.singleLifereaFolder+"/.liferea/feedlist.opml")82 self.singleLifereaFolder+"/.liferea/feedlist.opml")
10383
@@ -106,10 +86,6 @@
106 of liferea out of a selection of folders86 of liferea out of a selection of folders
107 """87 """
108 output = OPMLParser().get_liferea_opml(self.multipleLifereaFolders)88 output = OPMLParser().get_liferea_opml(self.multipleLifereaFolders)
109 if(self.debug):
110 self.logger.debug('Expecting the string : ' +
111 self.multipleLifereaFolders+"/.liferea_1.4/feedlist.opml")
112 self.logger.debug('OUTPUT: ' + output)
113 self.assertEqual(output,89 self.assertEqual(output,
114 self.multipleLifereaFolders+"/.liferea_1.4/feedlist.opml")90 self.multipleLifereaFolders+"/.liferea_1.4/feedlist.opml")
11591
@@ -118,9 +94,6 @@
118 liferea opml folder94 liferea opml folder
119 """95 """
120 output = OPMLParser().get_liferea_opml(self.noLifereaFolder)96 output = OPMLParser().get_liferea_opml(self.noLifereaFolder)
121 if(self.debug):
122 self.logger.debug('Expecting an empty string')
123 self.logger.debug('OUTPUT: ' + output)
124 self.assertEqual(output, "")97 self.assertEqual(output, "")
12598
126 def testGetLifereaOpml004(self):99 def testGetLifereaOpml004(self):
@@ -128,8 +101,5 @@
128 liferea opml file101 liferea opml file
129 """102 """
130 output = OPMLParser().get_liferea_opml(self.noLifereaFile)103 output = OPMLParser().get_liferea_opml(self.noLifereaFile)
131 if(self.debug):
132 self.logger.debug('Expecting an empty string')
133 self.logger.debug('OUTPUT: ' + output)
134 self.assertEqual(output, "")104 self.assertEqual(output, "")
135105
136106
=== modified file 'entertainerlib/tests/test_weather.py'
--- entertainerlib/tests/test_weather.py 2009-02-07 17:49:58 +0000
+++ entertainerlib/tests/test_weather.py 2009-02-07 21:43:35 +0000
@@ -30,12 +30,9 @@
30 self.weather.set_location('Bath,England')30 self.weather.set_location('Bath,England')
31 self.weather.refresh()31 self.weather.refresh()
32 forecasts = self.weather.get_forecasts()32 forecasts = self.weather.get_forecasts()
33 try:33 today = forecasts[0]
34 today = forecasts[0]34 day = datetime.utcnow().strftime('%a')
35 day = datetime.utcnow().strftime('%a')35 self.assertEqual(str(today["Day"]), day)
36 self.assertEqual(str(today["Day"]), day)
37 except:
38 self.fail()
3936
40 def testWeatherSet(self):37 def testWeatherSet(self):
41 """Tests the setting of a forecast to a given state"""38 """Tests the setting of a forecast to a given state"""
4239
=== modified file 'entertainerlib/utils/albumart_downloader.py'
--- entertainerlib/utils/albumart_downloader.py 2009-01-04 23:22:07 +0000
+++ entertainerlib/utils/albumart_downloader.py 2009-02-07 21:43:35 +0000
@@ -238,8 +238,8 @@
238 return238 return
239239
240 try:240 try:
241 xmldoc = minidom.parseString (result_data)241 xmldoc = minidom.parseString(result_data)
242 except:242 except (TypeError, AttributeError):
243 self.search_next()243 self.search_next()
244 return244 return
245245
@@ -269,12 +269,7 @@
269 if len(image_urls) == 0:269 if len(image_urls) == 0:
270 return270 return
271 image_url = image_urls[0]271 image_url = image_urls[0]
272 # This doesn't check which result is the best match272 image_file = urllib.urlopen(image_url)
273 #image_url = result[0].ImageUrlLarge
274 try:
275 image_file = urllib.urlopen(image_url)
276 except:
277 return
278 # base64 encode artist and album so there can be a '/' in the artist273 # base64 encode artist and album so there can be a '/' in the artist
279 # or album274 # or album
280 artist_album = self.artist + " - " + self.album275 artist_album = self.artist + " - " + self.album
281276
=== modified file 'entertainerlib/utils/content_management_dialog.py'
--- entertainerlib/utils/content_management_dialog.py 2009-02-07 17:12:21 +0000
+++ entertainerlib/utils/content_management_dialog.py 2009-02-07 21:43:35 +0000
@@ -126,13 +126,10 @@
126126
127 def on_dialog_closed(self, widget):127 def on_dialog_closed(self, widget):
128 """Callback function for dialog's close button"""128 """Callback function for dialog's close button"""
129 try:129 proxy = MessageBusProxy(client_name = "Content Management GUI")
130 proxy = MessageBusProxy(client_name = "Content Management GUI")130 proxy.connectToMessageBus()
131 proxy.connectToMessageBus()131 proxy.sendMessage(Message(MessageType.CONTENT_CFG_UPDATED))
132 proxy.sendMessage(Message(MessageType.CONTENT_CFG_UPDATED))132 proxy.disconnectFromMessageBus()
133 proxy.disconnectFromMessageBus()
134 except:
135 pass # This means that backend is not running. Doesn't matter
136133
137 if(self.stand_alone):134 if(self.stand_alone):
138 self.dialog.hide()135 self.dialog.hide()
@@ -144,13 +141,10 @@
144141
145 def on_close_button_clicked(self, widget):142 def on_close_button_clicked(self, widget):
146 """Callback function for dialog's close button"""143 """Callback function for dialog's close button"""
147 try:144 proxy = MessageBusProxy(client_name = "Content Management GUI")
148 proxy = MessageBusProxy(client_name = "Content Management GUI")145 proxy.connectToMessageBus()
149 proxy.connectToMessageBus()146 proxy.sendMessage(Message(MessageType.CONTENT_CFG_UPDATED))
150 proxy.sendMessage(Message(MessageType.CONTENT_CFG_UPDATED))147 proxy.disconnectFromMessageBus()
151 proxy.disconnectFromMessageBus()
152 except:
153 pass # This means that backend is not running. Doesn't matter
154148
155 if(self.stand_alone):149 if(self.stand_alone):
156 self.dialog.hide()150 self.dialog.hide()
@@ -182,14 +176,11 @@
182 widget = self.widgets.get_widget("treeview_videos")176 widget = self.widgets.get_widget("treeview_videos")
183 model = widget.get_model()177 model = widget.get_model()
184 selection = widget.get_selection().get_selected()178 selection = widget.get_selection().get_selected()
185 try:179 rm_folder = model.get_value(selection[1], 0)
186 rm_folder = model.get_value(selection[1], 0)180 self.video_folders.remove(rm_folder)
187 self.video_folders.remove(rm_folder)181 str_folders = ";".join(self.video_folders)
188 str_folders = ";".join(self.video_folders)182 self.config.write_content_value("Videos", "folders", str_folders)
189 self.config.write_content_value("Videos", "folders", str_folders)183 model.remove(selection[1])
190 model.remove(selection[1])
191 except:
192 pass
193184
194 def on_button_edit_videos_clicked(self, widget):185 def on_button_edit_videos_clicked(self, widget):
195 """Edit currently selected folder"""186 """Edit currently selected folder"""
@@ -197,25 +188,21 @@
197 url_dialog = self.widgets.get_widget("url_dialog")188 url_dialog = self.widgets.get_widget("url_dialog")
198 url_entry = self.widgets.get_widget("url_entry")189 url_entry = self.widgets.get_widget("url_entry")
199 model = widget.get_model()190 model = widget.get_model()
200 try:191 selection = widget.get_selection().get_selected()
201 selection = widget.get_selection().get_selected()192 folder = model.get_value(selection[1], 0)
202 folder = model.get_value(selection[1], 0)193 url_entry.set_text(folder)
203 url_entry.set_text(folder)194 url_dialog.set_title(_("Edit URL"))
204 url_dialog.set_title(_("Edit URL"))195 status = url_dialog.run()
205 status = url_dialog.run()196 if status == gtk.RESPONSE_OK and os.path.exists(self.url):
206 if status == gtk.RESPONSE_OK and os.path.exists(self.url):197 # Update list model
207 # Update list model198 model.set_value(selection[1], 0, self.url)
208 model.set_value(selection[1], 0, self.url)199 # Update configure file
209 # Update configure file200 pos = self.video_folders.index(folder)
210 pos = self.video_folders.index(folder)201 self.video_folders.remove(folder)
211 self.video_folders.remove(folder)202 self.video_folders.insert(pos, self.url)
212 self.video_folders.insert(pos, self.url)203 str_folders = ";".join(self.video_folders)
213 str_folders = ";".join(self.video_folders)204 self.config.write_content_value("Videos", "folders",
214 self.config.write_content_value("Videos", "folders",205 str_folders)
215 str_folders)
216 except:
217 # No need for actions. Item wasn't selected.
218 pass
219206
220 def on_checkbutton_video_metadata_toggled(self, widget):207 def on_checkbutton_video_metadata_toggled(self, widget):
221 """208 """
@@ -250,40 +237,32 @@
250 widget = self.widgets.get_widget("treeview_music")237 widget = self.widgets.get_widget("treeview_music")
251 model = widget.get_model()238 model = widget.get_model()
252 selection = widget.get_selection().get_selected()239 selection = widget.get_selection().get_selected()
253 try:240 rm_folder = model.get_value(selection[1], 0)
254 rm_folder = model.get_value(selection[1], 0)241 self.music_folders.remove(rm_folder)
255 self.music_folders.remove(rm_folder)242 str_folders = ";".join(self.music_folders)
243 self.config.write_content_value("Music", "folders", str_folders)
244 model.remove(selection[1])
245
246 def on_button_edit_music_clicked(self, widget):
247 """Edit currently selected music folder"""
248 widget = self.widgets.get_widget("treeview_music")
249 url_dialog = self.widgets.get_widget("url_dialog")
250 url_entry = self.widgets.get_widget("url_entry")
251 model = widget.get_model()
252 selection = widget.get_selection().get_selected()
253 folder = model.get_value(selection[1], 0)
254 url_entry.set_text(folder)
255 url_dialog.set_title(_("Edit URL"))
256 status = url_dialog.run()
257 if status == gtk.RESPONSE_OK and os.path.exists(self.url):
258 # Update list model
259 model.set_value(selection[1], 0, self.url)
260 # Update configure file
261 pos = self.music_folders.index(folder)
262 self.music_folders.remove(folder)
263 self.music_folders.insert(pos, self.url)
256 str_folders = ";".join(self.music_folders)264 str_folders = ";".join(self.music_folders)
257 self.config.write_content_value("Music", "folders", str_folders)265 self.config.write_content_value("Music", "folders", str_folders)
258 model.remove(selection[1])
259 except:
260 # No need for actions. Item wasn't selected.
261 pass
262
263 def on_button_edit_music_clicked(self, widget):
264 """Edit currently selected music folder"""
265 widget = self.widgets.get_widget("treeview_music")
266 url_dialog = self.widgets.get_widget("url_dialog")
267 url_entry = self.widgets.get_widget("url_entry")
268 model = widget.get_model()
269 try:
270 selection = widget.get_selection().get_selected()
271 folder = model.get_value(selection[1], 0)
272 url_entry.set_text(folder)
273 url_dialog.set_title(_("Edit URL"))
274 status = url_dialog.run()
275 if status == gtk.RESPONSE_OK and os.path.exists(self.url):
276 # Update list model
277 model.set_value(selection[1], 0, self.url)
278 # Update configure file
279 pos = self.music_folders.index(folder)
280 self.music_folders.remove(folder)
281 self.music_folders.insert(pos, self.url)
282 str_folders = ";".join(self.music_folders)
283 self.config.write_content_value("Music", "folders", str_folders)
284 except:
285 # No need for actions. Item wasn't selected.
286 pass
287266
288 def on_button_add_images_clicked(self, widget):267 def on_button_add_images_clicked(self, widget):
289 """Opens add URL dialog. """268 """Opens add URL dialog. """
@@ -307,41 +286,33 @@
307 widget = self.widgets.get_widget("treeview_images")286 widget = self.widgets.get_widget("treeview_images")
308 model = widget.get_model()287 model = widget.get_model()
309 selection = widget.get_selection().get_selected()288 selection = widget.get_selection().get_selected()
310 try:289 rm_folder = model.get_value(selection[1], 0)
311 rm_folder = model.get_value(selection[1], 0)290 self.image_folders.remove(rm_folder)
312 self.image_folders.remove(rm_folder)291 str_folders = ";".join(self.image_folders)
292 self.config.write_content_value("Images", "folders", str_folders)
293 model.remove(selection[1])
294
295 def on_button_edit_images_clicked(self, widget):
296 """Edit currently selected music folder"""
297 widget = self.widgets.get_widget("treeview_images")
298 url_dialog = self.widgets.get_widget("url_dialog")
299 url_entry = self.widgets.get_widget("url_entry")
300 model = widget.get_model()
301 selection = widget.get_selection().get_selected()
302 folder = model.get_value(selection[1], 0)
303 url_entry.set_text(folder)
304 url_dialog.set_title(_("Edit URL"))
305 status = url_dialog.run()
306 if status == gtk.RESPONSE_OK and os.path.exists(self.url):
307 # Update list model
308 model.set_value(selection[1], 0, self.url)
309 # Update configure file
310 pos = self.image_folders.index(folder)
311 self.image_folders.remove(folder)
312 self.image_folders.insert(pos, self.url)
313 str_folders = ";".join(self.image_folders)313 str_folders = ";".join(self.image_folders)
314 self.config.write_content_value("Images", "folders", str_folders)314 self.config.write_content_value("Images", "folders",
315 model.remove(selection[1])315 str_folders)
316 except:
317 # No need for actions. Item wasn't selected.
318 pass
319
320 def on_button_edit_images_clicked(self, widget):
321 """Edit currently selected music folder"""
322 widget = self.widgets.get_widget("treeview_images")
323 url_dialog = self.widgets.get_widget("url_dialog")
324 url_entry = self.widgets.get_widget("url_entry")
325 model = widget.get_model()
326 try:
327 selection = widget.get_selection().get_selected()
328 folder = model.get_value(selection[1], 0)
329 url_entry.set_text(folder)
330 url_dialog.set_title(_("Edit URL"))
331 status = url_dialog.run()
332 if status == gtk.RESPONSE_OK and os.path.exists(self.url):
333 # Update list model
334 model.set_value(selection[1], 0, self.url)
335 # Update configure file
336 pos = self.image_folders.index(folder)
337 self.image_folders.remove(folder)
338 self.image_folders.insert(pos, self.url)
339 str_folders = ";".join(self.image_folders)
340 self.config.write_content_value("Images", "folders",
341 str_folders)
342 except:
343 # No need for actions. Item wasn't selected.
344 pass
345316
346 def on_button_add_feed_clicked(self, widget):317 def on_button_add_feed_clicked(self, widget):
347 """Opens add feed dialog. """318 """Opens add feed dialog. """
@@ -363,15 +334,11 @@
363 widget = self.widgets.get_widget("treeview_feeds")334 widget = self.widgets.get_widget("treeview_feeds")
364 model = widget.get_model()335 model = widget.get_model()
365 selection = widget.get_selection().get_selected()336 selection = widget.get_selection().get_selected()
366 try:337 rm_folder = model.get_value(selection[1], 0)
367 rm_folder = model.get_value(selection[1], 0)338 self.feeds.remove(rm_folder)
368 self.feeds.remove(rm_folder)339 str_folders = ";".join(self.feeds)
369 str_folders = ";".join(self.feeds)340 self.config.write_content_value("RSS", "feeds", str_folders)
370 self.config.write_content_value("RSS", "feeds", str_folders)341 model.remove(selection[1])
371 model.remove(selection[1])
372 except:
373 # No need for actions. Item wasn't selected.
374 pass
375342
376 def on_button_edit_feed_clicked(self, widget):343 def on_button_edit_feed_clicked(self, widget):
377 """Edit currently selected feed"""344 """Edit currently selected feed"""
@@ -379,24 +346,20 @@
379 url_dialog = self.widgets.get_widget("url_dialog")346 url_dialog = self.widgets.get_widget("url_dialog")
380 url_entry = self.widgets.get_widget("url_entry")347 url_entry = self.widgets.get_widget("url_entry")
381 model = widget.get_model()348 model = widget.get_model()
382 try:349 selection = widget.get_selection().get_selected()
383 selection = widget.get_selection().get_selected()350 feed = model.get_value(selection[1], 0)
384 feed = model.get_value(selection[1], 0)351 url_entry.set_text(feed)
385 url_entry.set_text(feed)352 url_dialog.set_title(_("Edit feed"))
386 url_dialog.set_title(_("Edit feed"))353 status = url_dialog.run()
387 status = url_dialog.run()354 if status == gtk.RESPONSE_OK:
388 if status == gtk.RESPONSE_OK:355 # Update list model
389 # Update list model356 model.set_value(selection[1], 0, self.url)
390 model.set_value(selection[1], 0, self.url)357 # Update configure file
391 # Update configure file358 pos = self.feeds.index(feed)
392 pos = self.feeds.index(feed)359 self.feeds.remove(feed)
393 self.feeds.remove(feed)360 self.feeds.insert(pos, self.url)
394 self.feeds.insert(pos, self.url)361 str_feeds = ";".join(self.feeds)
395 str_feeds = ";".join(self.feeds)362 self.config.write_content_value("RSS", "feeds", str_feeds)
396 self.config.write_content_value("RSS", "feeds", str_feeds)
397 except:
398 # No need for actions. Item wasn't selected.
399 pass
400363
401 def on_button_open_list_clicked(self, widget):364 def on_button_open_list_clicked(self, widget):
402 """Opens the open feed source dialog"""365 """Opens the open feed source dialog"""
@@ -563,54 +526,30 @@
563 Rebuild video cache requested526 Rebuild video cache requested
564 @param widget: GTK-Widget527 @param widget: GTK-Widget
565 """528 """
566 try:529 proxy = MessageBusProxy(client_name = "Content Management GUI")
567 proxy = MessageBusProxy(client_name = "Content Management GUI")530 proxy.connectToMessageBus()
568 proxy.connectToMessageBus()531 proxy.sendMessage(Message(MessageType.REBUILD_VIDEO_CACHE))
569 proxy.sendMessage(Message(MessageType.REBUILD_VIDEO_CACHE))532 proxy.disconnectFromMessageBus()
570 proxy.disconnectFromMessageBus()
571 except:
572 # This means that backend is not running. Doesn't matter
573 error = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
574 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
575 _("Entertainer backend is not running. Cache cannot be rebuilt."))
576 error.run()
577 error.destroy()
578533
579 def on_button_music_rebuild_clicked(self, widget):534 def on_button_music_rebuild_clicked(self, widget):
580 """535 """
581 Rebuild music cache requested536 Rebuild music cache requested
582 @param widget: GTK-Widget537 @param widget: GTK-Widget
583 """538 """
584 try:539 proxy = MessageBusProxy(client_name = "Content Management GUI")
585 proxy = MessageBusProxy(client_name = "Content Management GUI")540 proxy.connectToMessageBus()
586 proxy.connectToMessageBus()541 proxy.sendMessage(Message(MessageType.REBUILD_MUSIC_CACHE))
587 proxy.sendMessage(Message(MessageType.REBUILD_MUSIC_CACHE))542 proxy.disconnectFromMessageBus()
588 proxy.disconnectFromMessageBus()
589 except:
590 # This means that backend is not running. Doesn't matter
591 error = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
592 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
593 _("Entertainer backend is not running. Cache cannot be rebuilt."))
594 error.run()
595 error.destroy()
596543
597 def on_button_image_rebuild_clicked(self, widget):544 def on_button_image_rebuild_clicked(self, widget):
598 """545 """
599 Rebuild image cache requested546 Rebuild image cache requested
600 @param widget: GTK-Widget547 @param widget: GTK-Widget
601 """548 """
602 try:549 proxy = MessageBusProxy(client_name = "Content Management GUI")
603 proxy = MessageBusProxy(client_name = "Content Management GUI")550 proxy.connectToMessageBus()
604 proxy.connectToMessageBus()551 proxy.sendMessage(Message(MessageType.REBUILD_IMAGE_CACHE))
605 proxy.sendMessage(Message(MessageType.REBUILD_IMAGE_CACHE))552 proxy.disconnectFromMessageBus()
606 proxy.disconnectFromMessageBus()
607 except:
608 # This means that backend is not running. Doesn't matter
609 error = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
610 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
611 _("Entertainer backend is not running. Cache cannot be rebuilt."))
612 error.run()
613 error.destroy()
614553
615 def on_button_feed_rebuild_clicked(self, widget):554 def on_button_feed_rebuild_clicked(self, widget):
616 """555 """
@@ -624,18 +563,10 @@
624 status = dialog.run()563 status = dialog.run()
625 #If user has ok'd the request send the message to the message bus564 #If user has ok'd the request send the message to the message bus
626 if(status == gtk.RESPONSE_OK):565 if(status == gtk.RESPONSE_OK):
627 try:566 proxy = MessageBusProxy(client_name = "Content Management GUI")
628 proxy = MessageBusProxy(client_name = "Content Management GUI")567 proxy.connectToMessageBus()
629 proxy.connectToMessageBus()568 proxy.sendMessage(Message(MessageType.REBUILD_FEED_CACHE))
630 proxy.sendMessage(Message(MessageType.REBUILD_FEED_CACHE))569 proxy.disconnectFromMessageBus()
631 proxy.disconnectFromMessageBus()
632 except:
633 # This means that backend is not running. Doesn't matter
634 error = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
635 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
636 _("Entertainer backend is not running. Cache cannot be rebuilt."))
637 error.run()
638 error.destroy()
639 dialog.destroy()570 dialog.destroy()
640571
641 def init_dialog_values_from_configure_file(self):572 def init_dialog_values_from_configure_file(self):
642573
=== modified file 'entertainerlib/utils/feed_utils.py'
--- entertainerlib/utils/feed_utils.py 2009-02-07 17:12:21 +0000
+++ entertainerlib/utils/feed_utils.py 2009-02-08 07:43:25 +0000
@@ -62,11 +62,8 @@
62 in_tag = False62 in_tag = False
63 parse_list.pop(i)63 parse_list.pop(i)
64 #check if tag matches64 #check if tag matches
65 try:65 if tag in valid_tag_list:
66 if len(valid_tag_list) > valid_tag_list.index(tag):66 output += ("<" + tag + tag_attributes + ">")
67 output += ("<" + tag + tag_attributes + ">")
68 except:
69 pass
70 tag = ""67 tag = ""
71 tag_attributes = ""68 tag_attributes = ""
72 elif in_tag_name:69 elif in_tag_name:
7370
=== modified file 'entertainerlib/utils/lyrics_downloader.py'
--- entertainerlib/utils/lyrics_downloader.py 2008-08-07 01:17:29 +0000
+++ entertainerlib/utils/lyrics_downloader.py 2009-02-07 21:43:35 +0000
@@ -48,12 +48,9 @@
48 Search lyrics and download if found48 Search lyrics and download if found
49 """49 """
50 lyrics = ""50 lyrics = ""
51 try:51 self._clean_up_artist_title()
52 self._clean_up_artist_title()52 lyrics_xml = self._get_lyrics_xml()
53 lyrics_xml = self._get_lyrics_xml()53 lyrics = self._parse_lyrics_xml(lyrics_xml)
54 lyrics = self._parse_lyrics_xml(lyrics_xml)
55 except:
56 lyrics = None
57 self.callback(lyrics)54 self.callback(lyrics)
5855
59 def _clean_up_artist_title(self):56 def _clean_up_artist_title(self):
@@ -95,10 +92,7 @@
9592
96 def _parse_lyrics_xml(self, lyrics_xml):93 def _parse_lyrics_xml(self, lyrics_xml):
97 """Parse lyrics XML and return lyrics string"""94 """Parse lyrics XML and return lyrics string"""
98 try:95 xmldoc = minidom.parseString(lyrics_xml).documentElement
99 xmldoc = minidom.parseString(lyrics_xml).documentElement
100 except:
101 raise Exception("Can't get lyrics for this track.")
10296
103 # Get the lyric from the XML file97 # Get the lyric from the XML file
104 lyrics = xmldoc.getElementsByTagName('tx')[0].firstChild.nodeValue98 lyrics = xmldoc.getElementsByTagName('tx')[0].firstChild.nodeValue
10599
=== modified file 'entertainerlib/utils/preferences_dialog.py'
--- entertainerlib/utils/preferences_dialog.py 2009-02-07 20:28:47 +0000
+++ entertainerlib/utils/preferences_dialog.py 2009-02-07 21:43:35 +0000
@@ -88,15 +88,7 @@
88 # If theme was selected with file chooser88 # If theme was selected with file chooser
89 if(status == gtk.RESPONSE_OK):89 if(status == gtk.RESPONSE_OK):
90 package = dialog.get_filename()90 package = dialog.get_filename()
91 try:91 tar = tarfile.open(package, 'r:gz') # Open tar.gz package
92 tar = tarfile.open(package, 'r:gz') # Open tar.gz package
93 except:
94 error = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
95 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("Invalid theme file!"))
96 error.run()
97 error.destroy()
98 dialog.destroy()
99 return
10092
101 # Make sure that package contains configuration file (is theme)93 # Make sure that package contains configuration file (is theme)
102 content = tar.getnames()94 content = tar.getnames()
@@ -213,13 +205,10 @@
213205
214 def close(self):206 def close(self):
215 """Close Dialog"""207 """Close Dialog"""
216 try:208 proxy = MessageBusProxy(client_name = "Preferences GUI")
217 proxy = MessageBusProxy(client_name = "Preferences GUI")209 proxy.connectToMessageBus()
218 proxy.connectToMessageBus()210 proxy.sendMessage(Message(MessageType.PREFERENCES_CFG_UPDATED))
219 proxy.sendMessage(Message(MessageType.PREFERENCES_CFG_UPDATED))211 proxy.disconnectFromMessageBus()
220 proxy.disconnectFromMessageBus()
221 except:
222 pass # This means that backend is not running. Doesn't matter
223212
224 if(self.STAND_ALONE):213 if(self.STAND_ALONE):
225 self.pref_dialog.hide()214 self.pref_dialog.hide()
@@ -249,19 +238,16 @@
249 themelist_widget.set_model(model)238 themelist_widget.set_model(model)
250239
251 # Set current theme selected in theme list240 # Set current theme selected in theme list
252 try:241 index = model.get_iter_first()
253 index = model.get_iter_first()242 unselected = True
254 unselected = True243 index_counter = 0
255 index_counter = 0244 while(unselected):
256 while(unselected):245 name = model.get_value(iter, 0)
257 name = model.get_value(iter, 0)246 if name == current_theme:
258 if name == current_theme:247 unselected = False
259 unselected = False248 themelist_widget.set_cursor(index_counter)
260 themelist_widget.set_cursor(index_counter)249 index = model.iter_next(index)
261 index = model.iter_next(index)250 index_counter += 1
262 index_counter += 1
263 except:
264 pass # Error in configfile
265251
266 # Checkboxes252 # Checkboxes
267 effect_checkbox = self.widgets.get_widget("effect_checkbox")253 effect_checkbox = self.widgets.get_widget("effect_checkbox")
268254
=== modified file 'entertainerlib/utils/theme.py'
--- entertainerlib/utils/theme.py 2009-02-06 08:13:48 +0000
+++ entertainerlib/utils/theme.py 2009-02-07 21:43:35 +0000
@@ -38,49 +38,45 @@
38 print "IOError: Couldn't read theme file."38 print "IOError: Couldn't read theme file."
39 sys.exit(1)39 sys.exit(1)
4040
41 try:41 # Get theme information
42 # Get theme information42 self.name = theme.get("Theme", "name")
43 self.name = theme.get("Theme", "name")43 self.comment = theme.get("Theme", "comment")
44 self.comment = theme.get("Theme", "comment")44 self.author = theme.get("Theme", "author")
45 self.author = theme.get("Theme", "author")45 self.licence = theme.get("Theme", "licence")
46 self.licence = theme.get("Theme", "licence")46 self.copyright = theme.get("Theme", "copyright")
47 self.copyright = theme.get("Theme", "copyright")47
4848 #The theme font must be pango compatible font, hence this code
49 #The theme font must be pango compatible font, hence this code49 #checks the theme font against the pango list generated from a
50 #checks the theme font against the pango list generated from a50 #pango context object and then sets self.font if the font is
51 #pango context object and then sets self.font if the font is51 #compatible. Unfortunately the list can only be generated from a
52 #compatible. Unfortunately the list can only be generated from a52 #gtk object at present.
53 #gtk object at present.53 self._font = ""
54 self._font = ""54 tmp_font = theme.get("Theme", "font")
55 tmp_font = theme.get("Theme", "font")55
5656 for font in gtk.TreeView().get_pango_context().list_families():
57 for font in gtk.TreeView().get_pango_context().list_families():57 if font.get_name() == tmp_font:
58 if font.get_name() == tmp_font:58 self._font = tmp_font
59 self._font = tmp_font59
6060 if self.font == "":
61 if self.font == "":61 self._font = "Arial"
62 self._font = "Arial"62
6363 # Get theme colors
64 # Get theme colors64 self.color = {}
65 self.color = {}65 self.color['background'] = theme.get(
66 self.color['background'] = theme.get(66 "Colors", "background").split(',')
67 "Colors", "background").split(',')67 self.color['title'] = theme.get("Colors", "title").split(',')
68 self.color['title'] = theme.get("Colors", "title").split(',')68 self.color['subtitle'] = theme.get("Colors", "subtitle").split(',')
69 self.color['subtitle'] = theme.get("Colors", "subtitle").split(',')69 self.color['screentitle'] = theme.get(
70 self.color['screentitle'] = theme.get(70 "Colors", "screentitle").split(',')
71 "Colors", "screentitle").split(',')71 self.color['text'] = theme.get("Colors", "text").split(',')
72 self.color['text'] = theme.get("Colors", "text").split(',')72 self.color['menuitem_active'] = theme.get(
73 self.color['menuitem_active'] = theme.get(73 "Colors", "menuitem_active").split(',')
74 "Colors", "menuitem_active").split(',')74 self.color['menuitem_inactive'] = theme.get(
75 self.color['menuitem_inactive'] = theme.get(75 "Colors", "menuitem_inactive").split(',')
76 "Colors", "menuitem_inactive").split(',')76 self.color['arrow_foreground'] = theme.get(
77 self.color['arrow_foreground'] = theme.get(77 "Colors", "arrow_foreground").split(',')
78 "Colors", "arrow_foreground").split(',')78 self.color['arrow_background'] = theme.get(
79 self.color['arrow_background'] = theme.get(79 "Colors", "arrow_background").split(',')
80 "Colors", "arrow_background").split(',')
81 except:
82 print "Invalid theme.conf file!"
83 sys.exit(1)
8480
85 # Build the image array : image[name] = filename81 # Build the image array : image[name] = filename
86 self.image = {}82 self.image = {}
@@ -164,12 +160,8 @@
164 def get_color(self, element):160 def get_color(self, element):
165 """Return color for the element as a tuple of (r, b, g, a)."""161 """Return color for the element as a tuple of (r, b, g, a)."""
166 if self.color.has_key(element):162 if self.color.has_key(element):
167 try:163 color = [int(ele) for ele in self.color[element]]
168 color = self.color[element]164 return (color[0], color[1], color[2], color[3])
169 return (int(color[0]), int(color[1]), int(color[2]),
170 int(color[3]))
171 except:
172 return (255, 0, 0, 255)
173 else:165 else:
174 # On error we return bright red.166 # On error we return bright red.
175 return (255, 0, 0, 255)167 return (255, 0, 0, 255)
176168
=== modified file 'entertainerlib/utils/video_thumbnailer.py'
--- entertainerlib/utils/video_thumbnailer.py 2009-02-07 21:53:37 +0000
+++ entertainerlib/utils/video_thumbnailer.py 2009-02-07 22:12:25 +0000
@@ -188,8 +188,7 @@
188188
189 try:189 try:
190 duration = self._pipeline.query_duration(gst.FORMAT_TIME)[0]190 duration = self._pipeline.query_duration(gst.FORMAT_TIME)[0]
191 except Exception:191 except AssertionError:
192 ## FIXME: precise this exception
193 #Gstreamer cannot determine the media duration using192 #Gstreamer cannot determine the media duration using
194 #playing-thumbnailing for file193 #playing-thumbnailing for file
195 self.set_pipeline_state(self._pipeline, gst.STATE_NULL)194 self.set_pipeline_state(self._pipeline, gst.STATE_NULL)
@@ -225,7 +224,6 @@
225 '''224 '''
226 Plays the video file to gather information for generating a thumbnail225 Plays the video file to gather information for generating a thumbnail
227 '''226 '''
228 fileid = None
229 self._img = None227 self._img = None
230228
231 if duration >= 250000:229 if duration >= 250000:
@@ -280,12 +278,8 @@
280278
281 frame = self._sink.get_current_frame()279 frame = self._sink.get_current_frame()
282280
283 try:281 img = Image.frombuffer(
284 img = Image.frombuffer("RGB", sink_size, frame, "raw", "RGB",282 "RGB", sink_size, frame, "raw", "RGB", 0, 1)
285 0, 1)
286 except:
287 #Invalid frame
288 continue
289283
290 if self.interesting_image(img):284 if self.interesting_image(img):
291 break285 break
292286
=== modified file 'pylintrc'
--- pylintrc 2009-02-07 21:53:37 +0000
+++ pylintrc 2009-02-08 08:12:04 +0000
@@ -56,20 +56,13 @@
56# E1101 and E1103 are broken, as it reports non-existing members when the56# E1101 and E1103 are broken, as it reports non-existing members when the
57# member is inherited.57# member is inherited.
58# W0142 checks for * or ** argument magic58# W0142 checks for * or ** argument magic
59# W0232 checks that in __init__ method is always present
60# W0613 is a warning about unused arguments.
61# W0201 checks for attributes defined outside init
5962
60# XXX: rockstar - W0613 is a warning about unused arguments. This can be a
61# little misleading, since cluttergst needs a few parameters that pylint
62# doesn't see getting used
63# XXX: rockstar - C0103 constrains method and function names to a regex63# XXX: rockstar - C0103 constrains method and function names to a regex
64# XXX: rockstar - W0702 constrains calls to except to specific Exceptions
65# XXX: rockstar - W0232 ensures that an __init__ method is always present
66# XXX: rockstar - W0511 checks for XXX, TODO, and FIXME64# XXX: rockstar - W0511 checks for XXX, TODO, and FIXME
67# XXX: rockstar - W0201 checks for attributes defined outside init65disable-msg=I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0923,W0613,C0103,W0232,W0201,E1101,E1103,W0142
68# XXX: rockstar - W0703 er, I have no idea what it does
69# XXX: rockstar - W0704 checks for empty except
70# XXX: rockstar - W0221 checks for inherited function signatures for similar
71# args
72disable-msg=I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0923,W0613,C0103,W0702,W0232,W0511,W0201,E1101,W0703,W0704,E1103,W0221,W0142
7366
7467
75[REPORTS]68[REPORTS]
@@ -302,7 +295,7 @@
302[MISCELLANEOUS]295[MISCELLANEOUS]
303296
304# List of note tags to take in consideration, separated by a comma.297# List of note tags to take in consideration, separated by a comma.
305notes=FIXME,XXX,TODO298notes=FIXME
306299
307300
308# checks for similarities and duplicated code. This computation may be301# checks for similarities and duplicated code. This computation may be

Subscribers

People subscribed via source and target branches