Merge lp:~rockstar/entertainer/trivial-fixes into lp:entertainer
- trivial-fixes
- Merge into trunk
Status: | Merged | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||||||||||||||||||
Proposed branch: | lp:~rockstar/entertainer/trivial-fixes | ||||||||||||||||||||||||
Merge into: | lp:entertainer | ||||||||||||||||||||||||
Diff against target: | None lines | ||||||||||||||||||||||||
To merge this branch: | bzr merge lp:~rockstar/entertainer/trivial-fixes | ||||||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Matt Layman | Approve | ||
Review via email: mp+3469@code.launchpad.net |
Commit message
Description of the change
Paul Hummer (rockstar) wrote : | # |
Matt Layman (mblayman) wrote : | # |
approve merge_conditional
1) You linked to Bug 313841 XXX: pylint unused args, which is about removing W0613, but what you actually fixed was W0612. Great work cleaning up 612, but if you want to continue to link to Bug 313841, please do something about W0613 (whether that be to ignore it forever or enable it and clean up the problem areas).
2) You changed buffer_probe to _buffer_probe, but nothing seems to use _buffer_probe. Why was this done?
3) You enabled W0622 and cleaned everything up, but you left in the related XXX line in pylintrc.
After these things are addressed, I'm happy with this branch. It was actually pretty educational learning about all the builtins that we overrode that I didn't even know existed. Thanks!
Paul Hummer (rockstar) wrote : | # |
> 1) You linked to Bug 313841 XXX: pylint unused args, which is about
> removing W0613, but what you actually fixed was W0612. Great work cleaning
> up 612, but if you want to continue to link to Bug 313841, please do
> something about W0613 (whether that be to ignore it forever or enable it
> and clean up the problem areas).
Removed the link. I actually just removed unused variables, which apparently
didn't have a bug for it. No biggie.
> 2) You changed buffer_probe to _buffer_probe, but nothing seems to use
> _buffer_probe. Why was this done?
Removed that code.
> 3) You enabled W0622 and cleaned everything up, but you left in the related
> XXX line in pylintrc.
Removed this as well. I wasn't taking out the XXX until I was done. I guess I
forgot one.
Here's the incremental diff:
=== modified file 'entertainerlib
--- entertainerlib/
+++ entertainerlib/
@@ -25,8 +25,7 @@ class VideoThumbnaile
class VideoThumbnaile
- ''' VideoThumbnailer does exactly what it's name demonstrates it does:
- create thumbnailed images of the videos.'''
+ '''Create thumbnails from videos.'''
class VideoSinkBin(
'''A gstreamer sink bin'''
@@ -247,51 +246,6 @@ class VideoThumbnaile
## How often Proceed?
- def _buffer_probe(pad, buff):
- '''Probe the buffer'''
- ## Proceed only every 5th frame!
- if self._every_co < self._every:
- self._every_co += 1
- return
- self._every_co = 0
-
- try:
- img = Image.frombuffe
- "raw", "RGB",0, 1)
- except Exception:
- #Invalid frame
- pass
- else:
- self._img = img
- if self.interestin
-
- self._img.
- (self.MAX_SIZE, self.MAX_SIZE),
- Image.BILINEAR
- )
- if img.mode != 'RGBA':
- img = img.convert(
-
- #Releasing self._img
- self._sink.reset()
- pad.remove_
- self._blocker.set()
- return
-
- self._counter -= 1
- if self._counter <= 0:
- #Counter off, resetting blocker
- # Is it better to return no image instead of a 'boring' one?
- if self._img:
- self._img.
- if img.mode != 'RGBA':
- img = img.convert(
-
- self._sink.reset()
- pad.remove_
- self._blocker.set()
-
-
=== modified fi...
Preview Diff
1 | === modified file 'entertainerlib/backend/components/feeds/feed_fetcher.py' |
2 | --- entertainerlib/backend/components/feeds/feed_fetcher.py 2008-10-25 17:56:14 +0000 |
3 | +++ entertainerlib/backend/components/feeds/feed_fetcher.py 2009-02-06 08:13:48 +0000 |
4 | @@ -105,15 +105,6 @@ |
5 | e_timestamp = datetime(ed[0], ed[1], ed[2], |
6 | ed[3], ed[4], ed[5]) |
7 | |
8 | - # If there is no entry ID we generate one from URL |
9 | - # and entry datetime |
10 | - try: |
11 | - entry_id = data.entries[i].id |
12 | - except: |
13 | - entry_id = data.feed.link + "_" + \ |
14 | - e_timestamp.strftime("%Y-%m-%d") + "_" + \ |
15 | - e_timestamp.strftime("%H:%M:%S") |
16 | - |
17 | # If entry is new (not cached in previous update) |
18 | if e_timestamp > current_update: |
19 | entry_row = (data.feed.link, |
20 | |
21 | === modified file 'entertainerlib/backend/components/mediacache/image_cache.py' |
22 | --- entertainerlib/backend/components/mediacache/image_cache.py 2009-01-07 03:03:00 +0000 |
23 | +++ entertainerlib/backend/components/mediacache/image_cache.py 2009-02-06 08:13:48 +0000 |
24 | @@ -126,6 +126,7 @@ |
25 | Adds a new directory to the cache. Sub directories are |
26 | added recursively and all files in them. |
27 | """ |
28 | + # pylint: disable-msg=W0612 |
29 | if not os.path.isdir(path) or not os.path.exists(path): |
30 | self.logger.error( |
31 | "Adding a directory to the image cache failed. " + |
32 | |
33 | === modified file 'entertainerlib/backend/components/mediacache/music_cache.py' |
34 | --- entertainerlib/backend/components/mediacache/music_cache.py 2008-08-05 02:08:27 +0000 |
35 | +++ entertainerlib/backend/components/mediacache/music_cache.py 2009-02-06 08:13:48 +0000 |
36 | @@ -132,6 +132,7 @@ |
37 | |
38 | def addDirectory(self, path): |
39 | """Add directory that contains audio files to the cache.""" |
40 | + # pylint: disable-msg=W0612 |
41 | if not os.path.isdir(path) or not os.path.exists(path): |
42 | self.logger.error( |
43 | "Adding a directory to the music cache failed. " + |
44 | |
45 | === modified file 'entertainerlib/backend/components/mediacache/video_cache.py' |
46 | --- entertainerlib/backend/components/mediacache/video_cache.py 2008-11-30 18:10:48 +0000 |
47 | +++ entertainerlib/backend/components/mediacache/video_cache.py 2009-02-06 08:13:48 +0000 |
48 | @@ -147,6 +147,7 @@ |
49 | self.logger.debug( |
50 | "Adding a directory to the video cache. Path is: '" + |
51 | path + "'") |
52 | + # pylint: disable-msg=W0612 |
53 | for root, dirs, files in os.walk(path): |
54 | for name in files: |
55 | self.addFile(os.path.join(root, name)) |
56 | |
57 | === modified file 'entertainerlib/backend/core/connection_server.py' |
58 | --- entertainerlib/backend/core/connection_server.py 2009-01-11 01:54:48 +0000 |
59 | +++ entertainerlib/backend/core/connection_server.py 2009-02-06 08:13:48 +0000 |
60 | @@ -36,7 +36,8 @@ |
61 | self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
62 | try: |
63 | self.server_socket.bind(('localhost', port)) |
64 | - except socket.error, (value, message): |
65 | + except socket.error, e: |
66 | + message = e[1] |
67 | self.logger.error("Socket failed to bind. %s" % message) |
68 | # socket binding is critical to the backend, so exit |
69 | sys.exit(1) |
70 | @@ -48,7 +49,7 @@ |
71 | self.active = True |
72 | self.logger.debug("ConnectionServer waiting incoming connections") |
73 | while self.active: |
74 | - client_socket, address = self.server_socket.accept() |
75 | + client_socket = self.server_socket.accept()[0] |
76 | self.logger.debug("Incoming connection accepted") |
77 | client_connection = ClientConnection(client_socket, |
78 | self.message_bus) |
79 | |
80 | === modified file 'entertainerlib/backend/core/message_bus.py' |
81 | --- entertainerlib/backend/core/message_bus.py 2009-01-11 01:54:48 +0000 |
82 | +++ entertainerlib/backend/core/message_bus.py 2009-02-06 08:13:48 +0000 |
83 | @@ -48,6 +48,7 @@ |
84 | # priorities. |
85 | #XXX: rockstar - WTF?! Why is there a list comprehension being used |
86 | # and still only returning an empty list? |
87 | + # pylint: disable-msg=W0612 |
88 | self.message_handlers = [ |
89 | [] for i in range(self.NUMBER_OF_MESSAGE_TYPES) |
90 | ] |
91 | |
92 | === modified file 'entertainerlib/frontend/__init__.py' |
93 | --- entertainerlib/frontend/__init__.py 2008-10-13 16:23:50 +0000 |
94 | +++ entertainerlib/frontend/__init__.py 2009-02-06 08:13:48 +0000 |
95 | @@ -16,7 +16,7 @@ |
96 | config = Configuration() |
97 | if config.start_auto_server(): |
98 | print "Entertainer backend starting..." |
99 | - backend = BackendServer() |
100 | + BackendServer() |
101 | |
102 | if config.tray_icon_enabled(): |
103 | init_systray() |
104 | |
105 | === modified file 'entertainerlib/frontend/gui/screens/audio_play.py' |
106 | --- entertainerlib/frontend/gui/screens/audio_play.py 2009-02-01 19:15:02 +0000 |
107 | +++ entertainerlib/frontend/gui/screens/audio_play.py 2009-02-06 08:33:50 +0000 |
108 | @@ -64,7 +64,7 @@ |
109 | media_player.play() |
110 | |
111 | # Start updating the progress bar of the PlayingTab (1/4 sec) |
112 | - gobject.timeout_add(250, tab1._update_progress_bar, media_player) |
113 | + gobject.timeout_add(250, tab1.update_progress_bar, media_player) |
114 | |
115 | def update(self, track): |
116 | '''Called when currently playing changes tracks. The provided track |
117 | |
118 | === modified file 'entertainerlib/frontend/gui/screens/factory.py' |
119 | --- entertainerlib/frontend/gui/screens/factory.py 2009-02-04 00:01:22 +0000 |
120 | +++ entertainerlib/frontend/gui/screens/factory.py 2009-02-07 17:12:21 +0000 |
121 | @@ -44,7 +44,7 @@ |
122 | self.move_to_new_screen_callback = move_to_new_screen_callback |
123 | self.change_screen_callback = change_screen_callback |
124 | |
125 | - def generate_screen(self, type, kwargs=None): |
126 | + def generate_screen(self, screen_type, kwargs=None): |
127 | '''Generate the proper screen by delegating to the proper generator.''' |
128 | |
129 | # The generate methods will add new key value pairs to kwargs to create |
130 | @@ -74,7 +74,7 @@ |
131 | 'weather' : self._generate_weather |
132 | } |
133 | |
134 | - return generator_methods[type](kwargs) |
135 | + return generator_methods[screen_type](kwargs) |
136 | |
137 | def _generate_album(self, kwargs): |
138 | '''Generate an Album screen.''' |
139 | |
140 | === modified file 'entertainerlib/frontend/gui/tabs/playing_tab.py' |
141 | --- entertainerlib/frontend/gui/tabs/playing_tab.py 2009-02-03 23:37:57 +0000 |
142 | +++ entertainerlib/frontend/gui/tabs/playing_tab.py 2009-02-06 08:33:50 +0000 |
143 | @@ -62,7 +62,7 @@ |
144 | track.get_length_string()) |
145 | self.add(self.track_length) |
146 | |
147 | - def _update_progress_bar(self, player): |
148 | + def update_progress_bar(self, player): |
149 | '''Update the progress bar''' |
150 | self.progress_bar.set_progress(player.get_media_position()) |
151 | self.current_pos.set_text(player.get_media_position_string()) |
152 | |
153 | === modified file 'entertainerlib/frontend/gui/transitions/factory.py' |
154 | --- entertainerlib/frontend/gui/transitions/factory.py 2009-01-26 22:58:26 +0000 |
155 | +++ entertainerlib/frontend/gui/transitions/factory.py 2009-02-07 17:12:21 +0000 |
156 | @@ -35,11 +35,11 @@ |
157 | } |
158 | |
159 | if self.config.show_effects(): |
160 | - type = self.config.transition_effect() |
161 | + kind = self.config.transition_effect() |
162 | else: |
163 | - type = "No effect" |
164 | + kind = "No effect" |
165 | |
166 | - return generate_methods[type]() |
167 | + return generate_methods[kind]() |
168 | |
169 | def _generate_slide(self): |
170 | '''Generate a Slide transition''' |
171 | |
172 | === modified file 'entertainerlib/frontend/gui/user_interface.py' |
173 | --- entertainerlib/frontend/gui/user_interface.py 2009-02-04 00:01:22 +0000 |
174 | +++ entertainerlib/frontend/gui/user_interface.py 2009-02-07 17:12:21 +0000 |
175 | @@ -292,6 +292,7 @@ |
176 | @param stage: Stage object which received key pressing event |
177 | @param event: Event object (from clutter framework) |
178 | """ |
179 | + # pylint: disable-msg=W0212 |
180 | if event.keyval == clutter.keysyms.Return: # Enter key |
181 | self.handle_user_event(UserEvent(UserEvent.NAVIGATE_SELECT)) |
182 | elif event.keyval == clutter.keysyms.Up: # Up arrow key |
183 | @@ -339,9 +340,9 @@ |
184 | control, gtk-widget or some other source. |
185 | @param event: UserEvent object, defines what action has been taken |
186 | """ |
187 | - type = event.get_type() |
188 | + kind = event.get_type() |
189 | |
190 | - if(type == UserEvent.PLAYER_PLAY_PAUSE): |
191 | + if(kind == UserEvent.PLAYER_PLAY_PAUSE): |
192 | if self.current.is_interested_in_play_action(): |
193 | self.current.execute_play_action() |
194 | else: |
195 | @@ -352,80 +353,80 @@ |
196 | self.player.play() |
197 | self.current.handle_user_event(event) |
198 | |
199 | - elif(type == UserEvent.PLAYER_STOP): |
200 | + elif(kind == UserEvent.PLAYER_STOP): |
201 | if self.player.is_playing(): |
202 | self.player.stop() |
203 | self.current.handle_user_event(event) |
204 | |
205 | - elif(type == UserEvent.PLAYER_NEXT): |
206 | + elif(kind == UserEvent.PLAYER_NEXT): |
207 | self.player.next() |
208 | self.current.handle_user_event(event) |
209 | |
210 | - elif(type == UserEvent.PLAYER_PREVIOUS): |
211 | + elif(kind == UserEvent.PLAYER_PREVIOUS): |
212 | self.player.previous() |
213 | self.current.handle_user_event(event) |
214 | |
215 | - elif(type == UserEvent.PLAYER_SKIP_FORWARD): |
216 | + elif(kind == UserEvent.PLAYER_SKIP_FORWARD): |
217 | self.player.skip_forward() |
218 | self.current.handle_user_event(event) |
219 | |
220 | - elif(type == UserEvent.PLAYER_SKIP_BACKWARD): |
221 | + elif(kind == UserEvent.PLAYER_SKIP_BACKWARD): |
222 | self.player.skip_backward() |
223 | self.current.handle_user_event(event) |
224 | |
225 | - elif(type == UserEvent.NAVIGATE_UP): |
226 | - self.current.handle_user_event(event) |
227 | - |
228 | - elif(type == UserEvent.NAVIGATE_DOWN): |
229 | - self.current.handle_user_event(event) |
230 | - |
231 | - elif(type == UserEvent.NAVIGATE_LEFT): |
232 | - self.current.handle_user_event(event) |
233 | - |
234 | - elif(type == UserEvent.NAVIGATE_RIGHT): |
235 | - self.current.handle_user_event(event) |
236 | - |
237 | - elif(type == UserEvent.NAVIGATE_HOME): |
238 | + elif(kind == UserEvent.NAVIGATE_UP): |
239 | + self.current.handle_user_event(event) |
240 | + |
241 | + elif(kind == UserEvent.NAVIGATE_DOWN): |
242 | + self.current.handle_user_event(event) |
243 | + |
244 | + elif(kind == UserEvent.NAVIGATE_LEFT): |
245 | + self.current.handle_user_event(event) |
246 | + |
247 | + elif(kind == UserEvent.NAVIGATE_RIGHT): |
248 | + self.current.handle_user_event(event) |
249 | + |
250 | + elif(kind == UserEvent.NAVIGATE_HOME): |
251 | self.move_to_new_screen("main") |
252 | |
253 | - elif(type == UserEvent.NAVIGATE_CURRENTLY_PLAYING): |
254 | + elif(kind == UserEvent.NAVIGATE_CURRENTLY_PLAYING): |
255 | pass |
256 | |
257 | - elif(type == UserEvent.NAVIGATE_BACK): |
258 | + elif(kind == UserEvent.NAVIGATE_BACK): |
259 | if not self.history.is_empty() and ( |
260 | self.current.get_type() != Screen.DIALOG): |
261 | screen = self.history.get_screen() |
262 | screen.update() |
263 | self.changeScreen(screen, Transition.BACKWARD) |
264 | |
265 | - elif(type == UserEvent.NAVIGATE_SELECT): |
266 | - self.current.handle_user_event(event) |
267 | - |
268 | - elif(type == UserEvent.NAVIGATE_CONTENT): |
269 | - self.current.handle_user_event(event) |
270 | - |
271 | - elif(type == UserEvent.TOGGLE_FULLSCREEN): |
272 | + elif(kind == UserEvent.NAVIGATE_SELECT): |
273 | + self.current.handle_user_event(event) |
274 | + |
275 | + elif(kind == UserEvent.NAVIGATE_CONTENT): |
276 | + self.current.handle_user_event(event) |
277 | + |
278 | + elif(kind == UserEvent.TOGGLE_FULLSCREEN): |
279 | self.toggle_fullscreen() |
280 | |
281 | - elif(type == UserEvent.USE_ASPECT_RATIO_1): |
282 | + elif(kind == UserEvent.USE_ASPECT_RATIO_1): |
283 | self.player.set_native_ratio() |
284 | self.current.handle_user_event(event) |
285 | |
286 | - elif(type == UserEvent.USE_ASPECT_RATIO_2): |
287 | + elif(kind == UserEvent.USE_ASPECT_RATIO_2): |
288 | self.player.set_widescreen_ratio() |
289 | self.current.handle_user_event(event) |
290 | |
291 | - elif(type == UserEvent.USE_ASPECT_RATIO_3): |
292 | + elif(kind == UserEvent.USE_ASPECT_RATIO_3): |
293 | self.player.set_zoom_ratio() |
294 | self.current.handle_user_event(event) |
295 | |
296 | - elif(type == UserEvent.USE_ASPECT_RATIO_4): |
297 | + elif(kind == UserEvent.USE_ASPECT_RATIO_4): |
298 | self.player.set_intelligent_ratio() |
299 | self.current.handle_user_event(event) |
300 | |
301 | - elif(type == UserEvent.USE_NEXT_ASPECT_RATIO): |
302 | + elif(kind == UserEvent.USE_NEXT_ASPECT_RATIO): |
303 | pass |
304 | |
305 | - elif(type == UserEvent.QUIT_FRONTEND): |
306 | + elif(kind == UserEvent.QUIT_FRONTEND): |
307 | self.confirm_exit() |
308 | |
309 | |
310 | === modified file 'entertainerlib/frontend/gui/widgets/grid_menu.py' |
311 | --- entertainerlib/frontend/gui/widgets/grid_menu.py 2008-12-25 01:32:18 +0000 |
312 | +++ entertainerlib/frontend/gui/widgets/grid_menu.py 2009-02-06 08:13:48 +0000 |
313 | @@ -175,6 +175,7 @@ |
314 | Selects the item at the passed logical_position |
315 | @author Joshua Scotton |
316 | """ |
317 | + # pylint: disable-msg=W0612 |
318 | target = ( int(logical_position / self.row_count), |
319 | int(logical_position % self.row_count)) |
320 | |
321 | |
322 | === modified file 'entertainerlib/frontend/gui/widgets/scroll_menu.py' |
323 | --- entertainerlib/frontend/gui/widgets/scroll_menu.py 2008-11-26 20:40:33 +0000 |
324 | +++ entertainerlib/frontend/gui/widgets/scroll_menu.py 2009-02-07 17:12:21 +0000 |
325 | @@ -86,11 +86,11 @@ |
326 | """ |
327 | #split list so that item at the index will now be at position 2 |
328 | #which is the selected index in a scroll menu |
329 | - list = self.__items[index-2:] + self.__items[0:index-2] |
330 | + items = self.__items[index-2:] + self.__items[0:index-2] |
331 | |
332 | #Basically remove all then add in the correct order |
333 | self.remove_all() |
334 | - for item in list: |
335 | + for item in items: |
336 | #Remove all doesn't remove the parent object. So in order to avoid |
337 | #adding two parent clutter items to the item we need to remove the |
338 | #old one first |
339 | |
340 | === modified file 'entertainerlib/frontend/gui/widgets/tab_group.py' |
341 | --- entertainerlib/frontend/gui/widgets/tab_group.py 2008-12-06 03:56:48 +0000 |
342 | +++ entertainerlib/frontend/gui/widgets/tab_group.py 2009-02-07 17:12:21 +0000 |
343 | @@ -199,12 +199,12 @@ |
344 | @param event: UserEvent object |
345 | """ |
346 | if self.active: |
347 | - type = event.get_type() |
348 | - if type == UserEvent.NAVIGATE_LEFT: |
349 | + event_type = event.get_type() |
350 | + if event_type == UserEvent.NAVIGATE_LEFT: |
351 | self._switch_tab_to_left() |
352 | - elif type == UserEvent.NAVIGATE_RIGHT: |
353 | + elif event_type == UserEvent.NAVIGATE_RIGHT: |
354 | self._switch_tab_to_right() |
355 | - elif type == UserEvent.NAVIGATE_DOWN and ( |
356 | + elif event_type == UserEvent.NAVIGATE_DOWN and ( |
357 | self.tabs_list[self.current_tab].can_activate()): |
358 | self.set_active(False) |
359 | self.tabs_list[self.current_tab].set_active(True) |
360 | |
361 | === modified file 'entertainerlib/frontend/medialibrary/music.py' |
362 | --- entertainerlib/frontend/medialibrary/music.py 2009-02-01 02:14:30 +0000 |
363 | +++ entertainerlib/frontend/medialibrary/music.py 2009-02-07 17:12:21 +0000 |
364 | @@ -353,13 +353,11 @@ |
365 | Get the artist of this album. This is taken from the first track. |
366 | @return: String |
367 | """ |
368 | - various = False |
369 | artist = self.tracks[0].get_artist() |
370 | text = self.tracks[0].get_artist() |
371 | |
372 | for track in self.get_tracks(): |
373 | if track.get_artist() != artist: |
374 | - various = True |
375 | text = _("Various") |
376 | break |
377 | else: |
378 | @@ -388,11 +386,11 @@ |
379 | """ |
380 | |
381 | # Check that these four fields are integers |
382 | - for input in [tracknumber, year, rating, length]: |
383 | + for field in [tracknumber, year, rating, length]: |
384 | if rating == None: # By default, there is no rating for a track |
385 | continue |
386 | - if type(input) != int: |
387 | - raise TrackTypeError("%s is not an integer" % input) |
388 | + if type(field) != int: |
389 | + raise TrackTypeError("%s is not an integer" % field) |
390 | |
391 | # Check that the rating is in range 1-5 |
392 | if rating != None and rating not in range(1, 6): |
393 | @@ -599,7 +597,7 @@ |
394 | """ |
395 | self.tracks = [] |
396 | |
397 | - (query_status, query_info) = CDDB.query(disc_id) |
398 | + query_info = CDDB.query(disc_id)[1] |
399 | |
400 | # FIXME: query_info contains code that we could use instead of TRY |
401 | # EXCEPT |
402 | @@ -616,8 +614,8 @@ |
403 | self.album = title[title.index(' / ') + 3:] |
404 | |
405 | # Get track titles |
406 | - (read_status, read_info) = CDDB.read(query_info['category'], |
407 | - query_info['disc_id']) |
408 | + read_info = CDDB.read(query_info['category'], |
409 | + query_info['disc_id'])[1] |
410 | cumulative_length = 0 |
411 | for i in range(disc_id[1]): |
412 | if i + 4 == len(disc_id): |
413 | @@ -637,8 +635,8 @@ |
414 | self.album = query['title'][query['title'].index(' / ') + 3:] |
415 | |
416 | # Get track titles |
417 | - (read_status, read_info) = CDDB.read(query_info[0]['category'], |
418 | - query_info[0]['disc_id']) |
419 | + read_info = CDDB.read(query_info[0]['category'], |
420 | + query_info[0]['disc_id'])[1] |
421 | cumulative_length = 0 |
422 | for i in range(disc_id[1]): |
423 | if i + 4 == len(disc_id): |
424 | |
425 | === modified file 'entertainerlib/tests/__init__.py' |
426 | --- entertainerlib/tests/__init__.py 2009-02-04 04:17:37 +0000 |
427 | +++ entertainerlib/tests/__init__.py 2009-02-06 07:23:29 +0000 |
428 | @@ -5,15 +5,13 @@ |
429 | from storm.locals import Store |
430 | import testtools |
431 | |
432 | -from entertainerlib.frontend.translation_setup import TranslationSetup |
433 | -TranslationSetup() |
434 | - |
435 | from entertainerlib.backend.core.db.connection import Database |
436 | from entertainerlib.frontend.translation_setup import TranslationSetup |
437 | from entertainerlib.utils.configuration import Configuration |
438 | |
439 | TranslationSetup() |
440 | |
441 | + |
442 | class EntertainerTest(testtools.TestCase): |
443 | '''Test for use in the Entertainer test suite.''' |
444 | |
445 | |
446 | === modified file 'entertainerlib/tests/test_configuration.py' |
447 | --- entertainerlib/tests/test_configuration.py 2009-01-31 21:36:56 +0000 |
448 | +++ entertainerlib/tests/test_configuration.py 2009-02-07 17:12:21 +0000 |
449 | @@ -1,4 +1,5 @@ |
450 | -'Tests Configuration' |
451 | +'''Tests Configuration''' |
452 | +# pylint: disable-msg=W0212 |
453 | |
454 | __license__ = "GPLv2" |
455 | __copyright__ = "2008, Matt Layman" |
456 | @@ -127,24 +128,24 @@ |
457 | def test_taint(self): |
458 | '''Test tainting configuration data''' |
459 | # Test tainting preferences data |
460 | - type = 'preferences' |
461 | + kind = 'preferences' |
462 | section = 'General' |
463 | option = 'history_size' |
464 | - self.configuration.taint(type, section, option) |
465 | - key = "%s %s %s" % (type, section, option) |
466 | + self.configuration.taint(kind, section, option) |
467 | + key = "%s %s %s" % (kind, section, option) |
468 | self.assertEqual(self.configuration._tainted[key], '8') |
469 | |
470 | # Test tainting content data |
471 | - type = 'content' |
472 | + kind = 'content' |
473 | section = 'Videos' |
474 | option = 'download_metadata' |
475 | - self.configuration.taint(type, section, option) |
476 | - key = "%s %s %s" % (type, section, option) |
477 | + self.configuration.taint(kind, section, option) |
478 | + key = "%s %s %s" % (kind, section, option) |
479 | self.assertEqual(self.configuration._tainted[key], 'True') |
480 | |
481 | # Test the bad branch |
482 | - type = 'bogus' |
483 | - self.assertRaises(Exception, self.configuration.taint, type, section, |
484 | + kind = 'bogus' |
485 | + self.assertRaises(Exception, self.configuration.taint, kind, section, |
486 | option) |
487 | |
488 | def test_taint_in_memory(self): |
489 | |
490 | === modified file 'entertainerlib/tests/test_frontendfeedentry.py' |
491 | --- entertainerlib/tests/test_frontendfeedentry.py 2009-01-31 21:36:56 +0000 |
492 | +++ entertainerlib/tests/test_frontendfeedentry.py 2009-02-06 08:33:50 +0000 |
493 | @@ -1,4 +1,5 @@ |
494 | '''Tests feed entries on the frontend''' |
495 | +# pylint: disable-msg=W0212 |
496 | |
497 | __licence__ = "GPLv2" |
498 | __copyright__ = "2008, Joshua Scotton" |
499 | |
500 | === modified file 'entertainerlib/tests/test_imagemenuitem.py' |
501 | --- entertainerlib/tests/test_imagemenuitem.py 2009-01-31 21:36:56 +0000 |
502 | +++ entertainerlib/tests/test_imagemenuitem.py 2009-02-06 08:33:50 +0000 |
503 | @@ -1,4 +1,5 @@ |
504 | """Tests ImageMenuItem""" |
505 | +# pylint: disable-msg=W0212 |
506 | |
507 | __license__ = "GPLv2" |
508 | __copyright__ = "2008, Matt Layman" |
509 | @@ -47,10 +48,10 @@ |
510 | def testRatio(self): |
511 | """Test that ratio correctly calculates the expected heights""" |
512 | texture2 = Texture(self.filename) |
513 | - image2 = ImageMenuItem(.1, .5, texture2) |
514 | + ImageMenuItem(.1, .5, texture2) |
515 | self.assertEqual(texture2.get_height(), 68) |
516 | |
517 | texture3 = Texture(self.filename) |
518 | - image3 = ImageMenuItem(.1, 2, texture3) |
519 | + ImageMenuItem(.1, 2, texture3) |
520 | self.assertEqual(texture3.get_height(), 272) |
521 | |
522 | |
523 | === modified file 'entertainerlib/tests/test_imagethumbnailer.py' |
524 | --- entertainerlib/tests/test_imagethumbnailer.py 2009-01-31 21:36:56 +0000 |
525 | +++ entertainerlib/tests/test_imagethumbnailer.py 2009-02-06 08:33:50 +0000 |
526 | @@ -1,4 +1,5 @@ |
527 | '''ImageThumbnailer test''' |
528 | +# pylint: disable-msg=W0212 |
529 | |
530 | import os |
531 | |
532 | |
533 | === modified file 'entertainerlib/tests/test_label.py' |
534 | --- entertainerlib/tests/test_label.py 2009-01-31 21:36:56 +0000 |
535 | +++ entertainerlib/tests/test_label.py 2009-02-06 08:33:50 +0000 |
536 | @@ -1,4 +1,5 @@ |
537 | """Tests Label""" |
538 | +# pylint: disable-msg=W0212 |
539 | |
540 | __license__ = "GPLv2" |
541 | __copyright__ = "2008, Matt Layman" |
542 | |
543 | === modified file 'entertainerlib/tests/test_lyricsdownloader.py' |
544 | --- entertainerlib/tests/test_lyricsdownloader.py 2009-01-31 21:36:56 +0000 |
545 | +++ entertainerlib/tests/test_lyricsdownloader.py 2009-02-06 08:33:50 +0000 |
546 | @@ -1,4 +1,5 @@ |
547 | '''Tests LyricsDownloader''' |
548 | +# pylint: disable-msg=W0212 |
549 | |
550 | __licence__ = "GPLv2" |
551 | __copyright__ = "2008, Michael Charclo" |
552 | |
553 | === modified file 'entertainerlib/tests/test_music.py' |
554 | --- entertainerlib/tests/test_music.py 2009-02-04 04:17:37 +0000 |
555 | +++ entertainerlib/tests/test_music.py 2009-02-07 17:12:21 +0000 |
556 | @@ -48,14 +48,14 @@ |
557 | for i in range(2): |
558 | for j in range(2): |
559 | for k in range(2): |
560 | - sum = i + j + k # to get unique track numbers for ablums |
561 | + total = i + j + k # to get unique track numbers for albums |
562 | db_row = ('/filename/%s' % str(i) + str(j) + str(k), |
563 | 'title%s' % str(i) + str(j), |
564 | 'artist0', |
565 | 'album%d' % j, |
566 | 'genre%d' % i, |
567 | i + j + k, # length |
568 | - sum, # tracknumber |
569 | + total, # tracknumber |
570 | i, # bitrate |
571 | 'comment%d' % i, |
572 | i # year |
573 | @@ -177,8 +177,7 @@ |
574 | album_artist = "artist0 - album0" |
575 | album_artist = album_artist.encode("base64") |
576 | album_art = os.path.join(self.art_path, album_artist + ".jpg") |
577 | - file = open(album_art, "wb") |
578 | - file.close() |
579 | + open(album_art, "wb").close() |
580 | result = self.track.get_album_art_url(self.cursor) |
581 | self.assertEqual(result, album_art) |
582 | if os.path.exists(album_art): |
583 | @@ -405,8 +404,7 @@ |
584 | album_artist = "artist0 - album1" |
585 | album_artist = album_artist.encode("base64") |
586 | album_art = os.path.join(self.art_path, album_artist + ".jpg") |
587 | - file = open(album_art, "wb") |
588 | - file.close() |
589 | + open(album_art, "wb").close() |
590 | self.assertTrue(self.album.has_album_art()) |
591 | if os.path.exists(album_art): |
592 | os.remove(album_art) |
593 | |
594 | === modified file 'entertainerlib/tests/test_screenfactory.py' |
595 | --- entertainerlib/tests/test_screenfactory.py 2009-02-04 04:20:05 +0000 |
596 | +++ entertainerlib/tests/test_screenfactory.py 2009-02-06 08:33:50 +0000 |
597 | @@ -1,4 +1,5 @@ |
598 | '''Tests ScreenFactory''' |
599 | +# pylint: disable-msg=W0212 |
600 | |
601 | __license__ = 'GPLv2' |
602 | __copyright__ = '2009, Matt Layman' |
603 | |
604 | === modified file 'entertainerlib/tests/test_scrollarea.py' |
605 | --- entertainerlib/tests/test_scrollarea.py 2009-01-31 21:36:56 +0000 |
606 | +++ entertainerlib/tests/test_scrollarea.py 2009-02-06 08:13:48 +0000 |
607 | @@ -20,6 +20,7 @@ |
608 | |
609 | # Get a workable amount of text |
610 | text = "Here is the start. " |
611 | + # pylint: disable-msg=W0612 |
612 | for i in range(0, 100): |
613 | text += "Here is another sentence. " |
614 | |
615 | |
616 | === modified file 'entertainerlib/tests/test_texture.py' |
617 | --- entertainerlib/tests/test_texture.py 2009-01-31 21:36:56 +0000 |
618 | +++ entertainerlib/tests/test_texture.py 2009-02-06 08:33:50 +0000 |
619 | @@ -1,4 +1,5 @@ |
620 | """Tests Texture""" |
621 | +# pylint: disable-msg=W0212 |
622 | |
623 | __license__ = "GPLv2" |
624 | __copyright__ = "2008, Matt Layman" |
625 | |
626 | === modified file 'entertainerlib/tests/test_transitionfactory.py' |
627 | --- entertainerlib/tests/test_transitionfactory.py 2009-02-04 04:17:37 +0000 |
628 | +++ entertainerlib/tests/test_transitionfactory.py 2009-02-07 17:12:21 +0000 |
629 | @@ -1,4 +1,5 @@ |
630 | '''Tests TransitionFactory''' |
631 | +# pylint: disable-msg=W0212 |
632 | |
633 | __license__ = 'GPLv2' |
634 | __copyright__ = '2009, Matt Layman' |
635 | @@ -59,12 +60,12 @@ |
636 | 'Zoom and fade' : ZoomAndFade |
637 | } |
638 | # Test all possible transitions |
639 | - for type in values_to_test.keys(): |
640 | + for key in values_to_test.keys(): |
641 | self.config.write_preference_value('General', 'transition_effect', |
642 | - type) |
643 | + key) |
644 | self.config.update_configuration() |
645 | transition = self.factory.generate_transition() |
646 | - self.assertTrue(isinstance(transition, values_to_test[type])) |
647 | + self.assertTrue(isinstance(transition, values_to_test[key])) |
648 | |
649 | # Test the path when the user doesn't have effects |
650 | self.config.write_preference_value('General', 'show_effects', 'False') |
651 | |
652 | === modified file 'entertainerlib/tests/test_videothumbnailer.py' |
653 | --- entertainerlib/tests/test_videothumbnailer.py 2009-01-31 21:36:56 +0000 |
654 | +++ entertainerlib/tests/test_videothumbnailer.py 2009-02-06 08:33:50 +0000 |
655 | @@ -1,4 +1,5 @@ |
656 | '''Tests VideoThumbnailer''' |
657 | +# pylint: disable-msg=W0212 |
658 | |
659 | import os |
660 | |
661 | |
662 | === modified file 'entertainerlib/tests/test_weather.py' |
663 | --- entertainerlib/tests/test_weather.py 2009-01-31 21:36:56 +0000 |
664 | +++ entertainerlib/tests/test_weather.py 2009-02-07 17:49:58 +0000 |
665 | @@ -4,6 +4,8 @@ |
666 | __copyright__ = "2008, Jamie Bennett" |
667 | __author__ = "Jamie Bennett <jamie@linuxuk.org>" |
668 | |
669 | +from datetime import datetime |
670 | + |
671 | from entertainerlib.tests import EntertainerTest |
672 | from entertainerlib.utils.weather import Weather |
673 | |
674 | @@ -30,7 +32,8 @@ |
675 | forecasts = self.weather.get_forecasts() |
676 | try: |
677 | today = forecasts[0] |
678 | - self.assertEqual(today["Day"], _("Today")) |
679 | + day = datetime.utcnow().strftime('%a') |
680 | + self.assertEqual(str(today["Day"]), day) |
681 | except: |
682 | self.fail() |
683 | |
684 | |
685 | === modified file 'entertainerlib/utils/configuration.py' |
686 | --- entertainerlib/utils/configuration.py 2009-01-26 18:28:26 +0000 |
687 | +++ entertainerlib/utils/configuration.py 2009-02-07 17:12:21 +0000 |
688 | @@ -508,18 +508,18 @@ |
689 | """ |
690 | return self.cfg_dir |
691 | |
692 | - def taint(self, type, section, option): |
693 | + def taint(self, kind, section, option): |
694 | '''Taint any data that is written to config files so that it can be |
695 | returned to a known state later''' |
696 | - if type == 'content': |
697 | + if kind == 'content': |
698 | value = self.content_config.get(section, option) |
699 | - elif type == 'preferences': |
700 | + elif kind == 'preferences': |
701 | value = self.preferences.get(section, option) |
702 | else: |
703 | raise Exception( |
704 | "Taint type must be either 'content' or 'preferences'") |
705 | |
706 | - key = "%s %s %s" % (type, section, option) |
707 | + key = "%s %s %s" % (kind, section, option) |
708 | self._tainted[key] = value |
709 | |
710 | def taint_in_memory(self, callback, kwargs): |
711 | |
712 | === modified file 'entertainerlib/utils/content_management_dialog.py' |
713 | --- entertainerlib/utils/content_management_dialog.py 2008-10-31 00:43:37 +0000 |
714 | +++ entertainerlib/utils/content_management_dialog.py 2009-02-07 17:12:21 +0000 |
715 | @@ -400,11 +400,11 @@ |
716 | |
717 | def on_button_open_list_clicked(self, widget): |
718 | """Opens the open feed source dialog""" |
719 | - open = OpenFeedSourceDialog(self.widgets.get_widget("treeview_feeds"), |
720 | - self.feeds) |
721 | - open.dialog.connect("destroy", open.on_closeButton_clicked) |
722 | - open.dialog.hide() |
723 | - open.dialog.destroy() |
724 | + open_dialog = OpenFeedSourceDialog( |
725 | + self.widgets.get_widget("treeview_feeds"), self.feeds) |
726 | + open_dialog.dialog.connect("destroy", open.on_closeButton_clicked) |
727 | + open_dialog.dialog.hide() |
728 | + open_dialog.dialog.destroy() |
729 | |
730 | def on_fetch_interval_spinbutton_value_changed(self, widget): |
731 | self.config.write_content_value("RSS", "fetch_interval", |
732 | @@ -449,8 +449,6 @@ |
733 | Open location search dialog |
734 | @param widget: GTK-Widget |
735 | """ |
736 | - add_button = self.widgets.get_widget( |
737 | - "location_add_button").set_sensitive(False) |
738 | location_dialog = self.widgets.get_widget("weather_search_dialog") |
739 | location_dialog.set_title(_("Add location")) |
740 | |
741 | @@ -470,7 +468,6 @@ |
742 | """ |
743 | widget = self.widgets.get_widget("treeview_locations") |
744 | model = widget.get_model() |
745 | - selection = widget.get_selection().get_selected() |
746 | self.weather_locations = [] |
747 | str_folders = "" |
748 | self.config.write_content_value("Weather", "location", str_folders) |
749 | @@ -754,7 +751,7 @@ |
750 | False) |
751 | self.widgets.get_widget("treeview_locations").set_sensitive(False) |
752 | |
753 | - def add_to_model_and_config(self, selected_folder, model, folders, type): |
754 | + def add_to_model_and_config(self, selected_folder, model, folders, kind): |
755 | """ |
756 | Add selected_folder to the model and the folders list while updating |
757 | the configuration item section specified by type |
758 | @@ -770,10 +767,11 @@ |
759 | if "" in folders: |
760 | folders.remove("") |
761 | str_folders = ";".join(folders) |
762 | - self.config.write_content_value(type, "folders", str_folders) |
763 | + self.config.write_content_value(kind, "folders", str_folders) |
764 | |
765 | - def init_model(self, model, list): |
766 | + def init_model(self, model, items): |
767 | """Fill model with items from supplied list""" |
768 | - for i in range(len(list)): |
769 | - if not str(list[i]).strip() == "": |
770 | - model.insert(i, [list[i]]) |
771 | + for i in range(len(items)): |
772 | + if not str(items[i]).strip() == "": |
773 | + model.insert(i, [items[i]]) |
774 | + |
775 | |
776 | === modified file 'entertainerlib/utils/feed_utils.py' |
777 | --- entertainerlib/utils/feed_utils.py 2009-01-26 18:28:26 +0000 |
778 | +++ entertainerlib/utils/feed_utils.py 2009-02-07 17:12:21 +0000 |
779 | @@ -110,7 +110,7 @@ |
780 | @param filename The OPML file |
781 | @return list(String) List of RSS feed urls |
782 | """ |
783 | - list = [] |
784 | + feeds = [] |
785 | if os.path.isfile(filename): |
786 | #this loads the xml from the opml file into xmldoc |
787 | xmldoc = minidom.parse(filename) |
788 | @@ -118,16 +118,16 @@ |
789 | xmldoc = minidom.parse(urllib.urlopen(filename)) |
790 | #the rss feeds are in the xmlUrl attributes of the outline tags |
791 | #we loop through all the outline nodes in the opml file and add |
792 | - #the contents of any xmlUrl attributes to the list variable |
793 | + #the contents of any xmlUrl attributes to the feeds variable |
794 | for node in xmldoc.getElementsByTagName('outline'): |
795 | url = node.getAttribute('xmlUrl') |
796 | #drop any items which are .opml files or empty string |
797 | #We do not recursively parse opml links as we could end up with an |
798 | #infinite loop |
799 | if (url.strip() != "") and ((url.strip() [-5:]) != ".opml"): |
800 | - list.append(url) |
801 | + feeds.append(url) |
802 | #returns the list of rss feeds from the opml file |
803 | - return list |
804 | + return feeds |
805 | |
806 | def get_liferea_opml(self, home_dir=os.path.expanduser("~")): |
807 | """ |
808 | |
809 | === modified file 'entertainerlib/utils/open_feed_source_dialog.py' |
810 | --- entertainerlib/utils/open_feed_source_dialog.py 2008-12-19 04:06:18 +0000 |
811 | +++ entertainerlib/utils/open_feed_source_dialog.py 2009-02-07 17:12:21 +0000 |
812 | @@ -68,10 +68,10 @@ |
813 | gtk.RESPONSE_OK)) |
814 | |
815 | #set dialog up to filter for only opml files |
816 | - filter = gtk.FileFilter() |
817 | - filter.set_name(_("OPML files")) |
818 | - filter.add_pattern("*.opml") |
819 | - dialog.add_filter(filter) |
820 | + file_filter = gtk.FileFilter() |
821 | + file_filter.set_name(_("OPML files")) |
822 | + file_filter.add_pattern("*.opml") |
823 | + dialog.add_filter(file_filter) |
824 | |
825 | #set dialog up to allow multiple selections |
826 | dialog.set_select_multiple(True) |
827 | |
828 | === modified file 'entertainerlib/utils/preferences_dialog.py' |
829 | --- entertainerlib/utils/preferences_dialog.py 2009-01-27 01:51:57 +0000 |
830 | +++ entertainerlib/utils/preferences_dialog.py 2009-02-07 17:12:21 +0000 |
831 | @@ -81,10 +81,10 @@ |
832 | dialog = gtk.FileChooserDialog(_("Select theme package file"), |
833 | None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, |
834 | gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK), None) |
835 | - filter = gtk.FileFilter() |
836 | - filter.set_name(_("Theme package (tar.gz)")) |
837 | - filter.add_pattern("*.tar.gz") |
838 | - dialog.add_filter(filter) |
839 | + file_filter = gtk.FileFilter() |
840 | + file_filter.set_name(_("Theme package (tar.gz)")) |
841 | + file_filter.add_pattern("*.tar.gz") |
842 | + dialog.add_filter(file_filter) |
843 | status = dialog.run() |
844 | |
845 | # If theme was selected with file chooser |
846 | @@ -109,7 +109,7 @@ |
847 | theme_name = element[:-11] |
848 | is_theme = True |
849 | |
850 | - # Install theme |
851 | + # Install them |
852 | if is_theme: |
853 | tar.extractall(os.path.join(self.config.get_cfg_dir(), |
854 | 'themes')) |
855 | @@ -162,8 +162,8 @@ |
856 | author.set_text(theme.getAuthor()) |
857 | licence = self.widgets.get_widget("licence_label") |
858 | licence.set_text(theme.getLicence()) |
859 | - copyright = self.widgets.get_widget("copyright_label") |
860 | - copyright.set_text(theme.getCopyright()) |
861 | + copyright_label = self.widgets.get_widget("copyright_label") |
862 | + copyright_label.set_text(theme.getCopyright()) |
863 | comment = self.widgets.get_widget("comment_label") |
864 | comment.set_text(theme.getComment()) |
865 | |
866 | @@ -257,7 +257,7 @@ |
867 | |
868 | # Set current theme selected in theme list |
869 | try: |
870 | - iter = model.get_iter_first() |
871 | + index = model.get_iter_first() |
872 | unselected = True |
873 | index_counter = 0 |
874 | while(unselected): |
875 | @@ -265,7 +265,7 @@ |
876 | if name == current_theme: |
877 | unselected = False |
878 | themelist_widget.set_cursor(index_counter) |
879 | - iter = model.iter_next(iter) |
880 | + index = model.iter_next(index) |
881 | index_counter += 1 |
882 | except: |
883 | pass # Error in configfile |
884 | |
885 | === modified file 'entertainerlib/utils/theme.py' |
886 | --- entertainerlib/utils/theme.py 2008-12-15 22:51:24 +0000 |
887 | +++ entertainerlib/utils/theme.py 2009-02-06 08:13:48 +0000 |
888 | @@ -91,6 +91,7 @@ |
889 | """Add every .png files to the image array""" |
890 | img_path = os.path.join(self.theme_path, "images") |
891 | |
892 | + # pylint: disable-msg=W0612 |
893 | for root, dirs, files in os.walk(os.path.join(img_path, folder)): |
894 | for filename in files: |
895 | ext = filename[filename.rfind('.') + 1 :].lower() |
896 | |
897 | === modified file 'entertainerlib/utils/thumbnailer.py' |
898 | --- entertainerlib/utils/thumbnailer.py 2009-01-11 02:13:04 +0000 |
899 | +++ entertainerlib/utils/thumbnailer.py 2009-02-07 17:12:21 +0000 |
900 | @@ -22,17 +22,17 @@ |
901 | MAX_SIZE = 512 |
902 | THUMB_QUALITY = 85 |
903 | |
904 | - def __init__(self, filename, type): |
905 | + def __init__(self, filename, thumb_type): |
906 | |
907 | self.config = Configuration() |
908 | - thumb_dir = os.path.join(self.config.THUMB_DIR, type) |
909 | + thumb_dir = os.path.join(self.config.THUMB_DIR, thumb_type) |
910 | self.filename = filename |
911 | if hashlib: |
912 | - hash = hashlib.md5() |
913 | + filehash = hashlib.md5() |
914 | else: |
915 | - hash = md5.new() |
916 | - hash.update(self.filename) |
917 | - self.filename_hash = hash.hexdigest() |
918 | + filehash = md5.new() |
919 | + filehash.update(self.filename) |
920 | + self.filename_hash = filehash.hexdigest() |
921 | |
922 | if not os.path.exists(self.filename): |
923 | raise ThumbnailerException( |
924 | @@ -46,7 +46,8 @@ |
925 | raise ThumbnailerException( |
926 | 'Thumbnailer filename is a folder : %s' % self.filename) |
927 | else: |
928 | - raise ThumbnailerException('Unknown thumbnail type : %s' % type) |
929 | + raise ThumbnailerException('Unknown thumbnail type : %s' % ( |
930 | + thumb_type)) |
931 | |
932 | def get_hash(self): |
933 | '''Get the hash of the filename''' |
934 | |
935 | === modified file 'entertainerlib/utils/video_thumbnailer.py' |
936 | --- entertainerlib/utils/video_thumbnailer.py 2009-01-11 02:25:00 +0000 |
937 | +++ entertainerlib/utils/video_thumbnailer.py 2009-02-07 17:12:21 +0000 |
938 | @@ -69,15 +69,15 @@ |
939 | self._current_frame = None |
940 | return frame |
941 | |
942 | - def buffer_probe(self, pad, buffer): |
943 | + def buffer_probe(self, pad, buff): |
944 | '''Buffer the probe''' |
945 | - caps = buffer.caps |
946 | + caps = buff.caps |
947 | if caps != None: |
948 | s = caps[0] |
949 | self.width = s['width'] |
950 | self.height = s['height'] |
951 | - if self.width != None and self.height != None and buffer != None: |
952 | - self.set_current_frame(buffer.data) |
953 | + if self.width != None and self.height != None and buff != None: |
954 | + self.set_current_frame(buff.data) |
955 | return True |
956 | |
957 | def reset(self): |
958 | @@ -188,16 +188,14 @@ |
959 | sink_size = (self._sink.width, self._sink.height) |
960 | |
961 | try: |
962 | - duration, format = self._pipeline.query_duration(gst.FORMAT_TIME) |
963 | - except Exception, e: |
964 | + duration = self._pipeline.query_duration(gst.FORMAT_TIME)[0] |
965 | + except Exception: |
966 | ## FIXME: precise this exception |
967 | #Gstreamer cannot determine the media duration using |
968 | #playing-thumbnailing for file |
969 | self.set_pipeline_state(self._pipeline, gst.STATE_NULL) |
970 | - # XXX: rockstar - size is undefined. I need to figure out wtf I |
971 | - # was doing |
972 | - #img = self._play_for_thumb(sink_size, size, 0) |
973 | - #play found img |
974 | + |
975 | + img = self._play_for_thumb(sink_size, 0) |
976 | if img: |
977 | img.save(self._thumb_file) |
978 | return |
979 | @@ -209,7 +207,7 @@ |
980 | if img: |
981 | img.save(self._thumb_file) |
982 | return |
983 | - except VideoThumbnailerException, e: |
984 | + except VideoThumbnailerException: |
985 | #Fallback: No Image found in seek_for, falling back to |
986 | #play_for_thumb |
987 | self.set_pipeline_state(self._pipeline, gst.STATE_NULL) |
988 | @@ -228,7 +226,7 @@ |
989 | ''' |
990 | Plays the video file to gather information for generating a thumbnail |
991 | ''' |
992 | - id = None |
993 | + fileid = None |
994 | self._img = None |
995 | |
996 | if duration >= 250000: |
997 | @@ -249,7 +247,7 @@ |
998 | ## How often Proceed? |
999 | self._counter = 5 |
1000 | |
1001 | - def buffer_probe(pad, buffer): |
1002 | + def _buffer_probe(pad, buff): |
1003 | '''Probe the buffer''' |
1004 | ## Proceed only every 5th frame! |
1005 | if self._every_co < self._every: |
1006 | @@ -258,9 +256,9 @@ |
1007 | self._every_co = 0 |
1008 | |
1009 | try: |
1010 | - img = Image.frombuffer("RGB", sink_size, buffer, |
1011 | + img = Image.frombuffer("RGB", sink_size, buff, |
1012 | "raw", "RGB",0, 1) |
1013 | - except Exception, e: |
1014 | + except Exception: |
1015 | #Invalid frame |
1016 | pass |
1017 | else: |
1018 | @@ -276,7 +274,7 @@ |
1019 | |
1020 | #Releasing self._img |
1021 | self._sink.reset() |
1022 | - pad.remove_buffer_probe(id) |
1023 | + pad.remove_buffer_probe(fileid) |
1024 | self._blocker.set() |
1025 | return |
1026 | |
1027 | @@ -285,20 +283,17 @@ |
1028 | #Counter off, resetting blocker |
1029 | # Is it better to return no image instead of a 'boring' one? |
1030 | if self._img: |
1031 | - # XXX: rockstar - WTF?! Where am I getting size? |
1032 | - #self._img.thumbnail((size, size), Image.BILINEAR) |
1033 | + self._img.thumbnail(sink_size, Image.BILINEAR) |
1034 | if img.mode != 'RGBA': |
1035 | img = img.convert(mode='RGBA') |
1036 | |
1037 | self._sink.reset() |
1038 | - pad.remove_buffer_probe(id) |
1039 | + pad.remove_buffer_probe(fileid) |
1040 | self._blocker.set() |
1041 | |
1042 | |
1043 | self.set_state_blocking(self._pipeline, gst.STATE_PLAYING) |
1044 | |
1045 | - pad = self._sink.get_pad('sink') |
1046 | - id = pad.add_buffer_probe(buffer_probe) |
1047 | self._blocker.wait() |
1048 | self._pipeline.set_state(gst.STATE_NULL) |
1049 | return self._img |
1050 | |
1051 | === modified file 'pylintrc' |
1052 | --- pylintrc 2009-01-06 01:50:25 +0000 |
1053 | +++ pylintrc 2009-02-07 17:12:21 +0000 |
1054 | @@ -53,6 +53,10 @@ |
1055 | #enable-msg= |
1056 | |
1057 | # Disable the message(s) with the given id(s). |
1058 | +# E1101 and E1103 are broken, as it reports non-existing members when the |
1059 | +# member is inherited. |
1060 | +# W0142 checks for * or ** argument magic |
1061 | + |
1062 | # XXX: rockstar - W0613 is a warning about unused arguments. This can be a |
1063 | # little misleading, since cluttergst needs a few parameters that pylint |
1064 | # doesn't see getting used |
1065 | @@ -60,18 +64,13 @@ |
1066 | # XXX: rockstar - W0702 constrains calls to except to specific Exceptions |
1067 | # XXX: rockstar - W0232 ensures that an __init__ method is always present |
1068 | # XXX: rockstar - W0511 checks for XXX, TODO, and FIXME |
1069 | -# XXX: rockstar - W0612 checks for unused variables |
1070 | # XXX: rockstar - W0201 checks for attributes defined outside init |
1071 | -# XXX: rockstar - E1101 and E1103 are broken, as it reports non-existing |
1072 | -# members when the member is inherited |
1073 | # XXX: rockstar - W0703 er, I have no idea what it does |
1074 | -# XXX: rockstar - W0212 stops access to protected members |
1075 | # XXX: rockstar - W0622 stops one from redefining builtins |
1076 | # XXX: rockstar - W0704 checks for empty except |
1077 | # XXX: rockstar - W0221 checks for inherited function signatures for similar |
1078 | # args |
1079 | -# XXX: rockstar - W0142 checks for * or ** argument magic |
1080 | -disable-msg=I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0923,W0613,C0103,W0702,W0232,W0511,W0612,W0201,E1101,W0703,W0212,W0622,W0704,E1103,W0221,W0142 |
1081 | +disable-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 |
1082 | |
1083 | |
1084 | [REPORTS] |
1085 | |
1086 | === modified file 'setup.py' |
1087 | --- setup.py 2009-01-26 17:33:36 +0000 |
1088 | +++ setup.py 2009-02-07 17:12:21 +0000 |
1089 | @@ -33,10 +33,10 @@ |
1090 | result = [] |
1091 | if isinstance(dirs, str): |
1092 | dirs = [dirs] |
1093 | - for dir in dirs: |
1094 | - for root, dirs, files in os.walk(dir): |
1095 | + for directory in dirs: |
1096 | + for root, dirs, files in os.walk(directory): |
1097 | dest = os.path.join(dest_root, root) |
1098 | - source_files = [os.path.join(root, file) for file in files] |
1099 | + source_files = [os.path.join(root, a_file) for a_file in files] |
1100 | result.append((dest, source_files)) |
1101 | return result |
1102 | |
1103 | |
1104 | === modified file 'tools/translations_generator.py' |
1105 | --- tools/translations_generator.py 2009-01-06 23:36:47 +0000 |
1106 | +++ tools/translations_generator.py 2009-02-07 17:12:21 +0000 |
1107 | @@ -50,13 +50,14 @@ |
1108 | headers = [] |
1109 | |
1110 | # Cycle through all the files and collect the necessary data |
1111 | + # pylint: disable-msg=W0612 |
1112 | for root, dirs, files in os.walk(self.lib_dir): |
1113 | if self.exclude in root: |
1114 | continue |
1115 | - for file in files: |
1116 | - full_path = os.path.join(root, file) |
1117 | + for filename in files: |
1118 | + full_path = os.path.join(root, filename) |
1119 | |
1120 | - (path, ext) = os.path.splitext(full_path) |
1121 | + ext = os.path.splitext(full_path)[1] |
1122 | if ext == '.py': |
1123 | files_to_translate.append(full_path) |
1124 | elif ext == '.glade': |
This branch fixes a bunch of small issues, mostly technical debt. The branch
started a few nights ago when I thought "I have time to address some smaller
issues in Entertainer" and then I kept getting greedier and greedier, fixing
more and more issues. Please see the branch itself for the bugs it fixes.
There's no lint, and this branch fixes the broken test. Basically, the test
was asserting that the forecast would read "Today" but the API changed to
return the current day ("Sat" in this case, as it's Saturday).
More lint checks have been enabled. I'm amazed at how much we were stepping on
builtins... :/
Things I'd like you (the reviewer) to check:
- I've made lots of changes, and the tests seem to pass. Please verify that
everything works.
- There were places where I replaced 'type' (a builtin) with 'kind' but it
may be better in that case to call the variable 'foo_type' to indicate what
type is being checked. In some cases, it may not matter. Please make sure
that it doesn't matter.
-- theironlion. net
Paul Hummer
http://
1024/862FF08F C921 E962 58F8 5547 6723 0E8C 1C4D 8AC5 862F F08F