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

enaut

13 years ago

I really love this extension!

But I also have some suggestions to make it even better!

1. It would be cool to copy all covers of the entire Collection into the matching folders by selecting it in a contextmenu or something like that.

2.I have the problem, taht I like the strukture: "/albumname/CD x/files" copycover always puts the cover into the first CD folder and changes the icon of it and not the Album folder. - It would be really great to have that thing working - even though I by myself don't know how to solve the problem.

So if you can find any time it would be really great!

mfg enaut

Report

aaronm67

13 years ago

It looks like there may be a bug with periods in the names? I saw a comment earlier that someone was having trouble finding artist "A", the artist was probably "A.F.I" or something like that. My script ran and stopped on "O.A.R." because it was looking for artist "O".

Report

aaronm67

13 years ago

You can ignore that, that wasn't the problem.

Report

cost-reduction

13 years ago

Thanks!

I'm using MySQL as backend.

The patched script solved the same issue for me, too!

I'm using MySQL as backend

Report

milianw

13 years ago

Hey, I tried to use your copycover-offline.py script but it did not work for me! The MySQL command returned 0 instead of the dir, and I really don't know how your command should work...

Here's my patched version:

http://milianw.de/misc/copycover-offline.py

Here's the diff:

http://milianw.de/misc/copycover-offline.diff

Have a look on it and tell me if this is the intended behavior! It works well for me now.

It's my first time with python and I have to say, I don't like its syntax at all :)

I think I'll now write a little bash script to convert those covers to 50x50 bmps for RockBox.

Report

xrx

13 years ago

tnx millianw. This fixed the zero bug for me!

Report

C

gauret

13 years ago

Ah, that's interesting. Are you using MySQL as a backend ? Do all those who see this "0-as-a-dir" bug use MySQL too ?

Report

richlv

13 years ago

using latest amarok with mysql & copycover, i also get the same error with offline script.

running the normal script only produces repeated errors (empty ones...)

amarok: [ScriptManager] [ERROR!] Copy Cover:
amarok: [AmaroK CopyCover Script] Received notification: playlistChange: changed
amarok: [ScriptManager] [ERROR!] Copy Cover:
amarok: [AmaroK CopyCover Script] Received notification: engineStateChange: playing
amarok: [ScriptManager] [ERROR!] Copy Cover:

could this be because of incompatibility with mysql, too ?

also, configuration has : "Remove from amaroK's cache after copy" - this probably should be changed to "Amarok's" ;)

Report

milianw

13 years ago

yes I use MySQL. Hmm... this might indeed be the problem! It did not even cross my mind that you could use sqlite or postgresql as well!
I fear my query might be very MySQL specific.

I have not used the other ones(for programming yet so I don't know about any differences in their syntax.

Report

animimotus

13 years ago

Nice script but a little crash today:

The CopyCover amaroK script has run into an unhandled error. I'm sorry about it, but please tell me about this error, and help improve the script !
The error message was:
list index out of range
Please look at the end of your ~/.xsession-errors file for error messages too. Thanks.

Thx for this amaroK feature ;)

Report

bugmenot

13 years ago

$ python copycover-offline.py -dv -c cover.jpg
Running in debug mode. No change will be done.

Processing artist: A...
Album: Exit Stage Right... (0)
Album: Vs. Monkey Kong... (0)
Cover Found !
Traceback (most recent call last):
File "copycover-offline.py", line 129, in ?
for file in os.listdir(album_path):
OSError: [Errno 2] No such file or directory: '0'

Amarok 1.4.5, KDE 3.5.6, Gentoo

Report

xrx

13 years ago

I have the same problem, same amarok, and same kdeversion.

Pantheon 11:47:54 copycover $ ./copycover-offline.py -r -d -v
Running in debug mode. No change will be done.

Processing artist: ASP...
Album: Ich Bin Ein Wahrer Satan [4xSingle]... (0)
Cover Found !
Traceback (most recent call last):
File "./copycover-offline.py", line 129, in ?
for file in os.listdir(album_path):
OSError: [Errno 2] No such file or directory: '0'
Pantheon 11:47:58 copycover $

