This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Request for help with script to copy album cover art

Tags: None
(comma "," separated)
Mainiak Blaniak
Registered Member
Posts
2
Karma
0
Hi Folks,

I'm hoping to get some help here.  My goal is to have Amarok transfer album art to an SD card being used by my mp3 player.  I have never written a script before, and am not a programmer (the last program I wrote was a "hello world" thing in commodore basic, 20+ years ago :-)  )

first, some background: mp3 player is a Sansa e250R running rockbox, and using a 4gb microSD card for music storage.  As the player runs in the original firmware when connected to the pc, and the original firmware won't recognize the 4gb card, I have to transfer music to the card directly using a cardreader.  I have AmaroK set up to see the card as a media device, so music transfers are no problem (treated as a generic media player).

Rockbox requires album art to reside in the album's file folder, and to be named cover.bmp. 

Currently, I have all of my album cover art stored in the respective album folders, in the rockbox compatible format, on the PC.
Now I need to migrate it to the corresponding album folders on the sd card, preferrably at the same time that music is transferred to the card via AmaroK.

I came across this script in a couple places on the web:

#!/bin/bash

COVER_SIZE="100x100"
LOCAL_ROOT="/local/music/root"
ROCKBOX_ROOT="/rockbox/music/root"

COVER_ORIG=`dcop amarok player coverImage`
FILENAME_TMP=`dcop amarok player path`
FILENAME=${FILENAME_TMP#*//}
DIRNAME=`dirname "$FILENAME"`
COVER_SCAL=$DIRNAME"/cover.bmp"
DIRNAMER=`dirname "$FILENAME" | sed "s*$LOCAL_ROOT*$ROCKBOX_ROOT*g"`
COVER_SCALR=$DIRNAMER"/cover.bmp"

echo "Oryginal cover file: "$COVER_ORIG
echo "Currently played: "$FILENAME
echo "Directory for cover at local HD: "$DIRNAME
echo "Scaled cover file at local HD: "$COVER_SCAL
echo "Directory for cover at Rockbox: "$DIRNAMER
echo "Scaled cover file at Rockbox: "$COVER_SCALR

if [ -f "$COVER_SCAL" ]
then
echo "Scaled cover is already there"
elif [ `echo $COVER_ORIG | grep -c "100@nocover.png"` -gt 0 ]
then
echo "Amarok has no cover for that album"
else
echo "Scaling cover ..."
convert "$COVER_ORIG" -geometry $COVER_SIZE "$COVER_SCAL"
fi

if [ -f "$COVER_SCALR" ]
then
echo "Scaled cover is already in Rockbox"
elif [ `echo $COVER_ORIG | grep -c "100@nocover.png"` -gt 0 ]
then
echo "Amarok has no cover for that album"
else
echo "Scaling cover ..."
convert "$COVER_ORIG" -geometry $COVER_SIZE "$COVER_SCALR"
fi

Thanks to these individuals:
Richard (Chain) Homonnai

Based on rockbox_cover by
Adrian (Sauron) Siemieniak

Based on cover_desktop by
Bellegarde Cédric

According to the author, this script 'should' do what I want.  However, it appears to be doing nothing at the moment.

I'm hoping that someone here might either point me in the direction of where I need to go to fix it, or explain how to run it, other than going to the script manager in amarok and hitting the run button.

Thanks for the help
User avatar
gaillou
Registered Member
Posts
22
Karma
0
OS
Are you using amarok 1.x ?
Mainiak Blaniak
Registered Member
Posts
2
Karma
0
sorry, yes I am running 1.4


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]