CopyCover (amaroK Script)
Amarok 1.x Scripts
Score 50%
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

garthps

7 years ago

Is there any news about this?
Because I am rely interested. I have also email the author to aske him if he plan this..

Report

garthps

7 years ago

in fact! I have done a clone of this for amarok 2 and it is here : http://www.kde-apps.org/content/show.php?content=113293

Report

hachel

8 years ago

I have a gnome-desktop and I can't get it to work. I had to install pyqt3 otherwise it wouldn't start.
Is there anything I have to install in order to use the offline-script?
It just does this:
Quote:$ python copycover-offline.py -c cover.jpg
copycover-offline.py:17: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
Done.
and there is a rotating little bar for a couple of seconds until it says "done",
but nothing has happened, cover-wise.
any help?

Report

hachel

8 years ago

ok, if I use -v i get all the "processing artist xxx"-stuff, but that's it, changing the script like j4n said doesn't work either, same as before.

Report

tecuya

8 years ago

This script does not work with amarok's Dynamic Collection feature.

The following change (removing the devices table from the query) solves the issue for dynamic collection devices:



Quote:
--- copycover/copycover-offline.py 2007-10-21 07:04:22.000000000 -0700
+++ copycover_mine/copycover-offline.py 2009-01-09 15:52:05.000000000 -0800
@@ -116,8 +116,9 @@
inc = inc + 1
if inc >= len(progress):
inc = 0
- dcop_albums = commands.getoutput('''dcop amarok collection query "SELECT DISTINCT album.name, CONCAT(devices.lastmountpoint,'/',tags.dir) FROM tags, album, devices ''' \
- +'''WHERE tags.album = album.id AND tags.deviceid = devices.id AND album.name != '' AND tags.artist = %s"''' % artist_tuple[0])
+
+ dcop_albums = commands.getoutput('''dcop amarok collection query "SELECT DISTINCT album.name, tags.dir FROM tags, album ''' \
+ +'''WHERE tags.album = album.id AND album.name != '' AND tags.artist = %s"''' % artist_tuple[0])

if not dcop_albums:
continue

Report

rakekniven

8 years ago

Please port the script for Amarok 2

Thank you

Report

Takahani

8 years ago

Hi,

I'm trying to write exactly the same script using qtscript, let U know when it's finished ...

Report

arealityfarbetween

8 years ago

Any advance on this? I would be very interested in this as i just did a distro upgrade and was looking forward to amarok 2-plays nice but copycover is essential to me!

Report

Takahani

8 years ago

Yo,

Right now it can retrieve the current album url, problem is we'll have to wait for amarok 2.1 because the script API has been extended just for this functionnality, and this will be available for everybody only at this stage (2.1) ...
But I'll post here when it'll be finish

Report

mahen

8 years ago

Yep, I would also definitely be interested in an Amarok 2 port of this essential script.

Report

gentiL

8 years ago

Thanks for the script. The part integrated with Amarok works great.

My problem is with the offline version.
It does something and I have tried with both -d and -v to see but it does not copy the files over to the destination.
It just says processing artists... and their names.

I have python 2.5.2 and Amarok 1.4.10.

I also tried adding -c folder.jpg

Am I doing something wrong?

Thanks!

Report

j4n

8 years ago

