diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-29 05:34:21 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-29 05:34:21 +0000 |
commit | ed04606a52c31c951c766aca152ca91c138fbbf1 (patch) | |
tree | 0c427e3901d50e5cdba6ec013d942615af6b62ee | |
parent | 258e4fcdf22745ce2b119df63458790461a6fbf0 (diff) | |
download | ampache-ed04606a52c31c951c766aca152ca91c138fbbf1.tar.gz ampache-ed04606a52c31c951c766aca152ca91c138fbbf1.tar.bz2 ampache-ed04606a52c31c951c766aca152ca91c138fbbf1.zip |
slightly improved the logic on pulling albums, fixed a typo causing find album art not to work as advertised
-rw-r--r-- | admin/catalog.php | 2 | ||||
-rw-r--r-- | albums.php | 11 | ||||
-rw-r--r-- | lib/class/album.class.php | 2 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 9 | ||||
-rw-r--r-- | server/ajax.server.php | 6 |
5 files changed, 18 insertions, 12 deletions
diff --git a/admin/catalog.php b/admin/catalog.php index 37403d0c..34f63522 100644 --- a/admin/catalog.php +++ b/admin/catalog.php @@ -240,7 +240,7 @@ switch ($_REQUEST['action']) { $catalog_id = $catalog->id; require Config::get('prefix') . '/templates/show_gather_art.inc.php'; flush(); - $catalog->get_album_art(0,1); + $catalog->get_album_art('',1); } $url = Config::get('web_path') . '/admin/index.php'; $title = _('Album Art Search Finished'); @@ -64,6 +64,7 @@ switch ($_REQUEST['action']) { // get the Album information $album = new Album($_REQUEST['album_id']); + $album->format(); $images = array(); $cover_url = array(); @@ -88,7 +89,7 @@ switch ($_REQUEST['action']) { $artist = scrub_in($_REQUEST['artist_name']); } elseif ($album->artist_count == '1') { - $artist = $album->artist; + $artist = $album->artist_name; } if (isset($_REQUEST['album_name'])) { $album_name = scrub_in($_REQUEST['album_name']); @@ -100,7 +101,7 @@ switch ($_REQUEST['action']) { $options['artist'] = $artist; $options['album_name'] = $album_name; $options['keyword'] = $artist . " " . $album_name; - + // Attempt to find the art. $images = $album->find_art($options,'6'); @@ -115,7 +116,7 @@ switch ($_REQUEST['action']) { if (count($images)) { // We don't want to store raw's in here so we need to strip them out into a seperate array foreach ($images as $index=>$image) { - if (isset($image['raw'])) { + if (isset($image[$index]['raw'])) { unset($images[$index]['raw']); } } // end foreach @@ -133,8 +134,8 @@ switch ($_REQUEST['action']) { $artistname = $artist; // Remember the last typed entry, if there was one - if (isset($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); } - if (isset($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); } + if (!empty($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); } + if (!empty($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); } require_once Config::get('prefix') . '/templates/show_get_albumart.inc.php'; diff --git a/lib/class/album.class.php b/lib/class/album.class.php index fc54f390..bc383f7c 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -300,6 +300,7 @@ class Album { $coverart = $raw_data['coverart']; ksort($coverart); + foreach ($coverart as $key=>$value) { $i++; $url = $coverart[$key]; @@ -310,7 +311,6 @@ class Album { } // end foreach return $data; - } // get_lastfm_art /*! diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 1e58642e..81bf8873 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -515,11 +515,16 @@ class Catalog { // Return results $results = $album->find_art($options,1); - + if (count($results)) { // Pull the string representation from the source $image = get_image_from_source($results['0']); - $album->insert_art($image,$results['0']['mime']); + if (strlen($image) > '5') { + $album->insert_art($image,$results['0']['mime']); + } + else { + debug_event('album_art','Image less then 5 chars, not inserting','3'); + } $art_found++; } diff --git a/server/ajax.server.php b/server/ajax.server.php index 8681e720..201d0300 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -169,7 +169,7 @@ switch ($action) { $object = new $_REQUEST['type']($_REQUEST['id']); $songs = $object->get_songs(); foreach ($songs as $song_id) { - $GLOBALS['user']->playlist->add_object($song_id); + $GLOBALS['user']->playlist->add_object($song_id,'song'); } // end foreach break; case 'album_random': @@ -180,7 +180,7 @@ switch ($action) { $object = new $type($_REQUEST['id']); $songs = $object->get_random_songs(); foreach ($songs as $song_id) { - $GLOBALS['user']->playlist->add_object($song_id); + $GLOBALS['user']->playlist->add_object($song_id,'song'); } break; case 'clear_all': @@ -199,7 +199,7 @@ switch ($action) { break; default: case 'song': - $GLOBALS['user']->playlist->add_object($_REQUEST['id']); + $GLOBALS['user']->playlist->add_object($_REQUEST['id'],'song'); break; } // end switch |