diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-12-18 03:04:59 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-12-18 03:04:59 +0000 |
commit | 0154f3736070c0847c5912dca88954b6bebe6001 (patch) | |
tree | bb40a15d7d9b475f5ff5c0ed85d32a6e932d1428 /artists.php | |
parent | 1ce04520cdadbc03726da96608a8b5bbb20ee95a (diff) | |
download | ampache-0154f3736070c0847c5912dca88954b6bebe6001.tar.gz ampache-0154f3736070c0847c5912dca88954b6bebe6001.tar.bz2 ampache-0154f3736070c0847c5912dca88954b6bebe6001.zip |
added ability to rename/merge artists thx spcombs
Diffstat (limited to 'artists.php')
-rw-r--r-- | artists.php | 117 |
1 files changed, 86 insertions, 31 deletions
diff --git a/artists.php b/artists.php index e361e27d..75f1f2eb 100644 --- a/artists.php +++ b/artists.php @@ -46,7 +46,7 @@ switch($action) { case 'show_all_songs': $artist = get_artist_name(scrub_in($_REQUEST['artist'])); echo "<h2>" . _("All songs by") . " $artist</h2>"; - $song_ids = get_song_ids_from_artist($_REQUEST['artist']); + $song_ids = get_song_ids_from_artist($_REQUEST['artist']); show_songs($song_ids); break; @@ -63,40 +63,95 @@ switch($action) { echo "<a href=\"" . conf('web_path') . "/artists.php?action=show&artist=" . $_REQUEST['artist'] . "\">[" . _("Return") . "]</a>"; break; - case 'match': - case 'Match': - $match = scrub_in($_REQUEST['match']); - preg_match("/^(\w*)/", $match, $matches); - show_alphabet_list('artists','artists.php',$match); - if ($match === "Browse") { - show_alphabet_form('',_("Show Artists starting with"),"artists.php?action=match"); - show_artists(); - } - elseif ($match === "Show_all") { - show_alphabet_form('',_("Show Artists starting with"),"artists.php?action=match"); - $_SESSION['view_offset_limit'] = 999999; - show_artists(); - } - else { - $chr = preg_replace("/[^a-zA-Z0-9]/", "", $matches[1]); - show_alphabet_form($chr,_("Show Artists starting with"),"artists.php?action=match"); - - if ($chr == '') { - show_artists('A'); + case 'rename': + //die if not enough permissions + if (!$user->has_access('100')) { access_denied(); } + + /* Get the artist */ + $artist = new Artist($_REQUEST['artist']); + $catalog = new Catalog(); + + //check if we've been given a target + if ((isset($_POST['artist_id']) && $_POST['artist_id'] != $artist->id ) || (isset($_POST['artist_name']) && $_POST['artist_name'] != "")) { + + //if we want to update id3 tags, then get the array of ids now, it's too late afterwards + if (make_bool($_POST['update_id3'])) + $songs = $artist->get_songs(); + + //the manual rename takes priority + if ($_POST['artist_name'] != "") { + //then just change the name of the artist in the db + $newid = $artist->rename($_POST['artist_name']); + + } + elseif ($_POST['artist_id'] != $artist->id) { + if ($_POST['test_stats'] == 'yes') { + $catalog->merge_stats("artist",$artist->id,$_POST['artist_id']); + } + else { + //merge with other artist + $artist->merge($_POST['artist_id']); + $newid = $_POST['artist_id']; + } + } // elseif different artist and id + + //now flag for id3tag update if selected, and song id changed + if ($_POST['update_id3'] == "yes" && $newid != $artist->id) { + + /* Set the rename information in the db */ + foreach ($songs as $song) { + $flag_qstring = "REPLACE INTO flagged " . + "SET type = 'setid3', song = '" . $song->id . "', date = '" . time() . "', user = '" . $GLOBALS['user']->username . "'"; + mysql_query($flag_qstring, dbh()); + } + + } // end if they wanted to update + + } // if we've got the needed variables + + /* Else we've got an error! */ + else { + require (conf('prefix') . '/templates/show_rename_artist.inc.php'); + } + break; + case 'show_rename': + $artist = new Artist($_REQUEST['artist']); + require (conf('prefix') . '/templates/show_rename_artist.inc.php'); + break; + case 'match': + case 'Match': + $match = scrub_in($_REQUEST['match']); + preg_match("/^(\w*)/", $match, $matches); + show_alphabet_list('artists','artists.php',$match); + if ($match === "Browse") { + show_alphabet_form('',_("Show Artists starting with"),"artists.php?action=match"); + show_artists(); } - else { - show_artists($chr); + elseif ($match === "Show_all") { + show_alphabet_form('',_("Show Artists starting with"),"artists.php?action=match"); + $_SESSION['view_offset_limit'] = 999999; + show_artists(); + } + else { + $chr = preg_replace("/[^a-zA-Z0-9]/", "", $matches[1]); + show_alphabet_form($chr,_("Show Artists starting with"),"artists.php?action=match"); + + if ($chr == '') { + show_artists('A'); + } + else { + show_artists($chr); + } } - } + break; + default: + show_alphabet_list('artists','artists.php'); + show_alphabet_form('',_("Show Artists starting with"),"artists.php?action=match"); + show_artists('A'); break; +} // end switch - default: - show_alphabet_list('artists','artists.php'); - show_alphabet_form('',_("Show Artists starting with"),"artists.php?action=match"); - show_artists('A'); - break; -} -echo "<br /><br />"; +show_clear(); show_page_footer ('Artists', '',$user->prefs['display_menu']); ?> |