Wont play track if cover image is a bad file

Bug #136159 reported by Adam Olsen
8
Affects Status Importance Assigned to Milestone
Exaile
Fix Released
High
Adam Olsen

Bug Description

When trying to play a song, I get the message

"Couldn't recognize the image file format for file '/home/ja/.exaile/covers/23f26710d26c2b95317961eab6def748.jpg'"

When I click OK on the dialog, playback stops.

The biggest problem here is that because playback has stopped, I cant change the album cover! This feature shouldn't require the song to be playing perhaps.

I have a bad jpg album cover (It's actually a web link that I saved as .jpg accidentally I think). But I have no way of changing it without deleting said file from filesystem.

This ticket was migrated from the old trac: re #713

Changed in exaile:
importance: Undecided → High
Revision history for this message
Omair Mohammed Abdullah (omairabdullah) wrote :

I got this when I tried to reproduce the bug

next track was reported as xxxxxxxxxxxxxxxxx
-----------------------
 play ( /home/oma/exaile/xl/player.py @ 581):
-----------------------
Traceback (most recent call last):
  File "/home/oma/exaile/xl/player.py", line 597, in play
    self.next()
  File "/home/oma/exaile/xl/player.py", line 666, in next
    if not self.play_track(track):
  File "/home/oma/exaile/xl/player.py", line 558, in play_track
    self.exaile.cover_manager.fetch_cover(track)
  File "/home/oma/exaile/xl/covers.py", line 333, in fetch_cover
    self.exaile.cover.set_image(coverfile)
  File "/home/oma/exaile/xl/xlmisc.py", line 996, in set_image
    pixbuf = gtk.gdk.pixbuf_new_from_file(image)
GError: Couldn't recognize the image file format for file '/home/oma/.exaile/covers/85e83fd8a1b4cba8e952315448b74bd7.jpg'

The same error also occurs in cover manager
Traceback (most recent call last):
  File "/home/oma/exaile/xl/covers.py", line 238, in fetch_covers
    fetcher = get_cover_fetcher(self.exaile)
  File "/home/oma/exaile/xl/covers.py", line 222, in get_cover_fetcher
    FETCHER = CoverFetcher(exaile)
  File "/home/oma/exaile/xl/covers.py", line 455, in __init__
    self.total = self.calculate_total()
  File "/home/oma/exaile/xl/covers.py", line 632, in calculate_total
    image = gtk.gdk.pixbuf_new_from_file(image)
gobject.GError: Couldn't recognize the image file format for file '/home/oma/.exaile/covers/85e83fd8a1b4cba8e952315448b74bd7.jpg'

Revision history for this message
Omair Mohammed Abdullah (omairabdullah) wrote :

Here is a patch for the xl/covers.py file that fixes both the issues
But this patch doesn't inform the user that any error happened. The popup which gave the original error message is gone.
I would like to know how to keep that popup and keep playing back the file.
This is my first contribution to exaile....any suggestions are welcome.

Revision history for this message
Dan O'Reilly (oreilldf) wrote :

You can import the traceback module, which has a command (I think it's traceback.print_exc(), check the python documentation on it) that will give you the traceback. If you just wanted the actual error message itself, you can use:
except gobject.GError, e:
Where e is the actual name of the error. And use xlmisc.log() to add it to the exaile log.

Revision history for this message
Adam Olsen (arolsen) wrote :

I've added your original patch to the repository.

In order to show an error without stopping playback, you can use the xl.player.ExailePlayerErrorWindow.

Here's an example:

error_window = ExailePlayerErrorWindow(exaile.window)
error_window.log("This is a sweet error")
error_window.show_all()

I hope this helps.

Changed in exaile:
assignee: nobody → arolsen
milestone: none → 0.2.12
status: New → Fix Committed
reacocard (reacocard)
Changed in exaile:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.