Report

xrx

13 years ago

Pantheon 10:22:20 ~ $ 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 LIKE ASP"

Pantheon 10:23:32 ~ $

Report

C

gauret

13 years ago

Do you really have an artist called "A" in your collection ? Who could that be ?

Could you paste a sample of the following command please ?
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 = A"

Thanks

Report

jcconnor

13 years ago

Looks like the new 1.4.5 Amarok and the use of PyQT 4 has messed up the script. Just checking to see if there is a fix in the works or if there is any way for me to fix it?

Report

bugmenot

13 years ago

I almost had an hearth attack. It worked fine with a few changes, but suddenly kde didn't see anymore any of my songs...
They are there, ls lists them all. Phew.

I'm using amarok 1.4.4, and my library is in /home/user/music. Your offline script tried to write in /user/music/.

I did a quick change to add /home, I'm not posting the diff because that's a dirty hack and will work just for me. Anyway, I think it would be easy to fix it in a clean way.

j.

Report

frenchrh

13 years ago

I'm using Amarok 1.4.4 in KDE 3.5.1a in OpenSuse 10.1, and copy cover, did save one .png cover art file in my correct music directory when I played the song. But its never saved another cover art file. And I don't understand how to run the offline version of the program.

Report

patrickweb

13 years ago

hi,
i have little prob :
on suse 10.2 rc1 i use complete HD in /mp3, i try to run copycover but i already have this message :

The script 'Copy Cover' exited with error code: 1

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
copycover.py: cannot connect to X server :0.0

thanks you for help

Report

goo

13 years ago



--- copycover-offline.py Thu Oct 19 14:28:42 2006
+++ /home/tester/.kde/share/apps/amarok/scripts/copycover/copycover-offline.py Thu Nov 23 22:29:35 2006
@@ -109,8 +109,7 @@
inc = inc + 1
if inc >= len(progress):
inc = 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])
+ dcop_albums = commands.getoutput('''dcop amarok collection query "SELECT DISTINCT album.name, concat( devices.lastmountpoint, '/', tags.dir ) FROM tags, album, devices, directories WHERE tags.album = album.id AND album.name != '' AND directories.dir = tags.dir AND directories.deviceid = devices.id AND tags.artist = %s"''' % artist_tuple[0])
if not dcop_albums:
continue
albums = associateResults2(dcop_albums)
@@ -126,7 +125,7 @@
if options.verbose:
print " Cover Found !"
do_copy = True
- for file in os.listdir(album_tuple[1][1:]):
+ for file in os.listdir(album_tuple[1]):
if file[-4:] in [".jpg", ".png", ".gif"]:
do_copy = False
if do_copy:

Report

comeon

13 years ago

after patching i get:

IndentationError: unindent does not match any outer indentation level

Report

gmichels

13 years ago

I started using your script at version 1.6 and it was working wonders. The only feature I was missing was copying the large cover instead of the 150x150 one. Now I've seen that feature has been added to v1.7, thanks a lot!

I upgraded and it's working nicely, however now the filenames of the copied covers (I use the album name) don't have spaces when the album has several words, it just gets concatenated. Like this:

Album: How To Dismantle An Atomic Bomb

The cover filename: HowToDismantleAnAtomicBomb.png

With v1.6, the cover filename had spaces as the album name.

Am I the only one with this problem?

Cheers!

Report

xhorder

13 years ago

I actually had this problem too, but with 1.6. (I currently can't get offline 1.7 to work)

Report

robert3208

13 years ago

I've tried to use copycover-offline and there's still the ./ issue. Haven't tried copycover yet.

My dirty workaround is to chop off the dot at the beginning (in the copycover function):

destination = destination[1:len(destination)]

What's this ./ thing good for anyway?

R

Report

Saturday

13 years ago

Where exactly do I have to put that definition?

Report

Aikurn

13 years ago

The last time I checked it we were living in 2006... though YMMV :)

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 2
System Tags addon