format();
$albums = $artist->get_albums();
require_once Config::get('prefix') . '/templates/show_artist.inc.php';
break;
case 'show_all_songs':
$artist = new Artist($_REQUEST['artist']);
$artist->format();
require_once Config::get('prefix') . '/templates/show_artist_box.inc.php';
$song_ids = $artist->get_songs();
Browse::set_type('song');
Browse::set_static_content(1);
Browse::save_objects($song_ids);
Browse::show_objects($song_ids);
break;
case 'update_from_tags':
$artist = new Artist($_REQUEST['artist']);
show_box_top(_('Starting Update from Tags'));
Catalog::update_single_item('artist',$_REQUEST['artist']);
echo "
" . _('Update From Tags Complete') . " ";
echo "[" . _('Return') . "]";
show_box_bottom();
break;
case 'rename_similar':
if (!$user->has_access('100')) { access_denied(); }
$count = 0;
if (isset($_REQUEST['artist']) && is_numeric($_REQUEST['artist']) && isset($_REQUEST['artists']) && is_array($_REQUEST['artists'])) {
$artist = new Artist($_REQUEST['artist']);
if ($artist->id)
foreach ($_REQUEST['artists'] as $artist_id) {
if (is_numeric($artist_id)) {
$that_artist = new Artist($artist_id);
if ($that_artist->id) {
$that_artist->merge($artist->id);
$count++;
} else
$GLOBALS['error']->add_error('general',"Error: No such artist '$artist_id'");
} else {
$GLOBALS['error']->add_error('general',"Error: '$artist_id' is not a valid ID");
}
}
else
$GLOBALS['error']->add_error('general',"Error: No such artist '" . $_REQUEST['artist'] . "'");
} else {
$GLOBALS['error']->add_error('general',"Error: Errenous request");
}
if ($count > 0) {
show_confirmation (
"Renamed artist(s)",
"$count artists have been merged with " . $artist->name,
conf('web_path') . "/artists.php?action=show&artist=" . $artist->id
);
} else {
$GLOBALS['error']->print_error('general');
}
break;
case 'show_similar':
if (!$GLOBALS['user']->has_access('75')) {
access_denied();
exit;
}
$artist = new Artist($_REQUEST['artist']);
//options
$similar_artists = $artist->get_similar_artists(
make_bool($_POST['n_rep_uml']),
$_POST['n_filter'],
$_POST['n_ignore'],
$_POST['c_mode'],
$_POST['c_count_w'],
$_POST['c_percent_w'],
$_POST['c_distance_l'],
make_bool($_POST['c_ignins_l']));
$artist_id = $artist->id;
$artist_name = $artist->name;
require Config::get('prefix') . '/templates/show_similar_artists.inc.php';
break;
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();
$ret = 0;
//the manual rename takes priority, but if they tested out the insert thing ignore
if ($_POST['artist_name'] != "" && $_POST['artist_name'] != $artist->name) {
//then just change the name of the artist in the db
$ret = $artist->rename($_POST['artist_name']);
$newid = $ret;
$newname = $_POST['artist_name'];
}
//new id?
elseif ($_POST['artist_id'] != $artist->id) {
//merge with other artist
$ret = $artist->merge($_POST['artist_id']);
$newid = $_POST['artist_id'];
$newname = $ret;
} // elseif different artist and id
//if no changes, no changes
//now flag for id3tag update if selected, and something actually happaned
if ($ret && make_bool($_POST['update_id3'])) {
/* Set the rename information in the db */
foreach ($songs as $song) {
$flag = new Flag();
$flag->add($song->id,"song","retag","Renamed artist, retag");
$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
// show something other than a blank screen after this
if ($ret) {
show_confirmation (
"Renamed artist",
$artist->name . " is now known as " . $newname,
<?php
/*
Copyright 2001 - 2007 Ampache.org
All Rights Reserved
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License v2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* show_rating
* This takes an artist id and includes the right file
*/
function show_rating($object_id,$type) {
$rating = new Rating($object_id,$type);
require Config::get('prefix') . '/templates/show_object_rating.inc.php';
} // show_rating
// andy90s rating patch added
function show_rating_static($object_id,$type) {
$rating = new Rating($object_id,$type);
require Config::get('prefix') . '/templates/show_object_rating_static.inc.php';
} // show_rating_static
/**
* get_rating_name
* This takes a score and returns the name that we should use
*/
function get_rating_name($score) {
switch ($score) {
case '0':
return _("Don't Play");
break;
case '1':
return _("It's Pretty Bad");
break;
case '2':
return _("It's Ok");
break;
case '3':
return _("It's Pretty Good");
break;
case '4':
return _("I Love It!");
break;
case '5':
return _("It's Insane");
break;
// I'm fired
default:
return _("Off the Charts!");
break;
} // end switch
return true;
} // get_rating_name
?>