Option to save downloaded album cover art as folder.jpg in music folder

Bug #135936 reported by Adam Olsen
58
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Exaile
In Progress
Wishlist
Ubuntuxer

Bug Description

I use Rockbox on my ipod and there is a patch to display album art if there is a file called folder.jpg in the same folder as the currently playing music file.

Exaile! downloads the album art automatically from Amazon, but saves it to ~/.exaile/covers/blah.jpg.

I think there should be an option in the preferences to determine where the album art should be saved. It should have shortcuts for the artist, album and folder of the currently playing music file as well.

So you could then edit the save location for the album art to be any of the following:
~/Music/Art/ALBUM_NAME.jpg
/path/to/music/file/folder.jpg
/path/to/music/file/AlbumArtSmall.jpg
/path/to/music/file/ALBUM_NAME.jpg
etc....

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

Adam Olsen (arolsen)
Changed in exaile:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Roman (roman-koller) wrote :

Hi there

I just wrote a quick n' dirty solution to "enable" this feature. It isn't even integrated in Exaile.
Download it to a folder of your choice and start it from console using python exaile-cover-mover.py. It worked for me under Ubuntu Linux 6.10 with Python 2.4.4c1, Exaile is an SVN version from ~August 07. It probably works for 0.2.10, too.

It moves fetched covers from ~/.exaile/covers directly to your album folder and names it cover.jpg. So please be sure, every album is in a separate directory.
Check it out!

Known issues:
- Doesn't work for directories with non-Unicode characters

If there's still enough interesting in this script, I'll continue...

Roman

Roman (roman-koller)
Changed in exaile:
status: Confirmed → In Progress
Revision history for this message
fabs (fabs-musicjunkie) wrote :

hi,
thanks for doing some work on this, but for me it doesn't work.
i get no errors, just the Database thing shown below. is there a debug mode or something?

fabs@fabian:~/Desktop$ ./exaile-cover-mover.py
Database: /home/fabs/.exaile/music.db

what can i do to help you?

fabs

Revision history for this message
Roman (roman-koller) wrote :

I forgot, you have to quit Exaile, so the database is not locked anymore.
After a (~short) wait you would have received the message...

Revision history for this message
fabs (fabs-musicjunkie) wrote :

i did quit exaile, but the script stops after just a few milliseconds without a message except the database thing.

Revision history for this message
Roman (roman-koller) wrote :

Strange...
What version of Exaile are you currently running?
Please try this new version and copy the output.

Revision history for this message
fabs (fabs-musicjunkie) wrote :

there seems to be a problem with the database. thats what the problem was. now it works for the first i think about ten covers, but after that it stops. what it does is deleting all covers from the library, so that i have to fetch them one more time. would be a nice feature if covers were saved... will try the new version, when the covers are fetched ... takes some time

Revision history for this message
fabs (fabs-musicjunkie) wrote :

seems to work fine now. i deleted the lines, that delete the covers in .exaile/covers. thank you very much for writing this script. would love if it could be implemented as plugin.

Revision history for this message
Roman (roman-koller) wrote :

I have an error in my first version, I uploaded a bit too fast, so only the first couple of covers are moved. I'm really sorry about this!

Exaile saves all fetched covers, even these that are not used. That's why I delete them all at the end. I added now the possibility not to remove all covers in this version.
Please try it again...

To avoid future data loss, please perform a backup of the file ~/.exaile/music.db and the directory ~/.exaile/covers.

Thanks for your help.

Revision history for this message
fabs (fabs-musicjunkie) wrote :

everything seems to work fine. now it would be really helpful to implement this in the core code or as an plugin, so it's done every x hours or something like that.

fabs

Revision history for this message
Roman (roman-koller) wrote :

At the moment I'm not sure what to do with the script. I am definitely not a fan of plug-ins. I don't like the idea of the plug-in manager because the plug-ins are so hard to find and probably most people don't even take a look at them.

There are already ideas and probably code, too, that provide ability to import CDs and other music files into Exaile and its music folder(s). So, my idea of the best solution is to include this feature into core and use this script as coverter. In the settings there should be a switch where the user can decide if he wants the covers to be saved into Exaile's "cover" folder (like now) or into the album's folder. But this needs verification that every album is saved in a separate directory...

At the moment I don't know what's happening in Exaile's development, so I'll wait implementing this...

Revision history for this message
Roman (roman-koller) wrote :

I improved the script a bit as Johannes wrote to me.
Now all paths are gotten using the function os.path.join and the home directory is gotten using os.path.expanduser('~').

I would be pleased if the script can be shipped within Exaile's scripts folder.

Roman (roman-koller)
Changed in exaile:
assignee: nobody → roman-koller
status: In Progress → Fix Committed
Revision history for this message
Salil (hellfeuer) wrote :

Why do music players save covers somewhere else? Doesn't it make sense to save an album's cover in the album's directory as far as possible?
I would say make this the default behavior

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

Because to assume everyone's music is organized that way would be incorrect.

Revision history for this message
Magnun Leno (magnun-leno) wrote :

Hi there!!

 I was facing the same problem of you guys. So I've wrote a plugin for exaile to copy the covers to the folder and keep it syncronized even if you fetch a new cover in amazon.

The good point of it is that you don't need to close exaile to run it and you don't need to re-run it if you change a cover...

