Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Automatic album art downloader (Read 23958 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Automatic album art downloader

Hi all,
I made myself a small tool to help getting album art. I use Google Images, but it could use other sources, too. The idea is that with a single hotkey in foobar2000, the tool downloads cover art to a specific location so that it can immediately be seen with an album art plugin. I'm quite happy with it, so thought it could be usable for others, too.

I guess this is more about the concept, but here are steps to get it work using my way. It uses VBS script for launching, wget for getting the image and a web server script to locate and return images from Google. You'll need foo_run plugin, and I'm using the Columns UI's album art viewer.

Download http://ztesch.fi/albumart/albumart.zip, extract to the foobar2000 folder.

Set up a Run Services script called e.g. Run/CoverGetter. The code should be, for example

Code: [Select]
covers.vbs "%artist%" "%album%" "X:\path\covers\%artist% - %album%" 0 500

You should modify the file/path name of the covers. I'm using my own style, and I'm sure this could be used to save cover.jpg images, too, so that the Default UI can easily locate the images.

Value 500 means the maximum resolution of images. If the image is smaller, nothing will be done, and if it's greater, it will be resampled to a width of 500 pixels. Use what you like, or -1 to disable resizing altogether.

Value 0 means that the cover will be fetched from cache, and if no cache exists, it takes the best match from Google Images. Alternative values are 1..n. In this case, the cover art will always be re-fetched from Google Images, and the number denotes which match will be taken - first, second, third, and so on. This is needed, because every now and then an invalid image is returned. The script at the web server currently ranks images according to the width/height ratio (covers are probably close to 1) and size (bigger images are usually better).

So, you'll probably want to create the following commands to Run Services:

Code: [Select]
Run/CoverGetter: covers.vbs "%artist%" "%album%" "X:\path\covers\%artist% - %album%" 0 500
Run/CoverGetter 1: covers.vbs "%artist%" "%album%" "X:\path\covers\%artist% - %album%" 1 500
Run/CoverGetter 2: covers.vbs "%artist%" "%album%" "X:\path\covers\%artist% - %album%" 2 500
...
Run/CoverGetter 9: covers.vbs "%artist%" "%album%" "X:\path\covers\%artist% - %album%" 9 500



Then, create shortcuts to each of them. I use ctrl+§ for the first one (Finnish keyboard), ctrl+1, ctrl+2 .. ctrl+9 for the later re-fetching commands. And finally, make sure the album art plugin is looking at the right place for the covers. I use one directory to hold all of them. After this, all should work fine.

So, this can be used directly, or you could create your own web service to get Google images, shouldn't be too hard. Of course, comments are welcome if there are any problems.

Automatic album art downloader

Reply #1
Hmm nice idea.
For myself I prefer this really cool tool:
Album Art Downloader

Maybe you didn't know it.

Okay your method is more automatic which is good.

But the disadvantage could be that you don't if the quality if the picture is good. Much pixel doesn't mean necessarily  good quality.

Automatic album art downloader

Reply #2
Maybe you didn't know it.

Okay your method is more automatic which is good.

But the disadvantage could be that you don't if the quality if the picture is good. Much pixel doesn't mean necessarily  good quality.

Yes, I know of the tool, but it requires too much interaction, so I never used it too much. I previously used another automated tool, but it was probably not suited for anyone else's usage (requiring a separate database and so on).

You're right, not all images are good ones, but that's why it has the re-fetching feature. If re-fetching is required, it might eventually be slower than manual cover art selection, but I generally get a good match at the first try. And, after all, the album art area in the foobar UI is so small that even a mediocre image is usually acceptable.

Automatic album art downloader

Reply #3
awesome script... thank you.

Automatic album art downloader

Reply #4
Is there any script for foobar, that just shows the cover, when album is playing (no download)?

Automatic album art downloader

Reply #5
why do you need script for that when there is embedded album art support in 0.9.5?

Automatic album art downloader

Reply #6
why do you need script for that when there is embedded album art support in 0.9.5?

Well, how is it possible to show album cover when playing (I mean something like what WMP does, when I insert CD...)?

Automatic album art downloader

Reply #7
awesome script... thank you.

Nice to know that someone managed to make this work with the instructions provided

Is there any script for foobar, that just shows the cover, when album is playing (no download)?

No, as far as I know, all album art components require that the cover image is located at the local computer. If there was support (for example) for HTTP, there would be little need for a tool like this. However, now you only need to push one hotkey, shouldn't be too big a trouble, right?

Automatic album art downloader

Reply #8

awesome script... thank you.

Nice to know that someone managed to make this work with the instructions provided
ofc... so easy, so quick

i don't use one directory to hold all covers (i hold them in albums directory) so i modified the path:
Code: [Select]
covers.vbs "%artist%" "%album%" "$replace(%path%,%filename_ext%,)cover" 0 500

Automatic album art downloader

Reply #9
Thanks fot all the info.. I tried to run the script, but i get this error:



My settings in run services are this:



Any suggestions? Sorry for my strupid questions, i'm a beginner with foobar...

Automatic album art downloader

Reply #10
Thanks fot all the info.. I tried to run the script, but i get this error:

You can't have extra spaces on the command line ("Program files"). Use either just covers.vbs (it should find them from the foobar2000 folder by default) or c:\progra~1\foobar2000\covers.vbs.

Automatic album art downloader

Reply #11

Thanks fot all the info.. I tried to run the script, but i get this error:

You can't have extra spaces on the command line ("Program files"). Use either just covers.vbs (it should find them from the foobar2000 folder by default) or c:\progra~1\foobar2000\covers.vbs.

When I try just covers.vbs, i get this error:


Automatic album art downloader

Reply #12
Are you sure you have both the files covers.vbs and wget.exe in the foobar2000 directory? Exactly the same directory that contains the foobar2000.exe that you are using?

Automatic album art downloader

Reply #13
Are you sure you have both the files covers.vbs and wget.exe in the foobar2000 directory? Exactly the same directory that contains the foobar2000.exe that you are using?


Yes... I copied the whole directory here: http://vasik.zusstod.info/foobar2000.zip (5MB), can you please try it? I would really like to have this function...

Automatic album art downloader

Reply #14
Thank you very much for this script.

Works like a charm!

Automatic album art downloader

Reply #15
Yes... I copied the whole directory here: http://vasik.zusstod.info/foobar2000.zip (5MB), can you please try it? I would really like to have this function...

At least the files seem to be in place. The first error message probably means that the wget.exe can't be found, and the later message that the covers.vbs can't be found. Of course, I don't even know what that language is, let alone understanding it, so can't be totally sure :)