No, I had the same issue. After some twiddling I found the problem: the script uses the "CONCAT" function, which sqlite does not provide- maybe the author uses mysql?
Here is a patch (replaces CONCAT (foo,bar)' with 'foo || bar').
Copy to file bar.patch and apply with patch -p0 bar.patch.

paste below sucks, no code format possible here, so grab it here: http://pastebin.com/f5e7bcc5f
Quote:
--- copycover-offline.py.org 2008-12-29 21:50:41.000000000 -0500
+++ copycover-offline.py 2008-12-29 22:01:40.000000000 -0500
@@ -116,7 +116,7 @@ for artist_tuple in artists:
inc = inc + 1
if inc >= len(progress):
inc = 0
- dcop_albums = commands.getoutput('''dcop amarok collection query "SELECT DISTINCT album.name, CONCAT(devices.lastmountpoint,'/',tags.dir) FROM tags, album, devices ''' \
+ dcop_albums = commands.getoutput('''dcop amarok collection query "SELECT DISTINCT album.name, devices.lastmountpoint || '/' || tags.dir FROM tags, album, devices ''' \
+'''WHERE tags.album = album.id AND tags.deviceid = devices.id AND album.name != '' AND tags.artist = %s"''' % artist_tuple[0])

if not dcop_albums:

Report

bony

8 years ago

Thank you for that nice script. Worked quite fine. I used the offline version for copying the files and renaming them to "Folder.jpg".
PROBLEM: Some files actually are png-files and now are named with the wrong file type causing problems with my mp3 player.

"Bug" or bad usage?

Christoph

Report

crumley

8 years ago

Several versions of the copycover-offline script didn't working for me - including checkob's above. I first tried sqlite, and now I am using mysql. After it didn't work with mysql, I decided to play muck around with the SQl a bit, even though I SQl was new to me.

What I found was that the dcops_album = line was failing for me due to the fact my devices table was empty:

mysql> SELECT * FROM devices;
Empty set (0.00 sec)

So I removed the references to devices in that line and fixed later spots so that they didn't depend on devices. Obviously that isn't the best way to fix things, but it worked for me.

Does anyone have any better suggestions?

Report

downdiagonal

8 years ago

That is where the script is having problems for me also. Would you mind sharing the changes you made?

Report

crumley

8 years ago

Sure, you can have my version. I put it at: http://sites.google.com/site/stuff009/files/copycover-offline.py

Report

downdiagonal

8 years ago

Thank you very much for sharing that. It worked perfectly!

Report

ac4000

8 years ago

You rock. That script (especially with the update) was massively helpful. Thanks.

Report

Bake

9 years ago

Hi,
I use Ubuntu 8.04 and when I run the script in Amarok 1.4.9 there is this error:

sh: kdialog: not found
Traceback (most recent call last):
File "/home/bake/.kde/share/apps/amarok/scripts/copycover.py", line 27, in <module>
from qt import *
ImportError: No module named qt

I installed pyqt4. What can I do?
Sorry if this a very stupid question but I'm a Linux newbie.

Report

skulled

9 years ago

sudo apt-get install python-qt3

Report

checkob

9 years ago

hi,

I've developed an bug fix for the 'concat' problem in the offline-copycover script.

the fixed script should now work for any database backed cause the string concatenation is made in python now, and no more in the database language.

here is it, just replace the old copycover-offline.py with that one:
http://attachr.com/private/d55ec021e8df30cbe0f922821554d57b

Report

checkob

9 years ago

a guy from irc ( Ramblurr ) was that nice to host the script at an permanant place here it is:
http://binaryelysium.com/code/copycover-offline.txt

thanks again

Report

TommyHLW

9 years ago

At first: I love this script!!!!!

Is it possible to give the folders a non-absolut path for the foldericon?
something like "/cover.png", insteat of "/media/hda3/music/artist/album/cover.png"

I think it's not really pretty, if i want to use the same harddrive on my other pc and they are only folders without any icons, because the absolut path is a different on the second pc.

Report

v6lur

9 years ago

To show "Cover.png" from current directory as icon:
Icon=./Cover.png

To show "Artist - Album.png" from parent-directory's subdirectory named "Covers":
Icon=./../Covers/Artist - Album.png

Report

stillingen

9 years ago

I have Amarok 1.4.9.1 (Ubuntu Hardy) running Sqlite. I've done the modifications to copy-offline.py but the covers are not copied. Are there other modifications needed to my version of Amarok?

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

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
1.9
updated Oct 21 2007
added Mar 31 2005
downloads today
0
page views today 0