HydrogenAudio

Hosted Forums => foobar2000 => Uploads - (fb2k) => Topic started by: filon on 2004-12-09 00:48:51

Title: Walmart' 500x500 album covers download script
Post by: filon on 2004-12-09 00:48:51
Helllo!

I would like to share my script for downloading covers from Walmart, which are 500x500 pixels!

Short usage:
walmart.py "keyword ... keyword" [dest_dir] [image_name_no_extension]

You can specify no parameters, only dest_dir parameter, or both dest_dir and image_name.
If you don't specify image_name, files will be named after artist and album name from Walmart search.
If you don't specify dest_dir, files will go to the current directory.

Example usage:
walmart.py "abbey lincoln straight ahead"
walmart.py "abbey lincoln straight ahead" "D:\Abbey Lincoln\Straight Ahead" "folder"

In the second case file will be saved as "D:\Abbey Lincoln\Straight Ahead\folder.jpg"
When multiple matches are found, they will be saved as folder.jpg, folder1.jpg, folder2.jpg...

For best experience, combine it with foo_openwith and write a preset for it. Then just a few clicks and cover is downloaded (if it's availlabe in Walmart store)
(foo_openwith configuration shown in the next post)

Cheers!

Get it now:
walmart.py (http://sokrates.mimuw.edu.pl/~filon/walmart.py)

Update:
Removed some debug code. File updated.

Update:
Of cource, it needs Python installed to work. Grab it from python.org (the link (http://www.python.org/ftp/python/2.4/python-2.4.msi)). In case you don't know: it's something like Java Runtime Environement or .NET Runtime Environment that you probably have already installed (in fact it's not only RE, but SDK).

NEW:
Changed expressions for getting name of the file, to accomodate for
change in Wal-Mart pages. The script will work again! :-)
Hopefully, fixed problems with zip file too.
Title: Walmart' 500x500 album covers download script
Post by: filon on 2004-12-09 01:35:09
You can try to set
"Application path" to ""walmart.py", and
"Main Parameters" to 
Code: [Select]
"%artist% %album%" "$replace(%_path%,\%_filename_ext%,)" folder
in foo_openwith configuration.
Remember also to set Pre and Post parameters empty.

By the way, I use it for batch downloading with help of shell script, find, grep and sed (a bunch of unix tools)

Update:
"python.exe" before "walmart.py" is not needed.
Added "\" before "%_filename_ext%", wthout it command doesn't work.
Title: Walmart' 500x500 album covers download script
Post by: filon on 2004-12-09 06:45:32
Confirmed that it's working fine also on Windows.
Title: Walmart' 500x500 album covers download script
Post by: dewey1973 on 2005-01-25 21:07:24
I love your plug in/script!

I have a problem.  I had to do a clean install of foobar so I am trying to reinstall your script.  Now when I unzip the zip file it thinks walmart.py is a folder and unzips it as such.  Any idea on how I can prevent this from happening?
Title: Walmart' 500x500 album covers download script
Post by: scummboy on 2005-03-28 16:21:19
I can't actually download any images with the script. I've tried:

Code: [Select]
walmart.py "ZZ Top Rio Grande Mud" "path\to\music\" "folder"


and nothing happens. Could Walmart have changed something, or am I not using it right?
Title: Walmart' 500x500 album covers download script
Post by: loft on 2005-04-19 21:40:41
Same here!
Title: Walmart' 500x500 album covers download script
Post by: seethru on 2005-05-03 04:07:59
just downloaded this, and the zip is apparently empty.
Title: Walmart' 500x500 album covers download script
Post by: picmixer on 2005-05-03 06:49:03
Quote
just downloaded this, and the zip is apparently empty.
[a href="index.php?act=findpost&pid=294938"][{POST_SNAPBACK}][/a]


Not here.
Title: Walmart' 500x500 album covers download script
Post by: Sandman2012 on 2005-05-03 07:53:47
Quote
Quote
just downloaded this, and the zip is apparently empty.
[a href="index.php?act=findpost&pid=294938"][{POST_SNAPBACK}][/a]


Not here.
[a href="index.php?act=findpost&pid=294946"][{POST_SNAPBACK}][/a]

Maybe you're getting it from your cache? I can't get the ZIP to open either, whether I click it to download or right-click and "save as..." (using Firefox).
Title: Walmart' 500x500 album covers download script
Post by: Supernaut on 2005-05-03 07:59:55
It appears that the archive is corrupted actually gzipped, rather than zipped:
Code: [Select]
> unzip walmart.py.zip
Archive:  walmart.py.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in walmart.py.zip,
        and cannot find walmart.py.zip.zip, period.
However when I tried gunzip, it worked:
Code: [Select]
> mv walmart.py.zip walmart.py.gz

> gunzip -v walmart.py.gz
walmart.py.gz:   51.4% -- replaced with walmart.py

> head -n 10 walmart.py
#!/bin/env python

#
# By Filip Kalinski, 2004 - filon@pld.org.pl
#

import urllib
import re
import sys
import os

Edit: To summarise, just rename the file to walmart.py.gz and most archivers should be able to handle it.

Edit: Scratch that, it is a zip, gunzip appears to be able to decompress it, for some weird reason... But the script doesn't download anything, just like scummboy and loft mentioned.
Title: Walmart' 500x500 album covers download script
Post by: Cr4wford on 2005-05-10 02:35:42
I fixed the archive (I believe) with WinRar

I can't figure out how to use it though. If somebody could explain it to me I'd love you  (I got about as far as my firewall alerting me that the script was using the internet. I okayed it but it doesn't download anything)

When I use the foo_openwith configuration, a python commandline pops up, is blank, and then closes. nothing is downloaded.

When I type in

Code: [Select]
walmart.py "the doors la woman" "H:\Music\The Doors" "folder"

it says "invalid syntax" and points to the second quotation. ???
Title: Walmart' 500x500 album covers download script
Post by: Sandman2012 on 2005-05-10 04:23:06
I can't open that one either. It downloads and then 7-Zip can't do anything with it.
Title: Walmart' 500x500 album covers download script
Post by: Cr4wford on 2005-05-10 05:52:36
Quote
I can't open that one either. It downloads and then 7-Zip can't do anything with it.
[a href="index.php?act=findpost&pid=296463"][{POST_SNAPBACK}][/a]


try using WinRAR. I use IZArc, and whenever I have a problem unzipping a file, I use winrar. Usually winrar will work--if not, then the file is totally whack 

edit: try this one
Title: Walmart' 500x500 album covers download script
Post by: filon on 2005-05-13 21:56:38
Uploaded new version with changed expressions for getting name of the file, to accomodate for change in Wal-Mart pages.
The script will work again! :-)
Hopefully, fixed problems with zip file too.

walmart.zip (http://www.hydrogenaudio.org/forums/index.php?act=Attach&type=post&id=1504)

Cheers,
Filip
Title: Walmart' 500x500 album covers download script
Post by: Cr4wford on 2005-05-13 22:51:13
Quote
Uploaded new version with changed expressions for getting name of the file, to accomodate for change in Wal-Mart pages.
The script will work again! :-)
Hopefully, fixed problems with zip file too.

walmart.zip (http://www.hydrogenaudio.org/forums/index.php?act=Attach&type=post&id=1504)

Cheers,
Filip
[a href="index.php?act=findpost&pid=297307"][{POST_SNAPBACK}][/a]


worked  thanks.

the zip file is still corrupted ( made a fixed version if you're interested )

i know it's a shell script, so you can't really do this.. but it'd be pretty nice to be able to preview the images before downloading (because I downloaded like 5 files or so--2 of them which were relevant. it was a "best hits" cd, so it downloaded like three other artists' best hits.)

if it opened an explorer window or the actual images themselves after downloading that'd be pretty cool, so I could easily see what i downloaded

also, it overwrote the folder.jpg i already had in there (no biggie). it'd be kinda cool if it if it just went on to folder1.jpg or something if there was already a folder.jpg

all in all, very cool. thanks a lot. a great, simple, no nonsense program that I can run right out of foobar thanks to openwith. thanks a lot.
Title: Walmart' 500x500 album covers download script
Post by: filon on 2005-05-14 05:43:34
Looks like zips are getting corrupted in the upload process beacuse the file was correct befor uploading. I will try to re-submit the zip file, maybe it will help.

[attachment=1506:attachment]

Result:
Still doesn't work... And it's not allowed to post .py files. Damn!
Title: Walmart' 500x500 album covers download script
Post by: filon on 2005-05-15 19:50:13
Looks like handling of zips is broken. I will post 7-zip (http://www.7-zip.org) compressed file then.

[attachment=1510:attachment]
Title: Walmart' 500x500 album covers download script
Post by: dewey1973 on 2005-05-18 16:54:00
I still cannot access this file 7-Zip is telling me that it is not a supported archive.
Title: Walmart' 500x500 album covers download script
Post by: filon on 2005-05-18 22:08:45
Damn! The file is stripped of last 15 bytes! The same as with .zip file uploaded earlier. Aaarghhh....
Title: Walmart' 500x500 album covers download script
Post by: dano on 2005-05-18 22:12:01
It works here with IE or a download manager, but not with Firefox
Title: Walmart' 500x500 album covers download script
Post by: dewey1973 on 2005-05-19 22:57:09
Quote
It works here with IE or a download manager, but not with Firefox
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=298669")



Got it!  I guess IE is still good for SOMETHING! 

Edit:  Well...  The script isn't downloading anything.  I set it up with foo_openwith exactly as described in post #2 ([a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=29920&view=findpost&p=258625]CLICK HERE[/url])

Any advice?
Title: Walmart' 500x500 album covers download script
Post by: Cr4wford on 2005-05-19 23:49:19
Quote
Quote
It works here with IE or a download manager, but not with Firefox
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=298669")



Got it!  I guess IE is still good for SOMETHING! 

Edit:  Well...  The script isn't downloading anything.  I set it up with foo_openwith exactly as described in post #2 ([a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=29920&view=findpost&p=258625]CLICK HERE[/url])

Any advice?
[a href="index.php?act=findpost&pid=298918"][{POST_SNAPBACK}][/a]


double check to make sure everything's right

you have Python installed, correct?

does it open up the command prompt and do anything?

are you possibly trying to download the cover to a possibly rare cd or anything?
Title: Walmart' 500x500 album covers download script
Post by: dewey1973 on 2005-05-20 00:15:16
Quote
double check to make sure everything's right

you have Python installed, correct?

does it open up the command prompt and do anything?

are you possibly trying to download the cover to a possibly rare cd or anything?



The command window appears, stays empty, and closes.  I know the cover exists at Walmart.com.  I had it working a long time ago (as you can see by the 4th post in this thread.) 

Here is the "sample command" generated by foo_openwith:
Code: [Select]
C:\Program Files\foobar2000\walmart.py "Alice In Chains Jar Of Flies" "E:\FLAC\Alice In Chains\Jar Of Flies" folder
Title: Walmart' 500x500 album covers download script
Post by: jg123 on 2005-06-09 03:11:40
Maybe you code post the code in a CODE block, then people could just copy it and paste it into a .py file. I get a corrupt file, too.
Title: Walmart' 500x500 album covers download script
Post by: filon on 2005-06-09 07:47:09
Quote
Maybe you code post the code in a CODE block, then people could just copy it and paste it into a .py file. I get a corrupt file, too.
[a href="index.php?act=findpost&pid=304721"][{POST_SNAPBACK}][/a]


Good idea! Here it is.


Edit:
Deleted CODEBOX.
Damn! When doing CTRL+C, CTRL+V from codebox, spaces at beginning of the lines are discarded and it breaks any python script.
Title: Walmart' 500x500 album covers download script
Post by: filon on 2005-06-09 14:31:12
Quote
Here is the "sample command" generated by foo_openwith:
Code: [Select]
C:\Program Files\foobar2000\walmart.py "Alice In Chains Jar Of Flies" "E:\FLAC\Alice In Chains\Jar Of Flies" folder

[a href="index.php?act=findpost&pid=298930"][{POST_SNAPBACK}][/a]


It works for me. Check out the version from previous post.
Title: Walmart' 500x500 album covers download script
Post by: dewey1973 on 2005-06-10 07:41:07
Quote
Quote
Here is the "sample command" generated by foo_openwith:
Code: [Select]
C:\Program Files\foobar2000\walmart.py "Alice In Chains Jar Of Flies" "E:\FLAC\Alice In Chains\Jar Of Flies" folder

[a href="index.php?act=findpost&pid=298930"][{POST_SNAPBACK}][/a]


It works for me. Check out the version from previous post.
[a href="index.php?act=findpost&pid=304815"][{POST_SNAPBACK}][/a]


Are you going to replace the code box you deleted?  In the alternative, you could PM me a text file.
Title: Walmart' 500x500 album covers download script
Post by: filon on 2005-06-10 07:56:57
Quote
Quote
Quote
Here is the "sample command" generated by foo_openwith:
Code: [Select]
C:\Program Files\foobar2000\walmart.py "Alice In Chains Jar Of Flies" "E:\FLAC\Alice In Chains\Jar Of Flies" folder

[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=298930")


It works for me. Check out the version from previous post.
[a href="index.php?act=findpost&pid=304815"][{POST_SNAPBACK}][/a]


Are you going to replace the code box you deleted?  In the alternative, you could PM me a text file.
[a href="index.php?act=findpost&pid=304984"][{POST_SNAPBACK}][/a]


Here it is.
Open the link and save the file [a href="http://sokrates.mimuw.edu.pl/~filon/walmart.py]walmart.py[/url].

Cheers!
Title: Walmart' 500x500 album covers download script
Post by: tool++ on 2005-06-10 09:16:45
I find the search terms aren't exact, I keep getting random stuff - for instance "NOFX The War on Errorism" gets random ones with "war" in

So when I search for "Norther Mirror of Madness", it comes up with 8 random files with madness in them, and doesn't actually get the Mirror of Madness album cover - http://www.amazon.com/exec/obidos/tg/detai...=music&n=507846 (http://www.amazon.com/exec/obidos/tg/detail/-/B0000AB14V/qid=1118391613/sr=8-1/ref=pd_csp_1/103-9239656-1032651?v=glance&s=music&n=507846)

Oh right, its wallmart.

Why not do amazon?
Title: Walmart' 500x500 album covers download script
Post by: filon on 2005-06-10 11:22:55
Yes, search results are not always precise but there is nothing I can do about that.

The main reason why I wrote script for Walmart is their 500x500 image resoultion. Amazon offers about 200x200 or something like that, so Walmarts are a lot more detailed.

The script is easily extensible. It's (mainly) just a matter of adding host definition like this:

Code: [Select]
walmart =
{ 'search' :
 { 'url'   : 'http://www.walmart.com/catalog/search-ng.gsp?',
   'query' : 'search_query',
   'args'  : { 'search_constraint': '4104', 'ics' : '5', 'ico': '0' },
   're'    : [ r'<input type="hidden" name="product_id" value="(\d+)">' ] },
 
 'result' :
 { 'url'   : 'http://www.walmart.com/catalog/product.gsp?',
   'query' : 'product_id',
   'args'  : { },
   're'    : [ r'<a href="javascript:photo_opener\(\'(\S+.jpg)&product_id=',
               r'<meta name="Description" content="(.+) at Wal-Mart.*">' ] }
  }
}


If you know another site with quality covers and better search engine, I can add support for it.
Title: Walmart' 500x500 album covers download script
Post by: tool++ on 2005-06-10 16:25:08
Well I know no python but I'll have a go.

With respect to not downloading loose matches, you could always see if the page contains the string "We did not find any matches for your search, but we did find the following matches for" then the script would know that the album has not been found.


E: Christ, amazon is hell-a confusing

Code: [Select]
amazon = { 'search' : { 'url'   : 'http://www.amazon.com/exec/obidos/search-handle-form/',
   'query' : 'field-keywords',
   'args'  : { 'index': 'music', },
   're' :
     [ r'<img src="http://images.amazon.com/images/P/(\d+).01.' ] },
           'result' : { 'url'   : 'http://www.amazon.com/gp/product/images/',
                 'query' : 'product_id',
   'args'  : { },
   're' :
     [ r'<img src="(http://images.amazon.com/images/P/\S+.01._SCLZZZZZZZ_.jpg)',
    r'' ] }


Ok, thats all I could come up with, and it doesn't work. I don't understand how the script works and what vars it needs.

I dunno if you can "fix" that. :S
Title: Walmart' 500x500 album covers download script
Post by: Kreisquadratur on 2005-06-11 14:56:17
Quite right. The "right" code would be:
Code: [Select]
amazon = { 'search' : { 'url'   : 'http://www.amazon.com/exec/obidos/external-search/',
  'query' : 'field-keywords',
  'args'  : { 'index': 'music', },
  're' :
 [ r'<img src="http://images.amazon.com/images/P/([\d\w]+).01.' ] },
          'result' : { 'url'   : 'http://www.amazon.com/gp/product/images/',
                'query' : '',
  'args'  : { },
  're' :
 [ r'<img src="(http://images.amazon.com/images/P/[\d\w]+.01._SCLZZZZZZZ_.jpg)',
   r'<meta name="description" content="Image: (.+)" />' ] }


But there is a problem, that in the second search, there is no query field, so the script would add an unnecessary '=' which is wrong and different from the walmart script.

I did two things, for me and all the others out here:
    1. I converted the script into PHP. I like it more and I have more skills in this language. I tried to keep the source nearly the same as the python script. Sure there could be some PHP specialized optimizations, but I wanted to keep it equal.
To run the PHP script you can use either PHP4 or PHP5. For PHP4 you'll only need the php.exe and the php4ts.dll - for PHP5 you'll need the php-win.exe  and the php4ts.dll. There are only two differences between 4 and 5: (1) is the function http_build_query which is not available in PHP4, so I emulated it. The other thing is the missing try/catch support in PHP4. So I commented some lines. If you use PHP5 you should uncomment these 4-5 lines for better error handling.
    2. I included the amazon search engine. So as there are more than one search engine, I also changed the name of the script to getcover.php To use either your favorite, I implemented another paramater. There you simply can type 'walmart' or 'amazon'. This modification needed to change some lines. But not that worried much.
Code: [Select]
Usage: getcover.php "keyword ... keyword" [dest_dir] [image_name_no_extension] [search_engine]


Give it a try. [attachment=1579:attachment]
Title: Walmart' 500x500 album covers download script
Post by: tool++ on 2005-06-12 12:25:33
I never thought about running php scripts by opening them with the parser :o

I <3 <3 <3 PHP.

You fucking own. *goes to test*

Edit - how do you actually run the damn thing? I've never tried to "run" a script  in this way without a server :S

I've tried associating it with php-win.exe but nothing happens :S

My firewall doesn't do anything - does it even connect to the net?


Is the dest dir in quotes (because many many paths have spaces)

Ok, I got it working. Now to edit to get less false positive ;)

Open with app path:
D:\php5\php

Open with params:
-f D:\foobar2000\getcover.php "%artist% - %album%" "$replace(%_path%,\%_filename_ext%,)" folder amazon
Title: Walmart' 500x500 album covers download script
Post by: Kreisquadratur on 2005-06-12 14:13:43
I don't need the -f command.
I run it with Open With Plugin just like this:

Command name:  Download Cover (Walmart)
Application path:  "E:\Programme\_Internet\PHP 5\php-win.exe"
Pre paramaters:  "E:\Programme\_Audio\foobar2000\getcover.php"[SPACE]
Main paramaters:  "%artist% %album%" "$replace(%_path%,\%_filename_ext%,)" cover walmart
Post parameters:

Command name:  Download Cover (Amazon)
Application path:  "E:\Programme\_Internet\PHP 5\php-win.exe"
Pre paramaters:  "E:\Programme\_Audio\foobar2000\getcover.php"[SPACE]
Main paramaters:  "%artist% %album%" "$replace(%_path%,\%_filename_ext%,)" cover amazon
Post parameters:
Title: Walmart' 500x500 album covers download script
Post by: Cr4wford on 2005-06-13 02:47:23
php script works great. but from amazon i got 14 covers for pink floyd's "wish you were here". most of them were variations of the same cover, but there were also a couple of different covers, as well as the dark side of the moon cover, the wall cover, and animals cover. 14 images total. haha. is there a way to make it so the script only accepts covers that both fit the album and the artist?

edit:
oh, and if you do download cover (amazon) and then download cover (walmart) (or vice versa) the files over write each other.
Title: Walmart' 500x500 album covers download script
Post by: amiti on 2005-06-13 19:20:26
is there a way to run the script window minimized ?
Title: Walmart' 500x500 album covers download script
Post by: Cr4wford on 2005-06-13 20:52:58
Quote
is there a way to run the script window minimized ?
[a href="index.php?act=findpost&pid=305812"][{POST_SNAPBACK}][/a]


use the php script. nothing pops up or anything. just the little hour glass next to your cursor for a second.
Title: Walmart' 500x500 album covers download script
Post by: Kreisquadratur on 2005-06-14 09:28:34
Updated the PHP Script a bit, so no existing files should be overwritten. It just increment the number.

Download from the post above: http://www.hydrogenaudio.org/forums/index....pe=post&id=1581 (http://www.hydrogenaudio.org/forums/index.php?act=Attach&type=post&id=1581)
Title: Walmart' 500x500 album covers download script
Post by: krazy on 2005-06-14 12:34:05
Dunno if you know this yet, but there is a program which implements walmart cover search here:
http://louhi.kempele.fi/~skyostil/projects/albumart/ (http://louhi.kempele.fi/~skyostil/projects/albumart/)

Looks like they got the idea from your script.
Title: Walmart' 500x500 album covers download script
Post by: Kreisquadratur on 2005-06-16 13:04:29
Quote
Dunno if you know this yet, but there is a program which implements walmart cover search here:
http://louhi.kempele.fi/~skyostil/projects/albumart/ (http://louhi.kempele.fi/~skyostil/projects/albumart/)

Looks like they got the idea from your script.
[a href="index.php?act=findpost&pid=306016"][{POST_SNAPBACK}][/a]


Well, seems like there are several programs and scripts out there.

Album Cover Art Downloader
Album Art Aggregator
The python script
The php script
Title: Walmart' 500x500 album covers download script
Post by: bos on 2005-08-29 23:13:44
Thanks for all the good work.  This is a pretty neat little setup, especially alongside foo_toaster and foo_albumart.

I made one little modification that users may wish to add:
Code: [Select]
FIND:
# search for albums

AFTER, ADD
if(file_exists($base_dir . "\folder.jpg")) exit(0);

(assuming windows).

This will prevent the script from executing if a folder.jpg already exists.

It's probably pretty abusive to amazon/walmart, but a quick way to get all of your albums done (assuming you have tracknumbers tagged) is to sort by track number using columns UI, and just select all the track 01's and run this script on them.  This took care of several hundred albums at once for me (I'd do about 100, then wait, then another 100, etc).  Make sure you deselect the option in foo_openwith to "call the command once per group"

Here's my foo_openwith settings:
Command name: Art
Application path: C:\Program Files\foobar2000\php-win.exe
Pre parameters: getcover.phpx
Main parameters: "%artist% %album%" "$replace(%_path%,\%_filename_ext%,)" folder

Notes:
as I said, UNCHECK the "call the command once per group" setting if you plan to grab covers for more than one at a time.

There's a single space after getcover.phpx in pre-parameters

Your paths and filenames will vary (I renamed mine to phpx while testing because I have existing associations for .php that I prefer to preserve).

I downloaded php5 from www.php.net (the zipfile one) but it didn't include php4ts.dll which I believe this script requires.  That file can of course be grabbed from the php4 package (or probably googled for a single download).

I hope this helps someone.  I might write a script to go through downloaded images in folders that have more than one result (I've found that most of these are albums for which a "real" cover could not be located).

Hope this is helpful.

edit - made those scripts:

index.php:
Code: [Select]
<?php

$dir = "e:\\lossless\\";

if(!$_GET) {
    echo "Or you can <a href=\"clean.php\">clean up</a> this folder.<hr>";
    echo "<table>";
    if (is_dir($dir)) {
   if ($dh = opendir($dir)) {
       while (($file = readdir($dh)) !== false) {
    if(filetype($dir . $file) == "dir" && $file != "." && $file != "..")
    {
      $dh2 = opendir($dir . $file . "\\");
      while(($file2 = readdir($dh2)) !== false)
      {
       if(strpos($file2, "folder") === 0 && strpos($file2, ".jpg") !== false)
       {
        $path = urlencode($dir . $file . "\\" . $file2);
        echo "<tr><td><a href=\"del.php?path=$path\"><img src=\"". $file . "/" . $file2 . "\"></a></td><td>" . $dir.$file."\\".$file2 . "</td></tr>\n";
       }
      }
    
    }
       }
       closedir($dh);
   }
    }
    echo "</table>";
}

?>


clean.php:
Code: [Select]
<?php
$dir = "e:\\lossless\\";
$doneFolders = array();
    if (is_dir($dir)) {
   if ($dh = opendir($dir)) {
       while (($file = readdir($dh)) !== false) {
    if(filetype($dir . $file) == "dir" && $file != "." && $file != "..")
    {
      $dh2 = opendir($dir . $file . "\\");
      while(($file2 = readdir($dh2)) !== false)
      {
       if($file2 == 'folder.jpg' && !in_array($file, $doneFolders))
       {
        shell_exec("move \"" . $dir . $file . "\\folder.jpg\" \"" . $dir . $file . "\\glargh.jpg\"");
        shell_exec("del \"" . $dir . $file . "\\folder?.jpg\"");
        shell_exec("move \"" . $dir . $file . "\\glargh.jpg\" \"" . $dir . $file . "\\folder.jpg\"");
        $doneFolders[] = $file;
       }
       elseif(strpos($file2, "folder") === 0 && strpos($file2, ".jpg") !== false && !in_array($file, $doneFolders)) {
        shell_exec("move \"" . $dir . $file . "\\" . $file2 . "\" \"" . $dir . $file . "\\glargh.jpg\"");
        shell_exec("del \"" . $dir . $file . "\\folder?.jpg\"");
        shell_exec("move \"" . $dir . $file . "\\glargh.jpg\" \"" . $dir . $file . "\\folder.jpg\"");
        $doneFolders[] = $file;
       }
      }
    
    }
       }
       closedir($dh);
   }
    }    
?>


del.php:
Code: [Select]
<?php
    shell_exec("del \"" . $_GET['path'] . "\"");
    header("Location: index.php");
?>


Basically, you install EasyPHP (http://www.easyphp.org/), set DocumentRoot and the <Directory> directive below it in the apache config file to your audio dir, eg. "C:\lossless".  Then, put those three php files in that directory (again, eg. C:\lossless).  Visit http://localhost (http://localhost) in your browser, and assuming that the directories under c:\lossless contain your album art, you'll get a list of current art.  Clicking an album cover will delete it.  Delete images until the first one in the list for a given album is the one you want.  Finally, click the link at the top to run cleanup, and it'll delete remaining files (eg. you deleted folder.jpg, folder1.jpg and folder2.jpg - it'll remove folder4.jpg through folder9.jpg).  It also renames your desired image to folder.jpg.

Sounds complicated, and it forces you to use folder.jpg for your image name with this plugin, but it works.  I just got images all set for some 80 albums in a matter of minutes.

Remember, you have to have your albums only one directory below DocumentRoot - so in our example, C:\incoming\Pink Floyd - The Wall\ would work, but C:\incoming\Pink Floyd\The Wall will not (unless the artwork's in \Pink Floyd\ - unlikely).
Title: Walmart' 500x500 album covers download script
Post by: 2Pacalypse on 2005-10-09 16:39:06
can any1 help me i have foo open with set up as below, with php 5 installed yet it does not retrieve any covers!

Quote
I don't need the -f command.
I run it with Open With Plugin just like this:

Command name:   Download Cover (Walmart)
Application path:   "C:\php\php-win.exe"
Pre paramaters:   "C:\Program Files\foobar2000\getcover.php"[SPACE]
Main paramaters:   "%artist% %album%" "$replace(%_path%,\%_filename_ext%,)" cover walmart
Post parameters:
Title: Walmart' 500x500 album covers download script
Post by: TZOTZIOY on 2005-11-10 23:29:08
Quote
is there a way to run the script window minimized ?
[a href="index.php?act=findpost&pid=305812"][{POST_SNAPBACK}][/a]

you might try to rename the script from .py to .pyw (and obviously do accordingly in the fb2k configuration); in that case no console window will open.
Title: Walmart' 500x500 album covers download script
Post by: ogia on 2005-12-23 17:37:50
The python script is no more working for me. It runs, but can't get any cover
Title: Walmart' 500x500 album covers download script
Post by: David Nordin on 2005-12-23 21:23:27
pretty soon you're all scripted away so much you're better off with a foobar component
Title: Walmart' 500x500 album covers download script
Post by: bos on 2005-12-25 21:13:29
Quote
pretty soon you're all scripted away so much you're better off with a foobar component
[a href="index.php?act=findpost&pid=352103"][{POST_SNAPBACK}][/a]


Sounds like someone's volunteering