CLI program to download album art

6,163

Solution 1

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

Solution 2

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

Solution 3

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"

Solution 4

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:
6,163

Related videos on Youtube

John Baber-Lucero
Author by

John Baber-Lucero

Updated on September 18, 2022

Comments

  • John Baber-Lucero
    John Baber-Lucero over 1 year

    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.)

    • Admin
      Admin about 12 years
      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!
    • Admin
      Admin about 12 years
      Here's a script to get you started: crunchbanglinux.org/forums/post/114627/#p114627
    • Admin
      Admin about 12 years
      Okay, I've edited to show an example of what I'd like to do.
  • John Baber-Lucero
    John Baber-Lucero about 12 years
    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.