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

13 years ago

Yeah, my time machine is still in beta. I'll fix it, thanks for reporting :)

Report

lorijho

13 years ago

Hi, here's a patch against copycover 1.6 that honors the changes made to amarok-1.4.1 (as of writing in debian/testing). It will save the large cover file in the large directory instead of the resized (small) file in the cache directory.

!!This patch has only been tested with amarok-1.4.1 (as of now)!!

--- copycover.py 2005-05-31 18:58:46.000000000 +0200
+++ /home/lorijho/.kde/share/apps/amarok/scripts/copycover/copycover.py 2006-10-09 15:49:21.000000000 +0200
@@ -269,6 +269,13 @@
def copyCover(self):
""" Copy a cover to a song's directory """
cover = commands.getoutput("dcop amarok player coverImage")
+ str_cacheFileName = os.path.split(cover)[-1]
+ str_cacheDir = os.path.dirname(cover)
+ str_baseDir = os.path.split(str_cacheDir)[0]
+ str_largeDir = os.path.join(str_baseDir, "large")
+ str_largeFileName = str_cacheFileName.split("@")[1]
+ cover = os.path.join(str_largeDir, str_largeFileName)
+
if cover.endswith('nocover.png'):
return
songDir = self.getAlbumDir()

Report

C

gauret

13 years ago

Thanks, I've merged your patch.

The scripts works for my current amarok, which is 1.4.3. If it stops working when dynamic collections are added, I'll update it (but please remind me :) )
In this next version, your patch will be there.

Report

richlv

13 years ago

hmm... i am surprised it works for you with 1.4.3, as dynamic collection was merged in 1.4.2 ;)

maybe you have it disabled ?

anyway, the script (v1.7) does not work for me in current svn, as it tries accessing relative path without device.
for file in os.listdir(album_tuple[1][1:]):
OSError: [Errno 2] No such file or directory: '/relative_path/A/Alkaline Trio/Alkaline_Trio-Crimson-(Webrip_Advance)-2005-GCA'

Report

alejmatias

13 years ago

when i run "copycover-offline -d" works all fine, but when i run just "copycover-offline" i get the following message

Copying cover for album "Marilyn Manson - Portrait Of An American Family" to ./media/MUSICA/MP3_Music/Marilyn Manson/Portrait Of An American Family/PortraitOfAnAmericanFamily.png
Traceback (most recent call last):
File "./copycover-offline.py", line 119, in ?
copyCover( album_cover, destination )
File "./copycover-offline.py", line 84, in copyCover
shutil.copyfile(source, destination)
File "/usr/lib/python2.4/shutil.py", line 48, in copyfile
fdst = open(dst, 'wb')
IOError: [Errno 2] No such file or directory: './media/MUSICA/MP3_Music/Marilyn Manson/Portrait Of An American Family/PortraitOfAnAmericanFamily.png'

Already cheked for capital leters, permisions, also the folder and the cover exist. My music is in a fat32 partition mounted with umask=000

Please help, and forgive my poor english, i'm writing from Argentina

Report

jsteiner

13 years ago

I've been looking for something like this everywhere, thanks mate :D

Report

richlv

14 years ago

since the introduction of dynamic collection in svn copycover is not working :

No such file or directory: './data/m/A/Alkaline Trio/Stupid Kid'

dynmaic collection splits path in relative path & mountpoint, so probably copycover should be updated to work with the new condition.

if there are no huge problems, dynamic collection will be in 1.4.2, which will mean no working copycover.

Report

richlv

13 years ago

... and with 1.4.2 released (including dynamic collection) copycover script now does not work in a stable release

Report

triptol

13 years ago

Only looked into copycover-offline...

Changing line 112 from:
for file in os.listdir(album_tuple[1]):

To:
for file in os.listdir(album_tuple[1].lstrip('.')):

Seems to fix it.

The new album_tuple seems to have a '.' in front of the path, effectively making the absolute path a relative one (why-oh-why?). Removing it, changes it into an absolute path again...

Now I'm not sure yet, whether the files are copied correctly as well... Will see about that.

Report

kswenson

13 years ago

I have a similar problem except it is now using an invalid absolute path in the following form. I'm using version 1.7.

If my username is UNAME then the path that it looks at is "/UNAME/my/music/files/".

I went to line 130 and changed
"for file in os.listdir(album_tuple[1][1:]):"
to
" for file in os.listdir(album_tuple[1][0:]):"

