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: Album Art Downloader XUI (Read 2035121 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Album Art Downloader XUI

Reply #2350
Ah, yeah, I see the issue now. They haven't really understood JSON as a format, have they? Well done getting it working.
It's really odd because they format the XML pretty intelligently. I would have parsed that, but I was told it takes 10x as long to generate the XML compared to JSON and so they don't want it used if it can be avoided.

Quote
Just as a tip, since you say you were considering contributing code to AAD, that suggests to me that you have a development environment and the know-how to be able to build from source. If you build AAD under the Debug configuration, it also compiles the scripts with debug info turned on, and when running AAD under the debugger Visual Studio will quite happily let you set a breakpoint within the .boo script file. It's not quite as nicely integrated as C# debugging, but you can certainly set watches on variable values, which makes script debugging a lot more pleasant than having to write out test log files all the time.

I should have thought to try that on my own. I think it would have cut down on the time this took by half at least.

I'm actually pretty happy with how it works, since the musicbrainz search is pretty good. I can't get 100% targeted results like I wanted, but I think I'm okay with that. The only drawback is that the musicbrainz search is a little slow. For some reason it takes 3-5 seconds for the GetPage to return with the JSON, whereas in a browser it's essentially instantaneous. Only thing I can think of is they might delay results based off the user agent string, or lack thereof.

Edit: And a quick check with spoofed request Headers reveals that's exactly the case. So fast! This would probably be a good addition to the existing musicbrainz.org script:
At the top of the script I added a fanartConstants class:
Code: [Select]
static class fanartConstants:
    public UserAgentString    as string = "AlbumArtDownloader"
    public AcceptString        as string = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
    public AcceptCharset    as string = "ISO-8859-1,utf-8;q=0.7,*;q=0.3"
    public AcceptLanguage    as string = "en-US,en;q=0.8"
    public AcceptEncoding    as string = "gzip,deflate,sdch"

and then I overloaded the Get function like so:
Code: [Select]
    static def Get(url as String, cookies as CookieContainer, referer as String):
        request as System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
        request.Method="GET"
        request.ContentType = "application/x-www-form-urlencoded"
        request.UserAgent = fanartConstants.UserAgentString
        request.Accept = fanartConstants.AcceptString
        request.Headers.Add("Accept-Charset",fanartConstants.AcceptCharset)
        request.Headers.Add("Accept-Encoding",fanartConstants.AcceptEncoding)
        request.Headers.Add("Accept-Language",fanartConstants.AcceptLanguage)
        if not string.IsNullOrEmpty(referer):
            request.Referer = referer;
        if not cookies == null:
            request.CookieContainer = cookies
        response = request.GetResponse().GetResponseStream()
        return System.IO.StreamReader(response).ReadToEnd()

And just replaced all calls to GetPage with Get(url, null, null).

Second Edit: Appears I was wrong. Guess as soon as I tried to test it musicbrainz' load dropped incredibly. Musicbrainz is back to taking 3-5 seconds for a response.

Album Art Downloader XUI

Reply #2351
I'm afraid there's no way setting variables through the command line like in your example - the only thing that is passes through to the script is artist and album. Is there any reason you can't use those, though?


Would it be "easy" to pass in the location of the files? My thinking is that the local search knows where they are (even though that doesn't seem to be a "real" plugin).

Then in my fanartTV.boo I could reference MBArId and MBReId just like we currently can with Artist and Album.


Then maybe you could use the location, plus artist and album to locate the file and read the MBArId and MBReId from the files directly?

I know I have one or two ideas for scripts that would be a LOT easier if I had access to the location. (Basically somehow parsing the existing Folder.jpg and passing it to Google Image Search or Tineye to find a better image)

Matt

Album Art Downloader XUI

Reply #2352
Second Edit: Appears I was wrong. Guess as soon as I tried to test it musicbrainz' load dropped incredibly. Musicbrainz is back to taking 3-5 seconds for a response.
Ah, that's a shame. It would have been nice if it was just a throttling issue!

Would it be "easy" to pass in the location of the files? My thinking is that the local search knows where they are (even though that doesn't seem to be a "real" plugin).
Local search uses the default save location (by default - you can change this in its settings) to search for files. That can be, and almost certainly already is, passed in using the /path parameter, but I don't think it's very relevant to fanartTV - it would be easier to simply use a well known location like %temp% and both write to and read from there. Anyway, MordredKLB has gone with the solution of querying Musicbrainz directly. This has the advantage that you can do a search just from artist and album name like other scripts, so it will work with the file and foobar browsers, and with manually entered queries.

Local files search gets special treatment, when the default save location is changed in the search window, it is also passed directly to the source as a special case. There's no way to do it in the other direction, starting from a source, even if you wrote a completely custom one as a dll because it would cause a circular reference.

Alex

Album Art Downloader XUI

Reply #2353
Would it be "easy" to pass in the location of the files? My thinking is that the local search knows where they are (even though that doesn't seem to be a "real" plugin).
Local search uses the default save location (by default - you can change this in its settings) to search for files. That can be, and almost certainly already is, passed in using the /path parameter, but I don't think it's very relevant to fanartTV - it would be easier to simply use a well known location like %temp% and both write to and read from there.


I meant so that he could parse the files in that location not as a place to write temporary files. IOW: Read the tags directly from the MP3 (FLAC, AAC, whatever) instead of getting them from the command line. Sorry I wasn't clear.

Local files search gets special treatment, when the default save location is changed in the search window, it is also passed directly to the source as a special case. There's no way to do it in the other direction, starting from a source, even if you wrote a completely custom one as a dll because it would cause a circular reference.


Right... in the options there is the "Images will be saved to" For ME at least I would love to have access to that. Is that currently accessible like the Artist and Album tags are inside a script?

That said, I assumed, perhaps incorrectly, that the Local Search looked at where it found the files to do its search but either way I'd settle for having the path the images would be saved to made available if it already isn't.

Thanks!

Matt

Album Art Downloader XUI

Reply #2354
Even if I could reliably find the mp3's (of which there's obviously no guarantee) I'd have to have a tag-reader built in too, and that seems like a crazy amount of work.

Here's my latest revision of the fanart script. Please test it out and let me know if you have any issues (particularly if you try and search for a popular artist and nothing shows up [check to see if images exist on fanart.tv first though!]). I left the logging stuff in (but disabled) in case people are having weird results, but I'll remove it when I think the script is perfect.

The script will return covers and cdArt. Because the cdArt is in the form of transparent PNGs, there are shadows where shadows don't need to be in the art display.  You can search for just an artist or an album and everything should work. There might be issues with special characters but I don't know. I already found one instance where a band (Loudness) was listed in all caps in the JSON fanart returned and then the parsing breaks down because the band name is a key value. *sigh* So if we don't find the band name, I try again with all caps. That probably won't fix much, but who knows.

BTW, Alex, running this in the debugger makes everything so much easier and faster. Took me about 20 minutes to get it building in VS2012 but after that it's been smooth sailing. Thank you so much for the tip.

Album Art Downloader XUI

Reply #2355
Here's my latest revision of the fanart script.
That's a nice script, thanks! Sorry about the shadows, I'll admit when I coded those I did not consider transparent art. Doesn't look too awful, though, and of course it's completely harmless, the actual saved image is exactly as provided by the source. Speed seemed fine to me too, but maybe it's just musicbrainz wasn't under load when I was trying it.

A couple of suggestions: First, I think you might need to add ( and ) to StriptCharacters, or escape them. Second, for the json returned by fanart.tv, do you actually need to match the name of the artist to the key value? Does it ever return multiple values? If it did return multiple values, would there be a reason to exclude the other results? You could just do a
Code: [Select]
for result in fanartResult.Values:
    fanartArtistResult = result["albums"]["${mbid}"]
and avoid all the hassle, couldn't you?

Once you are 100% happy with the script and removed any logging you want to remove, I'll publish it on the online updates list, and include it in the next version of the installer (assuming that's OK by you).

Alex

Album Art Downloader XUI

Reply #2356
Thanks for the kind words. Can't believe I didn't think to just do that with the Artist names. It shouldn't be possible to ever have more than one, but that's definitely the smarter way to do it.

I added the parentheses to StripCharacters. It seemed to work okay without them, but I'm not sure what exactly would happen since I'm already wrapping the search strings in ( ) to get non-exact results back from MB. Good catch.

 

Album Art Downloader XUI

Reply #2357
Here's the final version of the fanart.tv script. Would be awesome if you included this in the official release.

Also, I noticed that the bandcamp script you did a few months ago was broken. I took the liberty of fixing it and made a few minor changes to improve results (most notably allowing artist or album to be blank and not stripping the ampersand character because it messes up the results). You can get bandcamp.boo here.

Album Art Downloader XUI

Reply #2358

Hi, thanks for those - just looking at the fanart script, I notice that it still isn't stripping ( or ). As you said you'd added those, could you check if the version you linked to really is the latest version? It is also still using ${mbidArtist} to look up the result from the json, or did you decide to go back to doing it that way after all?

Thanks for the update to bandcamp too, I've uploaded that to online updates.

Alex

Album Art Downloader XUI

Reply #2359
Well, I'm an idiot. Made my final revisions to an out of date version and then blapped over the most recent changes you had suggested. Fortunately dropbox keeps older versions. The correct and true final fanart.tv script is here. I'm 90% sure of it.


Album Art Downloader XUI

Reply #2361
It's been many, many months since I last used AAD (I was living in a place without any Internet Provider Options, except for the "milionaire-expensive" Satellite connections). Now that I'm "back to civilization"and I started using it again I'm really happy that the program is stronger than ever and with that many souces and good quality results. I even found out that something I once asked for has now been incorporated into the program (filesizes for images already downloaded); I couldn't been happier about it!    (Thank you, Alex!)

I had only one small doubt in my mind: iTunes source script (itunes.boo v0.4) was working OK for me, but it was only looking inside the US store. I'd created the "itunes-BR.boo" in the "iTunes Country Overrides" folder, and I'd deleted a few ones there that did not interest me. And I kept wondering what did I need to do to activate AAD looking for results inside other countries stores (other than just US)... Then I realized I needed to take a look at the CODE writen (and not just copy it)
Code: [Select]
class iTunesBR(iTunes):
    override protected CountryName as string:
        get: return "Brasil"
    override protected CountryCode as string:
        get: return "BR"
I know it might seem ridiculous to some, but it took me a few minutes to realize that I needed to MOVE each Country Override file (e.g. itunes-DK.boo) to the main script foder (one folder up) for it to get "seen" and then start working. I decided to post this experience here since someone else might also be confused as I was at first.

Once again, Alex, my most sincere gratitude and appreciation  for your software that allows me to do cover art searching and retrieving in a fraction of the time it would take to do it manually, album by album. I couldn't put into words how useful it is to me, but sufice it to say I really, really love it! 

Album Art Downloader XUI

Reply #2362
Thanks for your kind words, and glad to have you back with us!

Yes, perhaps I should have put some more instructions about those iTunes scripts in the .zip file. The installer doesn't even include them, in fact, you have to go to the wiki and download the one you want.

Alex

Album Art Downloader XUI

Reply #2363
Quote
Yes, perhaps I should have put some more instructions about those iTunes scripts in the .zip file. The installer doesn't even include them, in fact, you have to go to the wiki and download the one you want.
I can try to write down a readme.htm file for the ITunes country overides folder if you want... (and then you can modify it to your liking later) I still have a Command Line Reference that's old (and unfinished) but useful for you to see the style of the file = http://goo.gl/tCEPmF (Command Line Reference.htm, 96Kb) and maybe I could use some part of it to include in the wiki? ("Using the command line" page item)

I would like to add some new information to the post above, but I couldn't find the "Edit" button there, so I'm putting it down here; There are some improvements suggestions among those items below, but please don't get me wrong, they're just mild suggestions to be implemented in the future and only if easy/possible.

(:01:) It looks to me that it is incredibly useful to include at least 1 iTunes Override in the "Search Fist" options, along with the regular US iTunes (I recommend itunes-GB.boo); It almost always gives better results. (or maybe change the default store to UK? It's just a suggestion - I already know how to do it on my end here...  )

(:02:) I noticed that Play.com has some good artwork too (sometimes around 1600px), any plans on including it as a source in the future?
I've been trying to contribute and build the script myself, but for now, all I've got is a initial search string, I'm not really that good with programming...

[!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]•••>>› (:03:)[/size] I didn't understand the purpose/usage of the "new" (for me) Group by "Page" option, but I would LOVE  to have a Group by "Category"  option. Is it possible/easy to do?
(I can explain the reasoning for having it as an option, but I don't want to bore you with the long details for now...  )

(:04:) Is it possible to have for each source in the panel, among those "hidden options" (by clicking the ... symbol), besides the already existing "Always download full size", an aditional option "Download Full Size IF size is unknown" ?
(I'd like to keep my "Automatically download full size images" at the defauld "never" and allow only a few select sources to download full size, but only if the size is unknown
= EDIT: NEVER MIND, I realized that most sources have a "uniform behaviour", either always giving image size information or not; so, the existing option "always download full size" for each source is enough already.)

[!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]•••>>› (:05:)[/size] Is it possible to have the "Unknown" group on "Group by size" option be placed right at the top (instead of at the very bottom, as it is now), even before the "Extra-Large (over 1000 x 1000)" group?
(It is, almost always, very likely that many images among that group are some of the largest and, indeed, the most desired for downloading)

(:06:) Is it just me or Amazon MP3 source only gives 500px images?

(:07:) I just discovered that double-clicking the image will save it with the default path/name... Isn't this neat?  (lovin' it!!)

And since I really want to contribute, I'm tryin' to develop the [!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]play.com script[/size]

Here's my approach so far on trying to make this script:
(:A:) I mount a query the regular way, with artist and album: query = EncodeUrl(artist + " " + album)
(:B:) I get a page on the server with: "http://www.play.com/Search.html?searchstring=" + query + "&searchsource=0&searchtype=musicall"
(:C:) I get a few results on the generated HTML page and start analysing it:

The part we want to grab on the whole page (the results) only starts after this string: <div class="unit size1of3"><p>Results&nbsp;

(:C1:)  === IMAGE ===
First, for each item found, we have a "media" class <article class="media"> which has an image: p.playserver1.com/ProductImages/4/7/2/2/3/5/5/3/35532274_180x180_1.jpg The site has 4 image sizes: 700px plus ("zoom", often equal to 1600px, with the suffix "_700x700min_1.jpg"), 500px ("large", with the suffix "_500x500_1.jpg"), 300px ("normal"", with the suffix "_300x300_1.jpg") and 180px ("thumbnail"", with the suffix "_180x180_1.jpg"). It's important to notice that 1 or more sizes may not exist for a particular album, as you can see below... (300px does not exist)
http://p.playserver1.com/ProductImages/4/7...00x700min_1.jpg  =  1st image to try and grab
http://p.playserver1.com/ProductImages/4/7...4_500x500_1.jpg  =  2nd image to try and grab (1st fallback)
http://p.playserver1.com/ProductImages/6/8...4_300x300_1.jpg  =  3rd image to try and grab (2nd fallback)
http://p.playserver1.com/ProductImages/4/7...4_180x180_1.jpg  =  thumbnail images

(:C2:)  === INFO ===
Then we have the "media-title" class <p class="media-title"> which usually is the name of the album;
it all points to the same URL throughout, which is the Album page: <a href="/Music/CD/4-/35532274/The-Female-Boss/Product.html?searchstring=tulisa+the+female+boss&searchsource=0&searchtype=musicall&urlrefer=search&strefer=musicall&searchfilters=s%7btulisa+the+female+boss%7d%2bc%7b34%7d%2b"> I think we only need this part of the text above "/Music/CD/4-/35532274/The-Female-Boss/Product.html", and we need to put "http://www.play.com" before it.

(:C3:)  === TITLE ===
Then, in the end of this section ("media-title"), we'll grab the information we need (the album name): >The Female Boss</a> </p>

Next, it's followed by the "sub-title" class <p class="sub-title"> which usually is the name of the artist and the media type: > Tulisa - CD </p>
and we'll also grab this info for the TITLE part.

And this is the initial "skeleton" of the script, in case you're still interested at this point...
Code: [Select]
import System
import System.Text.RegularExpressions
import AlbumArtDownloader.Scripts
import util
class Play(AlbumArtDownloader.Scripts.IScript, ICategorised):
Name as string:
get: return "play.com"
Version as string:
get: return "0.1"
Author as string:
get: return "audio"
Category as string:
get: return "A - Top Digital Stores"
//prepare query string with artist and album
def Search(artist as string, album as string, results as IScriptResults):
artist = StripCharacters("&.'\";:?!", artist)
album = StripCharacters("&.'\";:?!", album)
query = EncodeUrl(artist + " " + album)
//Retrieve the search results page
searchResultsHtml as string = GetPage("http://www.play.com/Search.html?searchstring=" + query + "&searchsource=0&searchtype=musicall")

//I know I should assemble a Regex to extract each group of information now, but I wasn't able to mount it correctly yet (I don't have much experience with regex)
matches = Regex(+++(?<info>[^\"]+)+++(?<img>[^.]+).jpg\"+++>(?<artist>.+?)+++(?<album>.+?)+++", RegexOptions.Singleline | RegexOptions.IgnoreCase).Matches(searchResultsHtml)

results.EstimatedCount = matches.Count

//try to retrieve each of the 4 image sizes from larger to smaller...

def RetrieveFullSizeImage(fullSizeCallbackParameter):
return fullSizeCallbackParameter

[/font]

Album Art Downloader XUI

Reply #2364
maybe I could use some part of it to include in the wiki?
Absolutely - I'm pretty useless about doing documentation, so anything you want to contribute on that front is more than welcome. If you don't already have write-access to the wiki let me know your username and I'll fix permissions for you.

As far as the Command Line Reference goes, I need a plain-text version to include with AAD, but having a nicely formatted one like that too could be useful, I could either include it as an additional file in the installer and zip, or link to it from the wiki.

To answer your other points:
1: I don't see any good reason to make UK the default instead of US, really, and I don't want to have multiple iTunes scripts by default either, that's giving it more prominence than it deserves, really. I could add iTunes country overrides to the installer, unchecked by default, though, like I do with Amazon.

2: There actually was a reason for not doing a script for Play.com, I seem to remember. That was years ago now, though, so I doubt it's still relevant. I'd be happy to include your script once its finished, and if you need any help with it let me know.

3: Group by page was a requested feature. I think the idea is that when a source returns multiple artworks for the same album, it makes it easy to see which ones belong together (so which front goes with which back, for example). For group by Category, I assume you mean the category of the source? That shouldn't be hard to do if it would be useful.

5: I don't agree that Unknown images are generally more desirable than known Large images, so I'm going to leave Unknown at the bottom, sorry. You can always just scroll to the end to see them first, if you want to!

6: Sounds reasonable. Why, do you find larger images using the Amazon MP3 website?

Alex


Album Art Downloader XUI

Reply #2366
Version 1.00

I have finally decided to mark this version as "1.00". This is mostly a statement of intent - that I now regard AAD as feature-complete. I haven't made significant changes in some time, and think the version number should reflect the current stability. I will still continue to fix any bugs reported, and keep the scripts up to date (particularly when a script that has stopped working is reported to me).

For this release, I've added the requested "Category" option to the group-by function, to group by the category of the script for which the result was found. Apart from that, I have also brought all the scripts up to date. SFR Music had to be removed, as the site no longer provides cover art.

Download:
AlbumArtDownloaderXUI.exe (Installer. Recommended)
AlbumArtDownloaderXUI.zip (zip archive for those who don't like installers)
.NET Framework 3.5 SP1 (required, except for Windows 7)Donations


Album Art Downloader XUI

Reply #2368
Download link isn't working. Nevermind

Album Art Downloader XUI

Reply #2369
Hi,

Thanks!

I noticed that with the new version all my Search first settings were gone so now ADD always searches every site. Is there any way to get my settings back to the way they were?

Album Art Downloader XUI

Reply #2370
Is there any way to get my settings back to the way they were?

Huh, that's odd. It's not something I've done on purpose, certainly - I haven't touched the settings or upgrading code at all. Anyway, to upgrade them manually, go to %localappdata%\AlbumArtDownloader\, then look through the folders there starting with AlbumArt.exe_Url_ for the subfolder "0.46.0.0" (or any previous version, of course, if 0.46 wasn't the one you were using before). I can't give you the path exactly because .net appends random characters to it.

Once you've found the subfolder, copy the file user.config from within it. Then find the subfolder "1.0.0.0". (It might not necessarily be in the same AlbumArt.exe_Url_ folder). Paste the user.config over the one that's in that folder, and it will replace the current settings with the one from the previous version.

Then, to prevent it from trying to auto-upgrade (and presumably ruining them again), before you run AAD edit the user.config file in Notepad or similar and search for "ApplicationVersion", and replace the bit which says <value>0.46.0.0</value> (or similar) with <value>1.0.0.0</value>

One thing to bear in mind is that I've renamed the script "Cover-Paradies" to "eCover.to (Cover-Paradies)", so if you had special settings for that you'll need to re-apply those to that source only - sorry.

I hope that gets your settings back for you!

Alex

Album Art Downloader XUI

Reply #2371
Thanks! That worked perfectly. You are fast to reply, as always.

Another minor issue is that with every new build for quite a while now I get a compilation error for the Orchard script so I have to delete that script (in the program folder) to get AAD working. No biggie. I am used to doing that by now.

Album Art Downloader XUI

Reply #2372
Hello Alex,
maybe I missed sth in my options, but since version 1.00 I do not get any results with searching, the Version 0.46 still works fine. I am using Window XP SP3. Has anything
changed with the new version?
Thanks for your help!

Album Art Downloader XUI

Reply #2373
since version 1.00 I do not get any results with searching, the Version 0.46 still works fine.

No, nothing should have changed... do you get any error messages? Do you have the same sources selected? I can't think of any good reason why this would be the case.

Alex

Album Art Downloader XUI

Reply #2374
I don't know if this has been mentioned somewhere in the ~1000 other pages of this thread, if so, i'm sorry.

I seperate my albums by discnumber tag in seperate directories per disc,

meaning:

Artist A\Album A\CD 1\song.mp3
Artist A\Album A\CD 2\song.mp3

when I scan my directories for audio files with AAD it recognizes just the CD 1 directory and throws the fetched covers only in there.

any way I can make it recognize the second (or more) directory too? i dont want to throw all my files in one directory, i think this should be separated
i now have a lot of albums where just one disc has a cover :/


(i know its possible to specify the pattern matching to directories instead of id3 tags, but this isn't possible for me since the second Album directory also contains things like catalog number, if available)