CopyCover (amaroK Script)

Amarok 1.x Scripts

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

2
5 .0
Description:

Copy the cover of current playing track to the song's dir. Does not overwrite
existing images in this folder. The filenames can be configured with the
"Configure" dialog. By default, it's the album's name, with spaces replaced
by underscores.

An "offline" version is also included. If you have amaroK >= 1.2.3,
launch it and run the script on the command line. It will find all the downloaded covers and copy them in the right directory, just as the amarok plugin would have done. It also creates the desktop files.
Make sure you first run the script with the "-d" option (debug mode), in which
the actions will only be printed, not commited. A --help option is available.
AmaroK >= 1.2.3 and python >= 2.3 are required for this offline version.

The copycover-offline.py and addcoverdirs.sh scripts are NOT meant to be run through Amarok's script manager.
Last changelog:

12 years ago

ChangeLog:
Version: 1.9 Date: 2007/10/21
- fix queries when the database is in MySQL
- tell the session manager not to restart the script on login

Version: 1.8 Date: 2007/02/17
- fix the copycover-offline.py script to use the new device path feature of
Amarok. Thanks to all those who sent me a patch.

Version: 1.7 Date: 2006/10/19
- fixes for Amarok 1.4
- progress bar on the offline version
- use large images when available

Version: 1.6 Date: 2005/05/31
- bugfixes for the "remove covers" option
Thanks a lot to Gleb Litvjak and KNT for that.
- write debuginfo to ~/.xsession-errors by default

C

gauret

15 years ago

OK, I've made a script to do what you'd like. It requires amaroK >= 1.2.3 and python >= 2.3. If you have an older python, I could lower the dependency easily, but I think that all the latest distributions have it anyway (well, except Woody of course... ;o) )
amaroK >= 1.2.3 is stricly required however.
The script is available on this page. Run it with --help to see what's available, and run it with -d first to see what actions will be performed.

Report

toyg

15 years ago

There are a couple of errors in your script: the call to "os.basename" should really be "os.path.basename" and when you do "dir_file = open(dir_file_path)" should be "dir_file = open(dir_file_path,"w")" ... at least, this is what I had to change to make it work with python 2.3.4 :)

Great script though, and very good idea.

Report

C

gauret

15 years ago

Yes I saw that just after I uploaded it. It's fixed now, sorry. I secretely hoped noone had noticed... ;o)

Report

C

gauret

15 years ago

Well, I wanted to do that at first, but amarok had no way to do that. Now, with 1.3 and the new dcop query to the database, it may be possible.
However, I need to figure out a way to do that, since the database does not seem to contain the images downloaded from the web, but only the ones in the music directory.

Report

markey

15 years ago

FYI, the query() DCOP call is already in amaroK 1.2.3.

Report

C

gauret

15 years ago

Yes, I said "now with 1.3" but I meant "now with (amarok) 1.2.3".
I still can't find a way to find the (artist,album) couple when I only have the album filename (which is something like 100@, see in .kde/share/apps/amarok/albumcovers/large). Anyway, I'll figure that out eventually. Thanks Markey

Report

jcw

15 years ago

Oh, right now I notice 1.2 is out already, so I mean 1.3...

Report

jcw

15 years ago

This is exactly the thing I was waiting for! Thanks very much!
For me the PyQt-warning also didn't show up.
Now, how do I run this script? I can configure it (f.e. enable folder icon changes), but if I click on run, nothing happens (besides the icon left of the script name changing to play/run). Is there anything else I need to activate?
Thanks,
Joost

Report

C

gauret

15 years ago

No, that's all, you're all set. Play a song for which you have an album cover, and see if the picture is copied to the directory.
I'll look at the PyQt warning problem soon.

Report

Ekardnam

15 years ago

Great script! Just a "hint":
Maybe you should tell that PyQT is required.

Report

C

gauret

15 years ago

Thanks !
If PyQt is not installed, a popup should tell you to install it when you run the script. Is is not the case ?

Report

KabelKasper

15 years ago

Nice script.

I switched the default picture name to .folder.png so that there is not so much visible 'junk' in the folders.
And it works great so far.

But if there is already a picture inside the folder for exsample front.jpg and back.jpg it wont create the .folder.png which would be nice to have the icons for all the folders.

What do you think of a version of your plugin which only creates hidden .folder.png and .directory files without options and call it amarok-foldericons-plugin or s.th. like that?

Report

C

gauret

15 years ago

Well, since it's GPL you can do that if you want of course. It would be pretty easy to do by the way, just remove the checks in the copyCover function.

Report

KabelKasper

15 years ago

I dont think i can do this ;(, even if it's under GPL ;).

But hopefully someone who knows how to do this likes my idea, or maybe you could add an option even to create the files if there is another one already?

It was just an idea, i'm no programmer so i thank you for your great work.

Report

C

gauret

15 years ago

OK. How about simply removing the front.jpg and back.jpg images if you don't want them ? A simple "find" command would do the trick :
find /my/music/folder -iname 'front.jpg' -o -iname 'back.jpg' | xargs rm -f

Report

wjarosz

15 years ago

I've wanted something like this for a while, great work!

I have a suggestion though. Konqueror integration would be great... You could add an option to create a .directory file within the song's folder that has the following in it:

[Desktop Entry]
Icon=./front.png

Of course replacing front.png with the actual configured cover filename.

The will make the icon for the directory be the album's cover image. It might also be a good idea to not modify the .directory file if it already exists.

Report

C

gauret

15 years ago

Well, this was such a good idea that I've just implemented it :)
The .directory file is only created if a cover has been copied in the folder.

Report

C

gauret

15 years ago

Excellent idea ! I'll do that when I have the time (which probably means "this weekend", but no promise)

Report

12 years ago

ChangeLog:
Version: 1.9 Date: 2007/10/21
- fix queries when the database is in MySQL
- tell the session manager not to restart the script on login

Version: 1.8 Date: 2007/02/17
- fix the copycover-offline.py script to use the new device path feature of
Amarok. Thanks to all those who sent me a patch.

Version: 1.7 Date: 2006/10/19
- fixes for Amarok 1.4
- progress bar on the offline version
- use large images when available

Version: 1.6 Date: 2005/05/31
- bugfixes for the "remove covers" option
Thanks a lot to Gleb Litvjak and KNT for that.
- write debuginfo to ~/.xsession-errors by default

12345678910
product-maker Base: 4 x 5.0 Ratings
Be the first to comment
DaiVied
Dec 30 2009
thoughtcrime
Jul 20 2009
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
1.9
updated Oct 21 2007
added Mar 31 2005
downloads 24h
0
mediaviews 24h 0
pageviews 24h 1
System Tags addon