and the script works if I run it from my /home directory because it builds paths that look like "./UNAME/my/music/files/".

Thanks for writing this thing. It is nice and I hope you can sort out this issue.

Report

sid6point7

14 years ago

first of all: great skript! I searched for something like that quite a long time.

The online version works fine, but for the first time I tried to run the offline skript, from amarok as well es the command line. In both cases I get the following:
"
Traceback (most recent call last):
File "copycover-offline.py", line 16, in ?
import distutils.sysconfig
ImportError: No module named distutils.sysconfig
"
ok, it wants to have a module called distutils.sysconfig, but where can I get it? And where do I have to put it?

But anyway: Great skript!
Thanks a lot!

---
amarok 1.4.1
suse 10.1

Report

sid6point7

14 years ago

ok ok I have it!
It's in the package python-devel.
Now it's working.
I love it!

Report

richlv

14 years ago

while using 1.6 copycover with svn amarok, it prints all the time empty error messages :

amarok: [ScriptManager] [ERROR!] copycover.py:

this does not impact it in any other way, as far as i can tell. covers are succesfully copied to the corresponding directories.
error is displayed when starting the script up and at every notification it is sent (track change, volume change etc)

--------------
a suggestion - provide the capability to use album name, but use some user-defined prefix. that would better handle situations when several tracks from different albums are stuffed in a single directory.
additionally, some control over album name translation would be nice - for example, album names can contain slashes/backslashes and other symbols that some or all filesystems can not handle.

--------------
if covers really are downsized when copying, i'd back hishuu's suggestion - to keep the original size. even amarok itself has a choice of 'show fullsize'

--------------
and thanks for this useful script :)

Report

hishuu

14 years ago

is there a way to have CopyCover not scale the cover images down to 150x150? I know that's the maximum size Amarok shows, but it'd be niec to keep all the original detail - you can often get 300x300 images from amazon.

just a suggestion, thanks!

Report

Superstoned

14 years ago

does this work on amarok 1.4? i'd love to get my covers in MY control ;-)

Report

C

gauret

14 years ago

Yep, I'm using amarok 1.4 beta 3 right now and it works fine.

Report

Superstoned

14 years ago

that was quick. i did run it, but it told me nothing - just took some heavy cpu for some time. it should tell what did happen, now i'm not really sure if it did work.

anyway, if it did work - thanx. but how can i use the offline script to move all pics from the cache to the directories? and does it set the folder picture?

Report

rokkford

14 years ago

copycover doesn't work always, just when the collection is updated and you just fetched a cover. otherwise no covers are copied. that's a pitty.

any way to make this more stable?

Report

Marshalle

14 years ago

Hey I've always used this in the past but it doesn't seem to work on the latest version of Amarok, anyone else got this problem?

Cheers.

Report

C

gauret

14 years ago

I'm running amarok 1.3.8 and it seems to work fine here. Do you have interesting messages in your ~/.xsession-errors ?

Report

Marshalle

14 years ago

Hmmm, don't think so, perhaps I've missed something. I'm running Suse 10. Could you please confirm the dependencies then? (Incase there is something in that).

Thanks!

Q

Report

C

gauret

14 years ago

It should only depend on PyQT (which is installed by default on SuSE IIRC), but it will warn you it it is not available.

Remember that the cover will not be copied if there is already an image file in the folder, png, jpg or gif (check for hidden files).

Report

visit0r

14 years ago

I get "broken pipe" error after a while running the offline script. amaroK 1.3.8 @ Ubuntu Breezy.

Report

HessiJames

14 years ago

Hi,
I have some folders with files from different albums. CopyCover seems to copy just one cover to that folder and associates every file in that folder with that cover.
I have set up CopyCover to use the album name as the covers's file name.

Report

samppa72

14 years ago

Hi,

Just wondering, why my folder icons wont change after I run the script (or the offline 1). Pictures are there, and so are the .directory documents, but somehow my kde filemanager accepts only actual paths into them; (Tried tweaking filemanager setup with no luck whatsoever)..

not working:
[Desktop Entry]
Icon=./GOLDGreatestHits.png

[URL properties]
ShowDotFiles=true

But THIS WORKS:
[Desktop Entry]
Icon=/part2/MP3_biisit/ABBA - GOLD: Greatest Hits/GOLDGreatestHits.png

[URL properties]
ShowDotFiles=true

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