I've called it CoverSync, and I'm still developing some features to it! So I created a project in GoogleCode. Here's the link: http://code.google.com/p/coversync/

For datais about it see the Wiki.

Thanks...

Revision history for this message
lamo (blackvd) wrote :

Magnun Leno, Thanks very much for your plugin! Just bought a cowon o2 and this is going to be very useful.

Revision history for this message
Magnun Leno (magnun-leno) wrote :

Thanks lamo!!

If you notice any bug please report! By the way, I'm finishing some improvements, and soon I'll realease a new version.

If you wish some feature or personalization in it, just ask me and I'll see what I can do! Maybe I can make it to this next release...

See ya...

reacocard (reacocard)
Changed in exaile:
status: Fix Committed → Confirmed
Revision history for this message
Wizzu (wizzu) wrote :

Looks like neither of the solutions listed here work anymore. I installed the CoverSync plugin to latest exaile (Ubuntu Karmic, 3.0.1) but it doesn't show up in the plugins listing in preferences.

As for the exaile-cover-mover.py script... Well, to start with, Exaile puts its files to .local/share/exaile instead of .exaile these days (at least when installed with the Ubuntu package). That's easy to fix in the python script. What's not so easy is that the music.db database file is now BsdDB instead of sqlite, so totally different structure. I tried to hack the script to include support for BsdDB but gave up when i managed to open the db file, but had no idea how the contents were organized. The sqlite-style SQL commands no longer work in any way with BsdDB.

A pity, since Exaile seemed to be able to download quite a few cover art images for my collection.

Revision history for this message
Magnun Leno (magnun-leno) wrote :

Wizzu,

Both, CoverSync Plugin and exaile-cover-mover.py script were designed for Exaile 0.2.x. Now that the Exaile 0.3.x is the current version both became deprecated. I don't know about exaile-cover-mover.py, but I plan to re-write CoverSync for Exaile 0.3.x soon, I just need some new documentation (specially about the database), an working Python Console Exaile Plugin and some spare time.

As soon as I finish this 'port' I'll post here! Thanks for your concern.

Revision history for this message
Ubuntuxer (johannes-schw) wrote :

I wrote a small plugin for Exaile, which move the whole downloaded covers from ~/.local/share/exaile/covers/cache to the tracks' folders. It doesn't keep it syncronized if you fetch a new cover.
Does anybody knows wether there's an event set_cover() or something like that?

Revision history for this message
Ubuntuxer (johannes-schw) wrote :

I rewrote my plugin:
- if you enable the plugin, it will search for all albums and move the cover from ~/.local/share/exaile/covers/cache to the album's folder
- if a new cover is set, the plugin will move the new cover to the album's folder

I added an new event named "cover_changed" to the methode set_cover() in xl/covers.

Please test the plugin and give me feedback.

Changed in exaile:
assignee: Roman (roman-koller) → Ubuntuxer (johannes-schw)
status: Confirmed → In Progress
Revision history for this message
Ubuntuxer (johannes-schw) wrote :

I seperate the patch into the new plugin and the tiny change in 'xl/covers.py'.
I fixed the determination of the image's type, so now it should work fine.

Any suggestions are welcome.

Revision history for this message
Ubuntuxer (johannes-schw) wrote :
Revision history for this message
Ubuntuxer (johannes-schw) wrote :

I renamed the plugin to "Export Covers". Besides you can select the output image file format now.

Revision history for this message
Ubuntuxer (johannes-schw) wrote :

I've made some tiny improvements and updated it to the changes in r2998. In my opinion it's ready for commit. ;-)

Revision history for this message
Ubuntuxer (johannes-schw) wrote :

I've updated the plugin to the current branch of Exaile and uncommented the deleting of Exaile's cache.

Revision history for this message
numberx (k0enig-ch) wrote :

Thanks Ubuntuxer for the new version!
Now I can use it with the current branch. It works really great. Very useful in combination with portable media players e.g. rockbox.
Hope the patch will be integrated in exaile someday.

Revision history for this message
mzenzes (mzenzes) wrote :

May someone update this to be compatible with the newest repository-.version of exaile?

Revision history for this message
mzenzes (mzenzes) wrote :

I'm sorry. Here is a more complete report. I'm having problems with revision 3681, from 2010-08-03 so an old one, too. Here is the traceback:

Traceback (most recent call last):
  File "/home/mzenzes/exaile-old/xl/plugins.py", line 122, in enable_plugin
    plugin = self.load_plugin(pluginname)
  File "/home/mzenzes/exaile-old/xl/plugins.py", line 84, in load_plugin
    plugin = imp.load_source(pluginname, os.path.join(path,'__init__.py'))
  File "/home/mzenzes/exaile-old/plugins/move_covers/__init__.py", line 24, in <module>
    import mcprefs
  File "/home/mzenzes/exaile-old/plugins/move_covers/mcprefs.py", line 2, in <module>
    from xlgui.prefs import widgets
ImportError: No module named prefs
WARNING : Unable to enable plugin move_covers

What could I do?

Revision history for this message
Steve Dodier-Lazaro (sidi) wrote :

'xlgui.prefs' was renamed to 'xlgui.preferences', so you need to change the import line that is pointed out in the traceback.

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.