summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-21 19:32:25 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-21 19:32:25 +0000
commite540814435a7b825ef585bdcbf0b79f3f5f47e99 (patch)
tree823e8b7b5b9443dee06f11b30006c94f8ae7de36 /admin
parent2493e8eb48c48eeda11095406fdc22004053271a (diff)
downloadampache-e540814435a7b825ef585bdcbf0b79f3f5f47e99.tar.gz
ampache-e540814435a7b825ef585bdcbf0b79f3f5f47e99.tar.bz2
ampache-e540814435a7b825ef585bdcbf0b79f3f5f47e99.zip
added ability to edit artists and albums and flag all songs under them for re-taging
Diffstat (limited to 'admin')
-rw-r--r--admin/flag.php78
1 files changed, 75 insertions, 3 deletions
diff --git a/admin/flag.php b/admin/flag.php
index 2108b878..9dfcaf93 100644
--- a/admin/flag.php
+++ b/admin/flag.php
@@ -103,17 +103,90 @@ switch ($action) {
require_once(conf('prefix') . '/templates/show_edit_album.inc.php');
- beak;
+ break;
+ // Update all songs from this album
+ case 'edit_album':
+
+ // Build the needed album
+ $album = new Album($_REQUEST['album_id']);
+
+ // Create the needed catalog object cause we can't do
+ // static class methods :(
+ $catalog = new Catalog();
+ $flag = new Flag();
+
+ /* Check the new Name */
+ $album_id = $catalog->check_album($_REQUEST['name'],$_REQUEST['year']);
+
+ $songs = $album->get_songs();
+
+ foreach ($songs as $song) {
+ // Make that copy and change the album
+ $new_song = $song;
+ $new_song->album = $album_id;
+
+ $song->update_song($song->id,$new_song);
+
+ if ($_REQUEST['flag'] == '1') {
+ $flag->add($song->id,'song','retag','Edited Song, auto-tag');
+ }
+
+ } // end foreach songs
+
+ // Clean out the old album
+ $catalog->clean_albums();
+
+ show_confirmation(_('Album Updated'),'',conf('web_path') . '/admin/index.php');
+
+ break;
// Show the page for editing a full artist
case 'show_edit_artist':
-
+
+ $artist = new Artist($_REQUEST['artist_id']);
+
+ require_once(conf('prefix') . '/templates/show_edit_artist.inc.php');
break;
+ // Update all songs by this artist
+ case 'edit_artist':
+
+ // Build the needed artist
+ $artist = new Artist($_REQUEST['artist_id']);
+
+ // Create the needed objects, a pox on PHP4
+ $catalog = new Catalog();
+ $flag = new Flag();
+
+ /* Check the new Name */
+ $artist_id = $catalog->check_artist($_REQUEST['name']);
+
+ $songs = $artist->get_songs();
+
+ foreach ($songs as $song) {
+ // Make that copy and change the artist
+ $new_song = $song;
+ $new_song->artist = $artist_id;
+
+ $song->update_song($song->id,$new_song);
+
+ if ($_REQUEST['flag'] == '1') {
+ $flag->add($song->id,'song','retag','Edited Song, auto-tag');
+ }
+
+ } // end foreach songs
+
+ // Clean out the old artist(s)
+ $catalog->clean_artists();
+
+ show_confirmation(_('Artist Updated'),'',conf('web_path') . '/admin/index.php');
+
+ break;
/* Done by 'Select' code passes array of song ids */
case 'mass_update':
$songs = $_REQUEST['songs'];
$catalog = new Catalog();
$object = $_REQUEST['update_field'];
+ $flag = new Flag();
/* Foreach the songs we need to update */
foreach ($songs as $song_id) {
@@ -146,7 +219,6 @@ switch ($action) {
/* Now that it's been updated clean old junk entries */
$cleaned = $catalog->clean_single_song($old_song);
- $flag = new Flag();
$flag->add($song_id,'song','retag','Edited Song, auto-tag');
} // end foreach songs