Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to be able to do this:

$ pwd
/home/$USER/music/ripped_music/Monty_Python-Instant_Record_Collection
$ ls
01.The_Executive_Intro.mp3
...
16.The_Lumberjack_Song.mp3
$ mystery_command_or_script .
$ ls
01.The_Executive_Intro.mp3
...
16.The_Lumberjack_Song.mp3
album_cover.jpg
$

Somewhere in the guts of Rhythmbox, totem, etc. this is being done. I'd like to be able to do it myself.

I don't need help actually writing a script. I'd really just like to know if there's something like CDDB for album covers. (Scraping albumart.org is the current working solution.)

share|improve this question
1  
What is it exactly that you want to do with scripts? Do you want to edit scripts that are used by applications and change their values for different/improved functionality or do you want to write new once for a specific application like Rhythmbox?! Can you please edit your question and add more information! –  v2r Mar 29 '12 at 19:41
    
Here's a script to get you started: crunchbanglinux.org/forums/post/114627/#p114627 –  nathwill Mar 29 '12 at 22:20
    
Okay, I've edited to show an example of what I'd like to do. –  John Baber Mar 30 '12 at 11:49
add comment

4 Answers 4

up vote 4 down vote accepted

glyrc is the CLI program you're looking for. Once you've got it compiled and installed, this script will do what you want

#!/bin/ksh

if [[ $# -eq 0 ]]; then
  echo "Usage: $(basename $0) music_file.mp3"
  exit 1
fi

FILE="$1"

ALBUM="$( id3v2 --list "$FILE" |sed -n 's/TALB[^:]*: *//p' )"
ARTIST="$( id3v2 --list "$FILE" |sed -n 's/TPE1[^:]*: *//p' )"

glyrc cover --artist "$ARTIST" --album "$ALBUM"

To compile glyrc following the author's directions you must first

sudo apt-get install libsqlite3-dev libcurl3-dev cmake libglib2.0-dev
share|improve this answer
    
This works brilliantly, thanks. –  Rob Fisher Nov 25 '12 at 9:59
add comment

gmusicbrowser searches Google Images for cover art.

Rhythmbox, according to its FAQ, uses last.fm to download cover art. It used to use discogs (according to a bug report in 2010 I found) but Rhythmbox got banned from it.

share|improve this answer
add comment

This works for now. Unless some "official" way pops up, nathwill's is the answer.

#!/bin/ksh

if [[ $# -eq 0 ]]; then
  echo "Usage: $(basename $0) music_file.mp3"
  exit 1
fi

FILE="$1"

SEARCHTERM="$( \
/usr/bin/id3v2 --list "$FILE" |sed -n '/^Album *: */ {
  s///
  s/ *Year: *\([^,]*\),.*$/ \1/
  s/  */+/g
  p
}' )"

TOP="http://www.albumart.org/index.php?searchkey="
BOT="&itempage=1&newsearch=1&searchindex=Music"
URL="$TOP""$SEARCHTERM""$BOT"

IMGURL="$(wget -O - "$URL" |grep 'View larger image' |head -1 |sed 's/^.*<a href="\([^"]*\)"  *title="View larger image".*$/\1/')"

wget -O cover.jpg "$IMGURL"
share|improve this answer
    
A script that used glyrc to fetch album art and eyeD3 to extract an APIC image inside the mp3 would be an official answer. I'll write one later, but if somebody beats me to the punch, they've answered the question. –  John Baber Apr 29 '12 at 23:13
add comment

While trying to do the same I found Coverlovin, https://launchpad.net/coverlovin/+download and it worked OK for me.

Thanks to webupd8 for signalling it.

http://www.webupd8.org/2011/02/recursively-download-cover-art-for-all.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.