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

pirchl

14 years ago

Hi,

I just installed your copycover script, and though the offline script seems to work fine, it doesn't copy the cover for my albums with multiple artists to their respective folders, even though the covers have been set trough amorak?

Any idea why this is happening? Is this just me, or a knowen problem. Also, is there a workaround maybe?

Thanks a lot,

Alex

Report

C

gauret

14 years ago

Thanks for the report.
The script does not copy an album to a directory if there is already a picture in this directory. Could that be the reason ?

Report

pirchl

14 years ago

Thank you for your very fast repley. No, I deleted all images in those folders, there are only mp3's in them.

BTW, one other thing I noticed: I hade some albums of german artists whose names containd non english characters. CopyCover wouldn't copy the artwork to those folders too. I then renamed all of them (including tag) and all worked fine. But this is not the case with my various artists albums.

P.S. please keep up the great work with this script, it really is a boon to amarok!

Best regards and thanks a lot,

Alex

Report

C

gauret

14 years ago

> BTW, one other thing I noticed: I hade some albums of german artists whose
> names containd non english characters. CopyCover wouldn't copy the artwork to
> those folders too.

Hmm, I have albums containing non-ascii characters too (é, ö, ...), and CopyCover works for them. Which artists for example ?

> But this is not the case with my various artists albums.

Hmm, I'll have to look at that. Maybe it's handled differently in the database.

Report

snagnever

14 years ago

I made some tests.
iTunes insert the entire jpg file in a id3v2 field, called 'APIC' (probaly from 'Album PICture').

I saw that using a php script, near of that:
$img_content = file_get_contents("./albumimage.jpg");

$song_content = file_get_contents("./song_with_the_albumimage.mp3");

if( str_pos($img_content,$song_content) )
{
echo "The image is inside of it";
}

Report

snagnever

14 years ago

Can it save the image inside the mp3 file? As iTunes and others does, so the image can be viewd by all softs, including iPod-photo.

Report

C

gauret

14 years ago

Right now, this is not possible, mainly because I have no idea how to do that, but also because it would probably bloat the mp3 files (the image only needs to be once in the album dir, not in every song in it)

Report

numa

15 years ago

on SuSE, you will also need python-devel to be able to import the distutils.sysconfig module

Report

nimatar

15 years ago

I've runned the offline version of the script but than realized that I didn't really liked the icons of the directory set to the album cover, but I don't know how to reset them (well, I could do it manually for each dir, but that would be to much work), can anybody tell me where custom icons are set in kde?

It also would be nice if in konqueror the songs (but also the dir maybe) on hover, along whith the other information (like artist, track name, etc.) showed the album cover. But I don't know how difficult it shold be to implement this, maybe it should be implemented in kde first...

Report

C

gauret

15 years ago

To reset the directory icon, juste delete the (hidden) .directory file in the directory. If you have to do it for your whole collection, a simple search for these files should do it.

Concerning the album in konqueror's tooltip, I don't know how to do that (yet), but if I have time I'll look into it.

Report

trisk

15 years ago

addcoverdirs.sh doesn't handle commas in the directory names properly. Here's a fixed version (also with a safer 'find' command). http://www.acm.jhu.edu/~trisk/addcoverdirs (install to ~/.kde/share/apps/amarok/scripts/copycover/addcoverdirs.sh)

Report

cyborg

15 years ago

works perfect for me here on debian testing with amaroK 1.2.3

really neat plugin, love it.

now I can have my covers on my laptop, which isnt that often connected to the net.

Report

KNT

15 years ago

Version 1.5
Message:
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:
[Errno 32] Przerwany potok
Please look at the end of your ~/.xsession-errors file for error messages too. Thanks.

(Przerwany potok == Pipe broken)

.xsession-errors
QClipboard: Unknown SelectionClear event received.
QClipboard: Unknown SelectionClear event received.
QClipboard: Unknown SelectionClear event received.
QClipboard: Unknown SelectionClear event received.
QClipboard: Unknown SelectionClear event received.
(more or less times)

