[SOLVED] command line album cover download script help
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi to all. I would like to write a bash script to retrieve album coverart for my music library. First I'd like to ask don't tell me to Google. I've googled until my eyeballs are googlely. I've also searched this forum -- maybe I didn't use the correct terms, I don't know. Anyway I'd like to run the script, go to bed and tomorrow morning all my shiny album covers will be stored in the appropriate album directory.
Here is what I have. I have a dialup internet connection. Don't laugh. Moans and groans are okay. I have MPD with an updated database file. I have current accounts with Amazon, AWS. Also with MusicBrainz and Discogs. I use Tellico to catalog my music. Unfortunately it files the music cover images with filenames that are impossible to associate with the album. I can save the image from Tellico but this is a very tedious process with lots of albums. I have gotten close but it seems help is hard to find. Which tells me a good Linux script for doing this on the command line is archaic and useless in the minds of most people. I'm aware there are plugins for Amarok, etc that do this but I want something for CLI that writes the cover image in each album directly permanently. I have looked over some of the source of plugins and I can't pull what I need from them for a bash script. Much thanks for any help and suggestions.
I suggest you put down a list of steps that the script would need to execute every time it runs. It is a bit difficult from your post, to follow exactly how you want to achieve the retrieval/storage of your album coverart.
Also how do you associate a given album to a link on a website where the coverart is?
I suggest you put down a list of steps that the script would need to execute every time it runs. It is a bit difficult from your post, to follow exactly how you want to achieve the retrieval/storage of your album coverart.
Also how do you associate a given album to a link on a website where the coverart is?
The script would retrieve coverart using the accounts I listed in the original post and put it in the appropriate directory, that is to say, the album directory. The script would use a tag tool like id3v2, mp3info, eyeD3, etc to read the album name from a song in each directory and pass that information along with artist name to the website or sites. To recap:
Collect album name and artist
Query website and retrieve cover
Deposit cover to album directory
and do this for every album directory. Your question about how I would associate the information I want with the website(s) is a good one. I hope someone can help because all the php, python, perl and c++ sources I've looked at might as well be written in Greek.
Last edited by SharpyWarpy; 10-18-2010 at 09:14 AM.
Well, if you want to create a script yourself, let's break it down, what is it we want to do?
You have a file system with music on in, let's say it uses /media/music/<artist>/<album>/<song>.
You've got a source of cover art, let's say http://example.tld/artist_album.png.
So, what you would have to do is enter /media/music, loop over artist, loop over albums and then download the file.
I wouldn't recommend coding this in Bash, but maybe that's just me (SourceMage has it's package manager written in bash... wow.)
Well, if you want to create a script yourself, let's break it down, what is it we want to do?
You have a file system with music on in, let's say it uses /media/music/<artist>/<album>/<song>.
You've got a source of cover art, let's say http://example.tld/artist_album.png.
So, what you would have to do is enter /media/music, loop over artist, loop over albums and then download the file.
I wouldn't recommend coding this in Bash, but maybe that's just me (SourceMage has it's package manager written in bash... wow.)
My situation/condition prohibits learning a programming language. It would take me a year to learn Perl, although I think Perl is good. For some idea of what I'm talking take a look here: http://github.com/pbrisbin/scripts/b...2adc4/coverart
It uses two php scripts, albumart.php and AWSSoapClient.php. If someone knows of a Perl script for this I'll install whatever Perl modules are necessary. As I have said, I have the keys and certs for AWS and MusicBrainz.
Last edited by SharpyWarpy; 10-18-2010 at 12:06 PM.
sharpy I think what zhaozhou is trying to tell you is to write out all the manual steps you would take to get from point a to point b with getting the album art cover.
No one but you knows what needs to be done without that information; no one can even start helping you construct a script until we know what needs to be done.
Okay what I need to do is use the mpd database to query Amazon or MusicBrainz for the album covers and deposit them into the album directories. I don't know how to put it any plainer than that.
Okay for anyone interested in how to download all your album covers in your music directory at one time. I found a Python script called "coverlovin". Writen by James Stewart, https://launchpad.net/coverlovin. Works beautifully while you sleep. Works recursively to copy the album cover into each directory in which you have the contents of an album with the id3 tags properly done. Name of the image file by default is "cover.jpg" but it does NOT overwrite an existing file by that name, instead renaming it to "cover.jpg.bak". An option is there to download small, medium or large image. Hope this helps many I suspect have been looking for this very thing to work with their ipods, etc that display a cover for the playing music. For some players, whether hardware or software, might need the cover art added to the id3 tag, in which case you should make sure said music files have a version 2 tag. The best id3 editor of which I know to add the cover art is eyeD3. Look for eyeD3. For Fedora just do "yum install python-eyed3". Have fun!
Last edited by SharpyWarpy; 05-08-2012 at 10:35 PM.
Reason: additional information
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.