has_access('25')) { access_denied(); }
$album = new Album($_REQUEST['album_id']);
$album->clear_art();
show_confirmation(_("Album Art Cleared"),_("Album Art information has been removed form the database"),"/albums.php?action=show&album=" . $album->id);
} // clear_art
// if we have album
elseif (isset($album)) {
$album = new Album($album);
$album->format_album();
$artist_obj = new Artist($artist_obj);
require (conf('prefix') . "/templates/show_album.inc");
if (isset($artist) && $artist_obj->name == "Unknown (Orphaned)" ) {
$song_ids = get_song_ids_from_artist_and_album($artist, $album->id);
}
else {
$song_ids = get_song_ids_from_album($album->id);
}
show_songs($song_ids,0,$album);
} // isset(album)
// Finds the Album art from amazon
elseif ($_REQUEST['action'] === 'find_art') {
if (!$user->has_access('25')) { access_denied(); }
/* 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')) {
echo "
Error: No Amazon Developer Key set, amazon album art searching will not work
";
}
$album = new Album($_REQUEST['album_id']);
$result = $album->find_art($_REQUEST['cover']);
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&album=" . $album->id);
echo " [ id . "\">Reset Album Art ]";
echo "
id . "\" />
";
echo "";
}
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&album=" . $album->id);
echo "";
}
} // find_art
// Updates Album from tags
elseif ($_REQUEST['action'] === 'update_from_tags') {
$album = new Album($_REQUEST['album_id']);
echo "
" . _("Starting Update from Tags") . ". . .
\n";
$catalog = new Catalog();
$catalog->update_single_item('album',$_REQUEST['album_id']);
echo "
" . _("Update From Tags Complete") . " ";
echo "[" . _("Return") . "]";
} // update_from_tags
else {
if (strlen($_REQUEST['match']) < '1') { $match = 'none'; }
// Setup the View Ojbect
$view = new View();
$view->import_session_view();
switch($match) {
case 'Show_all':
show_alphabet_list('albums','albums.php','show_all');
show_alphabet_form('',_("Show Albums starting with"),"albums.php?action=match");
$offset_limit = 99999;
$sql = "SELECT id FROM album";
break;
case 'Show_missing_art':
show_alphabet_list('albums','albums.php','show_missing_art');
show_alphabet_form('',_("Show Albums starting with"),"albums.php?action=match");
$offset_limit = 99999;
$sql = "SELECT id FROM album where art is null";
break;
case 'Browse':
case 'show_albums':
show_alphabet_list('albums','albums.php','browse');
show_alphabet_form('',_("Show Albums starting with"),"albums.php?action=match");
$sql = "SELECT id FROM album";
break;
case 'none':
show_alphabet_list('albums','albums.php','a');
show_alphabet_form('',_("Show Albums starting with"),"albums.php?action=match");
$sql = "SELECT id FROM album WHERE name LIKE 'a%'";
break;
default:
show_alphabet_list('albums','albums.php',$match);
show_alphabet_form($match,_("Show Albums starting with"),"albums.php?action=match");
echo "
";
$sql = "SELECT id FROM album WHERE name LIKE '$match%'";
} // end switch
// if we are returning
if ($_REQUEST['keep_view']) {
$view->initialize();
}
// If we aren't keeping the view then initlize it
elseif ($sql) {
$db_results = mysql_query($sql, dbh());
$total_items = mysql_num_rows($db_results);
if ($match != "Show_all") { $offset_limit = $_SESSION['userdata']['offset_limit']; }
$view = new View($sql, 'albums.php','name',$total_items,$offset_limit);
}
else { $view = false; }
if ($view->base_sql) {
$albums = get_albums($view->sql);
show_albums($albums,$view);
}
} // else no album
show_clear();
show_page_footer ('Albums', '',$user->prefs['display_menu']);
?>