Report

C

gauret

15 years ago

Those bugs should be fixed in version 1.6
Thanks for your report

Report

KNT

15 years ago

Weeeeeelll they are :)

Report

KNT

15 years ago

copycover-offline only produces this when amaroK is being run from the command line:
Traceback (most recent call last):
File "/home/knt/.kde/share/apps/amarok/scripts/copycover/copycover-offline.py", line 120, in ?
copyCover( album_cover, destination )
File "/home/knt/.kde/share/apps/amarok/scripts/copycover/copycover-offline.py", line 86, in copyCover
if remove:
NameError: global name 'remove' is not defined

Report

KNT

15 years ago

Or this:

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:
removeCover
Please look at the end of your ~/.xsession-errors file for error messages too. Thanks.

.xsession-errors shows the same as before and
kio (KIOConnection): ERROR: Header read failed, errno=104
kio (KIOConnection): ERROR: Header has invalid size (-1)
KonqKfmIconView::property( "modified" ) failed: property invalid or does not exist


But the cover is copyed (in the last error it wasn't)
No .directory files are made despite the correct option marked.
Marking the option ,,Remove from amaroK's cache after copy'' causes the error to be ,,Broken pipe'' instead of removeCover but not always.

Report

westyvw

15 years ago

Here is what I am seeing when running the script:

File "./copycover-offline.py", line 83, in ?
artists = associateResults2(dcop_artists)
File "./copycover-offline.py", line 60, in associateResults2
results.append( (output_list[i], output_list[i+1]) )
IndexError: list index out of range

Any ideas? Too many covers?

Report

jcw

15 years ago

This version (1.4) is working absolutely fantastic (for the first time for me, seems I hit that bug too after the first three albums)! Thanks a lot, great work!
I just had to work out why it was still stopping half-through, turned out that I didn't have write permission on all folders. Found that on the console I started Amarok from, otherwise it's hard to find.
But, for me it works, so thanks again!
Bye,

Joost

Report

C

gauret

15 years ago

Thanks for your support !
I'll probably add a check for write permissions in the future, it's a good idea.

Report

spilker

15 years ago

Would be nice if the script can check if the cover in .kde/share/apps/amarok is newer than the cover in the album folder and then overwrite the cover. I recognized after my first run, that the cover fetching code has assigned some wrong covers. I downloaded the correct covers but the script doesn't copy them (even touching the complete albumcovers/large folder doesn't help)

Report

C

gauret

15 years ago

There are two ways to deal with that. Either I allow the script to overwrite the existing cover, but some users may not like it at all, or I let the user just delete the old cover, and it will be replaced automatically.

For now, I chose the second option. If I add your feature, there will be a checkbox to enable it anyway.

So for now, if you want to replace an existing cover, just delete it, and it will be copied from the database on the next play.

Report

spilker

15 years ago

Hello,

the offline script has problems with the / in album name. Creating the cover file does not work.

Album: 48/49...
Cover Found !
Copying cover for album "Beatsteaks - 48/49" to /srv/ftp/pub/mp3/Crossover/Beatsteaks/48.49/48/49.png
Traceback (most recent call last):
File "./copycover-offline.py", line 106, in ?
copyCover( album_cover, destination )
File "./copycover-offline.py", line 73, in copyCover
shutil.copy(source, destination)
File "/usr/lib/python2.3/shutil.py", line 71, in copy
copyfile(src, dst)
File "/usr/lib/python2.3/shutil.py", line 38, in copyfile
fdst = open(dst, 'wb')
IOError: [Errno 2] No such file or directory: '/srv/ftp/pub/mp3/Crossover/Beatsteaks/48.49/48/49.png'

Report

C

gauret

15 years ago

Fixed in version 1.3, thanks for the report !

Report

jcw

15 years ago

Ah, I see. I hoped it would recurse through all available albums and add the corresponding picture to the directory, so one could get all pictures transferred with one step. Perhaps this would be a possible feature addition for 1.2?
Thanks,

Joost

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