![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
Programming Talk This forum is for all programming questions. The questions do not have to be directly related to Ubuntu and any programming language is allowed. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Just Give Me the Beans!
![]() Join Date: Aug 2005
Location: Herning, Denmark
Beans: 55
Ubuntu Breezy 5.10
|
Export covers from amarok to album dirs (to ipod)
Hi to all
I'm using amarok for my music, and gtkpod for my iPod. My iPod is 5th generation, and supports coverimages. But my coverimages is stored via amarok, in the folder ~/.kde/share/apps/amarok/albumcovers/large using names like 0a04f8d1a982b56a6ac8950abaab78a0. (some md5-hash, i guess) I would like to export the pictures from the amarok folder to the album dir. I only know a tiny bit of shell script, but i was hoping that somebody would help me. My idea was to access the ~/.kde/share/apps/amarok/collection.db to get information on which cover belong to which album. And where the album is located. Then copy it to "album_folder_path/cover.png". Then I can use gtkpod to upload the covers.. If somebody would give me a clue how to get going, maybe how to view the content of the collection.db, i would apreciate it. Thanks in advance
__________________
http://www.gnome-look.org/usermanage...?username=otey |
|
|
|
|
|
#2 |
|
Just Give Me the Beans!
![]() Join Date: Aug 2005
Location: Herning, Denmark
Beans: 55
Ubuntu Breezy 5.10
|
Re: Export covers from amarok to album dirs (to ipod)
after looking at the amarok wiki pages I wrote a script to copy the coverimage (set in amarok) to the direktory of the playing song (in amarok)
Code:
#/bin/bash
## Settings
cover_filename="cover.png"
## script
if [ "$(dcop amarok player status)" == "2" ]; then
current_song="$(dcop amarok player path)"
album_dir=${current_song%/*.mp3}
picture_source="$(dcop amarok player coverImage)"
picture_target=$album_dir"/"$cover_filename
album_name="$(dcop amarok player album)"
artist_name="$(dcop amarok player artist)"
if [ "$picture_source" != "$picture_target" ]; then
if [ "${picture_source%%/*nocover.png}" != "" ]; then
cp "$picture_source" "$picture_target"
echo -e "Cover copied: $artist_name - $album_name"
else
echo "No cover set!"
fi
fi
fi
__________________
http://www.gnome-look.org/usermanage...?username=otey Last edited by otey; February 5th, 2006 at 06:46 PM.. |
|
|
|
|
|
#3 |
|
Just Give Me the Beans!
![]() Join Date: Aug 2005
Location: Herning, Denmark
Beans: 55
Ubuntu Breezy 5.10
|
Re: Export covers from amarok to album dirs (to ipod)
Ok.. Made the script go trough the whole playlist, copy covers.
Don't run it, with all files in the playlist. What i did was to add all my albums, then mark them all, and while holding ctrl I picked one song from every album. Then removed the other songs from the playlist. the script: Code:
#/bin/bash
## Settings
cover_filename="cover.png"
## script
while [ "$(dcop amarok player status)" == "2" ]; do
current_song="$(dcop amarok player path)"
album_dir=${current_song%/*.mp3}
picture_source="$(dcop amarok player coverImage)"
picture_target=$album_dir"/"$cover_filename
album_name="$(dcop amarok player album)"
if [ -f "$picture_target" ]; then
dcop amarok player next
else
if [ ${picture_source%%/*nocover.png} != "" ]; then
cp "$picture_source" "$picture_target"
echo "Cover copied: \"$album_name\""
fi
fi
done
__________________
http://www.gnome-look.org/usermanage...?username=otey Last edited by otey; February 5th, 2006 at 06:47 PM.. |
|
|
|
|
|
#4 |
|
5 Cups of Ubuntu
![]() Join Date: Jul 2007
Beans: 24
|
Re: Export covers from amarok to album dirs (to ipod)
nice script guys, thumbs up here
i made a few minor changes first off i have a hell of a lot of mp3s(50k+), and i dont really want to click anything other than "go" and walk away. At the same time i want to be able to see some sort of progress so i added a number increment so i can actually see its doing something. Number increment may seem unnecessary but is kinda handy. kind of like a progress bar as amarok will be left minimized also added some inverted commas to avoid any dirty things like line 21: [: !=: unary operator expected Code:
#/bin/bash
## Settings
cover_filename="cover.png"
cover_number=0
## script
while [ "$(dcop amarok player status)" == "2" ]; do
current_song="$(dcop amarok player path)"
album_dir=${current_song%/*.mp3}
picture_source="$(dcop amarok player coverImage)"
picture_target=$album_dir"/"$cover_filename
album_name="$(dcop amarok player album)"
cover_number=$((cover_number+1))
if [ -f "$picture_target" ]; then
dcop amarok player next
else
if [ "${picture_source%%/*nocover.png}" != "" ]; then
cp "$picture_source" "$picture_target"
echo $cover_number " Cover copied: \"$album_name\""
dcop amarok player next
else
echo $cover_number " No cover set!"
dcop amarok player next
fi
fi
done
Last edited by TheIrishGuy; November 5th, 2007 at 12:16 PM.. |
|
|
|
|
|
#5 |
|
Has an Ubuntu Drip
![]() Join Date: Nov 2006
Location: Israel
Beans: 703
Ubuntu 9.04 Jaunty Jackalope
|
Re: Export covers from amarok to album dirs (to ipod)
Many thanks guys! I was looking for something just like this.
__________________
Intel E6300 / MSI P4M890M / 2GB DDR2 677 / 80GB SATA2 / GeForce 6200TC / DL DVD+-RW / ViewCom 17" LCD |
|
|
|
|
|
#6 |
|
I Ubuntu, Therefore, I Am
![]() Join Date: Feb 2007
Beans: 3,453
Ubuntu 9.04 Jaunty Jackalope
|
Re: Export covers from amarok to album dirs (to ipod)
I made a script to do this myself, but I can't seem to find it again. I managed to put together the query I used to query the amarok database with though:
Code:
SELECT DISTINCT CONCAT('~/.kde/share/apps/amarok/albumcovers/large/',MD5(LOWER(CONCAT(artist.name,album.name)))), tags.dir
FROM album, artist, tags WHERE album.id=tags.album AND artist.id=tags.artist
Code:
dcop amarok collection query "SELECT DISTINCT CONCAT('~/.kde/share/apps/amarok/albumcovers/large/',MD5(LOWER(CONCAT(artist.name,album.name)))), tags.dir
FROM album, artist, tags WHERE album.id=tags.album AND artist.id=tags.artist"
Code:
$ echo -n "david bowiealaddin sane"|md5sum f73bc66afee49e43fffdea0e194cc2fc - Hope this helps. |
|
|
|
|
|
#7 |
|
5 Cups of Ubuntu
![]() Join Date: Jul 2007
Beans: 24
|
Re: Export covers from amarok to album dirs (to ipod)
latest copycover script now works
you can download it from here http://www.kde-apps.org/content/show...?content=22517 once it has copied the images into the destination folders you can use the below script to apply album covers to the folders in Nautilus http://ubuntuforums.org/showpost.php...6&postcount=18 in order to use this script you need to either change the script or rename the png files to folder.png i got this from a nice person in #bash in irc.ubuntu.com test it first (echo) Code:
find . -name "*.png" | while read file; do echo mv "$file" "${file%/*}/cover.png"; done
Code:
find . -name "*.png" | while read file; do mv "$file" "${file%/*}/cover.png"; done
Last edited by TheIrishGuy; November 5th, 2007 at 10:11 PM.. |
|
|
|
|
|
#8 | |
|
Ubuntu addict and loving it
![]() |
Re: Export covers from amarok to album dirs (to ipod)
Quote:
__________________
Check out my Blog about my life and computer software and hardware. http://danielscomps.blogspot.com/ |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|