cd audio cover

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mauriello72
Forum Newbie
Posts: 1
Joined: Thu Feb 22, 2007 2:47 pm

cd audio cover

Post by mauriello72 »

Hallo everybody.
I would like to know if there is a PHP script able to download an audio cd cover and info from the web. cddb.org give only name album,artist,etc, not the cover image.
Thanks
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Amazon has web services you can query.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

I use http://www.slothradio.com/covers/ to download covers.
This website is online for a long time and searches Amazon for images.
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

Here is a striped down version what I use in my project.

Code: Select all

<?php
$artist  = 'moby';
$album   = 'go';
$genre   = 'p';  // p = Popular; k = Clasical
$locale  = 'us'; // us, uk, de

$matches = '';
$content = file_get_contents('http://www.slothradio.com/covers/?adv=1&artist=' . rawurlencode($artist) . '&album=' . rawurlencode($album) . '&genre=' . $genre . '&imgsize=x&locale=' . $locale);
preg_match_all('/<!-- RESULT ITEM START -->.*?<img src="(http:\/\/(?:images|images-eu)\.amazon\.com.*?)"/s', $content, $matches);

foreach($matches[1] as $image)
	echo $image . "<br>";
?>
Post Reply