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: CoverDownloader (Read 330332 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

CoverDownloader

New Version (Experimental):
Here's a new version I've been working on. For this you'll require .NET framework 2.0 installed.

Please report any bugs/glitches.

Latest version (Supports iTMS)
Download: [attachment=2550:attachment]
Source (GPL): [attachment=2548:attachment]

If you create anything useful with the source, it would be a good idea to upload it here for everyone to benefit. Note that I probably won't be updating this project again, except maybe to add scripts.
The license requires that you include full sourcecode with any modified version distributed.
It's messy code, and the first and only time I've used C#, so I hope it's of use to someone.

Included site scripts:
  • Walmart.com
  • Buy.com
  • Amazon.com
  • RateYourMusic.com
  • iTunes Music Store
Screenshot:


---------Old Version-----------

This version uses Python scripts to specify sources for cover art. Look in the CoverSources\Scripts folder for more details. Walmart.py is a good template if you wish to write your own (Amazon.py is a mess)

The commandline syntax is quite simple, just coverart.exe <Artist> <Album> <File to save to>
The second two parameters are optional, if a path is not specified it will prompt you with a Save As dialog.

You shouldn't require any VC8 runtimes; it's linked statically.

Extract the entire archive into one folder, there is no need to unzip or do anything with Python24.zip, this is the library for the built-in interpreter and can be read from the zip file.

Note: The scripts in this download file are NOT up to date. Use the scripts attached to this post. Put them in coversources\scripts
Download links:
Download here
Download source here

Updated Scripts for Rate Your Music and Amazon are attached (these are recommended over the ones included in the download archive, for example the Amazon script no longer returns results that don't have valid thumbnails)

Commandline for foo_run:
Code: [Select]
"C:\Program Files\foobar2000\coverart\coverart.exe" "%artist%" "%album%" "$replace(%_path%,%_filename_ext%,)folder.jpg"

Screenshot:

[/s]

CoverDownloader

Reply #1
And it won't work on Windows 98/95/ME 'cos it's unicode.

CoverDownloader

Reply #2
The Amazon.dll doesn't seem to work. I only get Walmart results. Disabling Walmart.dll gives no results at all.

CoverDownloader

Reply #3
Thanks! Works great so far!

CoverDownloader

Reply #4
With Amazon, I get a window panel that says "Done", but blank inside. Walmart works like a champ!

On the Walmart side, is this better or the same as the gui "albumart.exe" that you wrote back in January?



Regards,
Dirk
Surf's Up!
"Columnated Ruins Domino"

CoverDownloader

Reply #5
Hmm, it would seem that the Amazon site's behaviour varies wildly depending on cookies you have set and possibly geographical location. What happens if you visit http://www.amazon.com/exec/obidos/search-h...ece%20of%20mind
using Internet Explorer (not firefox). Do you get results? And does coverdownloader work after that?

Quote
On the Walmart side, is this better or the same as the gui "albumart.exe" that you wrote back in January?


If you mean the .NET one, its almost the same except written in C++ so you don't require the .NET framework. You should get identical results.

CoverDownloader

Reply #6
Your link gives results here using IE but coverart still doesn't give me any amazon results after that (only Walmart works).

CoverDownloader

Reply #7
Could you send me the HTML source of that results page?
Thanks for your help.

CoverDownloader

Reply #8
Ah, been waiting for something like this.

However, Amazon doesnt work, and the wallmart searching is rubbish.
hi


CoverDownloader

Reply #10
Thanks for that. I've had a look at the page Amazon.com served you, and I'm unable to get it to serve me one that looks anything like that. As these pages tend to change quite frequently anyway, I think it would be best to implement some sort of scripting instead of using compiled DLLs. What scripting languages would you like me to try to support? Anything that supports regular expressions should work well for parsing the pages, and as long as the integration into a C/C++ application isn't too difficult I'm willing to support it. I can provide the HTTP and  file IO services needed if the scripting language doesn't support them.

ATM I'm thinking python and/or lua, however I don't actually know how to write script in either of these languages

CoverDownloader

Reply #11
How am I supposed to install this?  I copied everything that was in the rar into my components directroy, and I don't get any errors when foobar starts up.  But, what do I do now?  There is no mention of this component in my preferences now, when I right-click on the albumart panel there is no option to download art...
Is over the of = % over 100

CoverDownloader

Reply #12
It's not a foobar component... yet. Run coverart.exe from the commandline.

the wallmart searching is rubbish.


I know what you mean. If you know of any better sites, please post them here.



CoverDownloader

Reply #15
does it work with foobar 0.8.3
because to me it does not work


CoverDownloader

Reply #17
Thanks for that. I've had a look at the page Amazon.com served you, and I'm unable to get it to serve me one that looks anything like that. As these pages tend to change quite frequently anyway, I think it would be best to implement some sort of scripting instead of using compiled DLLs. What scripting languages would you like me to try to support? Anything that supports regular expressions should work well for parsing the pages, and as long as the integration into a C/C++ application isn't too difficult I'm willing to support it. I can provide the HTTP and  file IO services needed if the scripting language doesn't support them.


Okay, wait.  Are you trying to screen-scrape Amazon pages?  Why?!  They have an API specifically for querying their database, and it is very easy to download cover art with it.

http://www.amazon.com/gp/aws/landing.html

There are a number of examples out on the web.  You can write a reasonably okay version in an hour or so, including the time it takes to register with Amazon.



CoverDownloader

Reply #20
david_dl, please, would you consider using lua language for scripting? it has good support for regular expressions - and foosion did quite some work on his foo_lua component to implement unicode support to them.

on a sidenote, it would be great if you could port his old foo_lua sources to foobar 0.9. i really miss it, it could be used for so many useful things (and maybe one could even implement some sort of service so other plugins could use that lua core too).

CoverDownloader

Reply #21
Thanks for all the suggestions of cover sources.
I'm just posting to let you know I haven't abandoned this, just been busy with other stuff. I had some time today so I started playing with scripting. I thought python looked quite good, so I've created a coversource DLL that uses a python script to retrieve covers. It needs a bit of work before I can release it, but that will happen sometime soon.
I don't actually know python, but after a bit of playing around I found it to be quite a fun language, and very intuitive to use. Just to show you how easy it is, this script, when run by the python coversource provides all the functionality of Walmart.dll in a few lines:
Code: [Select]
import urllib
import re

# GetThumbs(): 'artist' & 'album' are unicode strings
# must return a list of elements in this format:
# (all returned strings can be standard or unicode)
# [string: name,string: url to thumbnail OR buffer containing image data (prefixed with 'data://'): thumbnail data,anything: callback data]
# The callback data will be passed to DownloadArt if/when it is called

def GetThumbs(artist,album):
out=[]
params = urllib.urlencode({'search_query': artist + "+" + album})
f = urllib.urlopen("http://www.walmart.com/catalog/search-ng.gsp?Continue.x=0&Continue.y=0&Continue=Find&ics=20&ico=0&search_constraint=4104&" + params)
rfirst = re.compile("<a\\shref=\"/catalog/product\\.do\\?product_id=[0-9]+\"><img\\ssrc=\"([^\"]+)60X60.gif\"[^>]+alt=\"([^\"]*)\"[^>]*>",re.MULTILINE)
text = buffer(f.read())
iterator = rfirst.finditer(text)
for match in iterator:
out.append([match.group(2),u"150x150",match.group(1)+"150X150.jpg",match.group(1)])
return out

# alternate 'for' loop contents:
# f = urllib.urlopen(match.group(1)+"150X150.jpg")
# out.append([match.group(2),u"150x150","data://"+f.read(),match.group(1)])

# GetCover(): 'userdata' is the last item in the array representing
# the desired thumbnail in the list you returned in GetThumbs()
# must return either the URL of the full-size art
# or, the actual image data (prefixed with 'data://') as before

def GetCover(param):
return param + "500X500.jpg"

[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]moderation: Converted code to codebox to preserve forum layout.[/size]

CoverDownloader

Reply #22
How can i send the parameters for %artist% and %title% from foobar to the downloader. Ist there a plugin required?

CoverDownloader

Reply #23
Cannot wait until this is turned into an actual plug-in or merged with the other album art plugin!!!

CoverDownloader

Reply #24
Well, the python scripting kinda works. But I no longer can work on this, and its become kind of a mess.
Here's a binary and the source code, use parts of it in your own project if you want.

To use, run coverart.exe from the commandline. The zip file python24.zip contains python libraries, there is no need to unzip it, as it can be read from as is.

If you want to write your own script, see coversources\scripts\walmart.py for details. The amazon script is a mess.