I would continue by simple step-by-step debugging with vb scripts and command lines, but can't really suggest any specific action you should take. Maybe someone with more experience with vb scripting can help.

Automatic album art downloader

Reply #16
It's in Czech...:-) The first error message means:

Script: C:\Program Files\Foobar2000\covers.vbs
Line: 31
Character: 1
Error: System can't find the file
Source: (null)

The second is:

System Windows can't find file covers.vbs. Be sure, that the name is correct, and repeat the action.

Automatic album art downloader

Reply #17
So, I guessed right with the messages. Ok, one more thing to try - first, use the way you get the first message, this one:
Script: C:\Program Files\Foobar2000\covers.vbs
Line: 31
Character: 1
Error: System can't find the file
Source: (null)

Then edit covers.vbs, replace row 27 with this one (I expect your foobar directory is "C:\Program files\foobar2000"...):
Code: [Select]
cmd = """C:\Program files\foobar2000\wget.exe"" -nd ""http://ztesch.fi/albumart/get.php?artist="&URLEncode(artist)& _

 

Automatic album art downloader

Reply #18
It works!!! 

I have one more question - I have now to restart Foobar to show the downloaded cover... Is there any way to reload the cover without restarting?

Thanks a lot...

Automatic album art downloader

Reply #19
It works!!!  :P

I have one more question - I have now to restart Foobar to show the downloaded cover... Is there any way to reload the cover without restarting?

Thanks a lot...

Ok, good :)

My newly downloaded cover image gets shown when I move the selection up and back down - I have selected "Album cover art follows cursor even when playing", so it checks the image again. As mentioned before, I'm using Columns UI's album art plugin.

Automatic album art downloader

Reply #20
Thank You.
Faster than Album Art Downloader.
I got the same error at the first time, too. Now it works; just need to modify the code:
Run services code:
Code: [Select]
Label:
CoverGetter
Path:
C:\Program Files\foobar2000\covers.vbs "%artist%" "%album%" "$replace(%path%,%filename_ext%,)cover" 0 500

And with your vb scripting:
Quote
Then edit covers.vbs, replace row 27 with this one (I expect your foobar directory is "C:\Program files\foobar2000"...):
Code: [Select]
cmd = """C:\Program files\foobar2000\wget.exe"" -nd ""http://ztesch.fi/albumart/get.php?artist="&URLEncode(artist)& _

Automatic album art downloader

Reply #21
I have one more question - I have now to restart Foobar to show the downloaded cover... Is there any way to reload the cover without restarting?

if you are using Columns UI's album art plugin than you just need to press left click once on album art window (that's by default refresh).

Automatic album art downloader

Reply #22
when i click to run the script it doesnt do anything.
How do I know if it worked?

Automatic album art downloader

Reply #23
it does... in background.
when you run the script wait a few seconds and then refresh album art window... you should see cover image... if you don't, then it's not working (you did something wrong)... simple 

maybe your album art plugin is not looking in the right place for the covers.

Automatic album art downloader

Reply #24
Yep, _stranger_ pretty much told how it works. If the album art window shows a black image, it means it has not yet found anything. If it still doesn't show anything after a couple of seconds, it may be that the selected image can't be downloaded (server does not respond, or the image has been removed). In this case, try the "CoverGetter 2" and others to get another image.

Due to the way the images are cached, the script on the web server may not work with names that do not contain ascii characters (Chinese/Japanese etc). You can, of course, make your own script that works better.

And finally, could someone that has had the problem with the wget path (Vasik, eddy@, someone else?) test if it requires the whole path or is it enough if you use this one:
Code: [Select]
cmd = "wget.exe -nd ""http://ztesch.fi/albumart/get.php?artist="&URLEncode(artist)& _