summaryrefslogtreecommitdiffstats
path: root/albums.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-12-16 09:53:55 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-12-16 09:53:55 +0000
commit8a847a4efd25e5b419886e55d55bc4fd9b9e55c9 (patch)
treea48b40f5a1f4f0673c7b87c9cabfc5ec0cc3b05b /albums.php
parent961bf509d45dee506d3914c0f7c839311ec3b7c6 (diff)
downloadampache-8a847a4efd25e5b419886e55d55bc4fd9b9e55c9.tar.gz
ampache-8a847a4efd25e5b419886e55d55bc4fd9b9e55c9.tar.bz2
ampache-8a847a4efd25e5b419886e55d55bc4fd9b9e55c9.zip
some of the more unattractive code Ive commited in a while...
Diffstat (limited to 'albums.php')
-rw-r--r--albums.php51
1 files changed, 44 insertions, 7 deletions
diff --git a/albums.php b/albums.php
index 67d075c9..96596c54 100644
--- a/albums.php
+++ b/albums.php
@@ -71,7 +71,7 @@ elseif ($_REQUEST['action'] === 'find_art') {
// adding retry to album art searching. I hope my PHP style doesn't make vollmer cry,
// because that would make me cry...then my girlfriend would cry...then my cat would laugh.
// She's such a little trouper!
-
+ // *NOTE* I knocked it up a notch with some more horrible code :S - Vollmer
/* Echo notice if no amazon token is found, but it's enabled */
if (in_array('amazon',conf('album_art_order')) AND !conf('amazon_developer_key')) {
@@ -81,13 +81,26 @@ elseif ($_REQUEST['action'] === 'find_art') {
// get the Album information
$album = new Album($_REQUEST['album_id']);
- // Attempt to find the art with what we've got
- $result = $album->find_art($_REQUEST['cover'], $_REQUEST['artist_name'], $_REQUEST['album_name']);
+ if ($_REQUEST['artist_name']) {
+ $artist = scrub_in($_REQUEST['artist_name']);
+ }
+ else {
+ $artist = $album->artist;
+ }
+
+ if ($_REQUEST['album_name']) {
+ $album_name = scrub_in($_REQUEST['album_name']);
+ }
+ else {
+ $album_name = $album->name;
+ }
- if ($result) {
- show_confirmation(_("Album Art Located"),_("Album Art information has been located in Amazon. If incorrect, click \"Reset Album Art\" below to remove the artwork."),"/albums.php?action=show&amp;album=" . $album->id);
- echo "&nbsp;[ <a href=\"" . conf('web_path') . "/albums.php?action=clear_art&amp;album_id=" . $album->id . "\">Reset Album Art</a> ]";
- echo "<p align=left><img src=\"" . conf('web_path') . "/albumart.php?id=" . $album->id . "\" /></p>";
+ // Attempt to find the art with what we've got
+ $images = $album->find_art($_REQUEST['cover'], $artist . " " . $album_name);
+ $_SESSION['form']['images'] = $images;
+
+ if (count($images)) {
+ include(conf('prefix') . '/templates/show_album_art.inc.php');
}
else {
show_confirmation(_("Album Art Not Located"),_("Album Art could not be located at this time. This may be due to Amazon being busy, or the album not being present in their collection."),"/albums.php?action=show&amp;album=" . $album->id);
@@ -104,6 +117,30 @@ elseif ($_REQUEST['action'] === 'find_art') {
} // find_art
+// Selecting image from find_art
+elseif ($_REQUEST['action'] === 'select_art') {
+
+ /* Check to see if we have the image url still */
+ $image_id = $_REQUEST['image'];
+ $album_id = $_REQUEST['album_id'];
+
+ $url = $_SESSION['form']['images'][$image_id]['url'];
+ $mime = $_SESSION['form']['images'][$image_id]['mime'];
+ $snoopy = new Snoopy();
+ $snoopy->fetch($url);
+
+ $image_data = $snoopy->results;
+
+ $album = new Album($album_id);
+ $album->insert_art($image_data,$mime);
+
+ $msg = "<br />\n<img src=\"" . conf('web_path') . "/albumart.php?id=$album_id\" width=\"175\" height=\"175\" /><br />";
+
+ show_confirmation(_("Album Art Inserted"),$msg,"/albums.php?action=show&album=$album_id");
+
+
+} // end select art
+
// Updates Album from tags
elseif ($_REQUEST['action'] === 'update_from_tags') {