mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-04 02:09:23 +02:00
removed dead file, updated bin files, removed debug and added a new config option
This commit is contained in:
parent
9771ca3790
commit
730d21e8d8
17 changed files with 25 additions and 213 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$no_session='1';
|
define('NO_SESSION','1');
|
||||||
require ('../lib/init.php');
|
require ('../lib/init.php');
|
||||||
|
|
||||||
echo "[catalog_update.php.inc]\nStarting Catalog Clean/Update And Add\n\n";
|
echo "[catalog_update.php.inc]\nStarting Catalog Clean/Update And Add\n\n";
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$no_session = '1';
|
define('NO_SESSION','1');
|
||||||
require ('../lib/init.php');
|
require ('../lib/init.php');
|
||||||
require ('../lib/debug.lib.php');
|
require ('../lib/debug.lib.php');
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
$debug = true;
|
$debug = true;
|
||||||
|
|
||||||
|
|
||||||
$no_session = '1';
|
define('NO_SESSION','1');
|
||||||
require ("../lib/init.php");
|
require ("../lib/init.php");
|
||||||
|
|
||||||
/* Get a list of filenames */
|
/* Get a list of filenames */
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
define('NO_SESSION','1');
|
||||||
$no_session = '1';
|
|
||||||
require ("../lib/init.php");
|
require ("../lib/init.php");
|
||||||
|
|
||||||
$catalogs = Catalog::get_catalogs();
|
$catalogs = Catalog::get_catalogs();
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
$filename = "/data/music/Live/L/Life'll Kill Ya/Warren Zevon.m3u";
|
$filename = "/data/music/Live/L/Life'll Kill Ya/Warren Zevon.m3u";
|
||||||
|
|
||||||
|
|
||||||
$no_session = '1';
|
define('NO_SESSION','1');
|
||||||
require ("../lib/init.php");
|
require ("../lib/init.php");
|
||||||
|
|
||||||
$handle = fopen($filename,'r');
|
$handle = fopen($filename,'r');
|
||||||
|
|
|
@ -24,7 +24,7 @@ $search['artist_name'] = "Bent";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$no_session = '1';
|
define('NO_SESSION','1');
|
||||||
require ("../lib/init.php");
|
require ("../lib/init.php");
|
||||||
echo "<pre>\n";
|
echo "<pre>\n";
|
||||||
$amazon = new AmazonSearch(conf('amazon_developer_key'));
|
$amazon = new AmazonSearch(conf('amazon_developer_key'));
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
$no_session = '1';
|
|
||||||
|
define('NO_SESSION','1');
|
||||||
require ("../lib/init.php");
|
require ("../lib/init.php");
|
||||||
|
|
||||||
if (count($GLOBALS['argv']) == '1') { $filename = usage(); }
|
if (count($GLOBALS['argv']) == '1') { $filename = usage(); }
|
||||||
|
|
|
@ -1,192 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright 2001 - 2006 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
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
created by RosenSama 2005
|
|
||||||
|
|
||||||
call: php quarantine_migration.php
|
|
||||||
*/
|
|
||||||
|
|
||||||
$no_session='1';
|
|
||||||
require_once('../lib/init.php');
|
|
||||||
|
|
||||||
init_preferences();
|
|
||||||
|
|
||||||
usage();
|
|
||||||
|
|
||||||
/* Check if they want to force delete */
|
|
||||||
$force_delete = $GLOBALS['argv']['1'];
|
|
||||||
|
|
||||||
// grab list of files from table
|
|
||||||
$sql = "SELECT id, file, user,action FROM upload WHERE action != 'quarantine'";
|
|
||||||
$db_results = mysql_query($sql, dbh());
|
|
||||||
|
|
||||||
$files = array();
|
|
||||||
$files['add'] = array();
|
|
||||||
$files['delete'] = array();
|
|
||||||
|
|
||||||
while ($results = mysql_fetch_assoc($db_results)) {
|
|
||||||
|
|
||||||
$action = $results['action'];
|
|
||||||
|
|
||||||
$files[$action][] = $results;
|
|
||||||
|
|
||||||
} // end while
|
|
||||||
|
|
||||||
/* Make sure we have write access to the upload dir */
|
|
||||||
$upload_dir = conf('upload_dir');
|
|
||||||
|
|
||||||
if (!$upload_dir) {
|
|
||||||
echo "\nError: No Upload Directory Defined\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!@is_writeable($upload_dir)) {
|
|
||||||
echo "\n" . _('Error: Unable to write to') . " $upload_dir ". "\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$catalog_id = find_upload_catalog($upload_dir);
|
|
||||||
|
|
||||||
if (!$catalog_id) {
|
|
||||||
cli_out(_("Error: Upload directory not inside a catalog"));
|
|
||||||
exit;
|
|
||||||
} // we must have a valid upload dir
|
|
||||||
|
|
||||||
$catalog = new Catalog($catalog_id);
|
|
||||||
|
|
||||||
/* Itterate through the files we need to move */
|
|
||||||
foreach ($files['add'] as $data) {
|
|
||||||
|
|
||||||
/* Make sure that the target filename doesn't exist */
|
|
||||||
$target_file = $upload_dir . "/" . basename($data['file']);
|
|
||||||
|
|
||||||
if (file_exists($target_file)) {
|
|
||||||
echo 'Error: File Exists';
|
|
||||||
debug_event('file_exists','Error: $target_file already exist','1');
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$results = copy($data['file'],$target_file);
|
|
||||||
if (!$results) { echo "Error: Unable to copy " . $data['file'] . " skipping...\n"; continue; }
|
|
||||||
|
|
||||||
/* Check the filesize to make sure it copied */
|
|
||||||
$new_sum = filesize($target_file);
|
|
||||||
$old_sum = filesize($data['file']);
|
|
||||||
|
|
||||||
if ($new_sum != $old_sum || !$new_sum) {
|
|
||||||
echo "Error: Size Inconsistency, not deleting " . $data['file'] . "\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$results = unlink($data['file']);
|
|
||||||
if (!$results AND !$force_delete) { echo "Error: Unable to delete " . $data['file'] . "\n";}
|
|
||||||
elseif (!$results) {
|
|
||||||
echo "Error: Unable to delete " . $data['file'] . "\n";
|
|
||||||
echo "Force Delete enabled, removing from Database...\n";
|
|
||||||
$sql = "DELETE FROM upload WHERE id='" . $data['id'] . "'";
|
|
||||||
$db_results = mysql_query($sql, dbh());
|
|
||||||
} // if not able to unlike
|
|
||||||
else {
|
|
||||||
echo _('Adding') . " " . $target_file . " " . _('to database') . "\n";
|
|
||||||
|
|
||||||
$catalog->add_file($target_file);
|
|
||||||
|
|
||||||
/* Remove it from the catalog */
|
|
||||||
$sql = "DELETE FROM upload WHERE id='" . $data['id'] . "'";
|
|
||||||
$db_results = mysql_query($sql, dbh());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end foreach
|
|
||||||
|
|
||||||
/* Itterate through the files we need to delete */
|
|
||||||
foreach ($files['delete'] as $data) {
|
|
||||||
|
|
||||||
$results = unlink($data['file']);
|
|
||||||
if (!$results) { echo "Error: Unable to Delete File: " . $data['file'] . "\n"; }
|
|
||||||
else {
|
|
||||||
echo _('Deleted') . " " . $data['file'] . "\n";
|
|
||||||
$sql = "DELETE FROM upload WHERE id='" . $data['id'] . "'";
|
|
||||||
$db_results = mysql_query($sql, dbh());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end foreach
|
|
||||||
|
|
||||||
exit();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@function usage()
|
|
||||||
@discussion echo the help for this script
|
|
||||||
*/
|
|
||||||
|
|
||||||
function usage( ) {
|
|
||||||
$text = _( "
|
|
||||||
|
|
||||||
************* WARNING *************
|
|
||||||
This script will move, and
|
|
||||||
potentially delete uploaded files.
|
|
||||||
************* WARNING *************
|
|
||||||
|
|
||||||
All files marked for add will be moved to the upload directory. All files
|
|
||||||
marked for deletion will be deleted. This script must be run as a user with
|
|
||||||
sufficient rights to perform the above two functions.
|
|
||||||
|
|
||||||
\n" );
|
|
||||||
echo $text;
|
|
||||||
|
|
||||||
$text = _( "Continue? (Y/N):" );
|
|
||||||
echo $text;
|
|
||||||
|
|
||||||
// grab a character ignoring whitespace
|
|
||||||
do {
|
|
||||||
$input= fgetc( STDIN );
|
|
||||||
} while ( trim( $input ) == '' );
|
|
||||||
|
|
||||||
if(strcasecmp($input,"y") != 0 ) {
|
|
||||||
echo "\nExiting...\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} // usage()
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@function cli_out()
|
|
||||||
@discussion util for error formatting
|
|
||||||
@param $text the message to be output
|
|
||||||
@param $mode to STDERR (0) or STDOUT (1, default)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function cli_out( $text, $mode = 1 ) {
|
|
||||||
switch( $mode ) {
|
|
||||||
case 0:
|
|
||||||
$dest = STDERR;
|
|
||||||
$pre = _( "Error: " );
|
|
||||||
$post = _( "!\n" );
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
default:
|
|
||||||
$dest = STDOUT;
|
|
||||||
$pre = "";
|
|
||||||
$post = "\n";
|
|
||||||
}
|
|
||||||
fwrite( $dest, $pre . $text . $post );
|
|
||||||
} // error_out
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -37,7 +37,7 @@
|
||||||
/* m(__)m */
|
/* m(__)m */
|
||||||
$alphabet_prefix = true;
|
$alphabet_prefix = true;
|
||||||
|
|
||||||
$no_session = '1';
|
define('NO_SESSION','1');
|
||||||
require ("../lib/init.php");
|
require ("../lib/init.php");
|
||||||
|
|
||||||
/* First Clean the catalog to we don't try to write anything we shouldn't */
|
/* First Clean the catalog to we don't try to write anything we shouldn't */
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* be especially important when trying to keep a clean file structure.
|
* be especially important when trying to keep a clean file structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$no_session = '1';
|
define('NO_SESSION','1');
|
||||||
require ("../lib/init.php");
|
require ("../lib/init.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* be especially important when trying to keep a clean file structure.
|
* be especially important when trying to keep a clean file structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$no_session = '1';
|
define('NO_SESSION','1');
|
||||||
require ("../lib/init.php");
|
require ("../lib/init.php");
|
||||||
|
|
||||||
// Include getID3 libs, including the ability to write tags
|
// Include getID3 libs, including the ability to write tags
|
||||||
|
|
|
@ -219,11 +219,12 @@ album_art_order = "id3"
|
||||||
album_art_order = "folder"
|
album_art_order = "folder"
|
||||||
album_art_order = "amazon"
|
album_art_order = "amazon"
|
||||||
|
|
||||||
# Album Art in Now Playing
|
# Album Art
|
||||||
# Set this to true if you want the now playing box to display
|
# Set this to true if you want album art displayed on pages besides the
|
||||||
# album art from said album
|
# Single Album view, if you have a slow machine, or limited bandwidth
|
||||||
|
# turning this off can vastly improve performance
|
||||||
# DEFAULT: true
|
# DEFAULT: true
|
||||||
play_album_art = "true"
|
show_album_art = "true"
|
||||||
|
|
||||||
# Amazon Developer Key
|
# Amazon Developer Key
|
||||||
# This is needed in order to actually use the amazon album art
|
# This is needed in order to actually use the amazon album art
|
||||||
|
|
|
@ -109,7 +109,6 @@ function show_artists ($match = '') {
|
||||||
$artists = $match;
|
$artists = $match;
|
||||||
$_SESSION['view_script'] = false;
|
$_SESSION['view_script'] = false;
|
||||||
}
|
}
|
||||||
debug_event('foo',$view->sql,'3');
|
|
||||||
$db_results = mysql_query($view->sql, $dbh);
|
$db_results = mysql_query($view->sql, $dbh);
|
||||||
|
|
||||||
// Get the artist object
|
// Get the artist object
|
||||||
|
|
|
@ -757,8 +757,8 @@ class User {
|
||||||
|
|
||||||
/* If we aren't the -1 user before we continue grab the -1 users values */
|
/* If we aren't the -1 user before we continue grab the -1 users values */
|
||||||
if ($user_id != '-1') {
|
if ($user_id != '-1') {
|
||||||
$sql = "SELECT `user_preference.preference`,`user_preference.value` FROM `user_preference`,`preferences` " .
|
$sql = "SELECT `user_preference`.`preference`,`user_preference`.`value` FROM `user_preference`,`preferences` " .
|
||||||
"WHERE `user_preference.preference` = `preferences.id` AND `user_preference.user`='-1' AND `preferences.catagory` !='system'";
|
"WHERE `user_preference`.`preference` = `preferences`.`id` AND `user_preference`.`user`='-1' AND `preferences`.`catagory` !='system'";
|
||||||
$db_results = mysql_query($sql, dbh());
|
$db_results = mysql_query($sql, dbh());
|
||||||
/* While through our base stuff */
|
/* While through our base stuff */
|
||||||
while ($r = mysql_fetch_object($db_results)) {
|
while ($r = mysql_fetch_object($db_results)) {
|
||||||
|
|
|
@ -656,11 +656,11 @@ function get_global_popular($type) {
|
||||||
* @catagory Get
|
* @catagory Get
|
||||||
* @todo Add Genre
|
* @todo Add Genre
|
||||||
*/
|
*/
|
||||||
function get_newest ($type = 'artist') {
|
function get_newest ($type = 'artist',$limit='') {
|
||||||
|
|
||||||
$dbh = dbh();
|
$dbh = dbh();
|
||||||
|
|
||||||
if (conf('popular_threshold') < 1) { conf(array('popular_threshold'=>'10'),1); }
|
if (!$limit) { $limit = conf('popular_threshold'); }
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT $type FROM song ORDER BY addition_time " .
|
$sql = "SELECT DISTINCT $type FROM song ORDER BY addition_time " .
|
||||||
"DESC LIMIT " . conf('popular_threshold');
|
"DESC LIMIT " . conf('popular_threshold');
|
||||||
|
|
|
@ -38,7 +38,7 @@ $artist = scrub_out(truncate_with_ellipse($song->f_artist_full,'25'));
|
||||||
<?php echo $artist; ?>
|
<?php echo $artist; ?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<?php if (conf('play_album_art')) { ?>
|
<?php if (conf('show_album_art')) { ?>
|
||||||
<td class="np_cell">
|
<td class="np_cell">
|
||||||
<a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&type=popup&sid=<?php echo session_id(); ?>" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&type=popup&sid=<?php echo session_id(); ?>'); return false;">
|
<a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&type=popup&sid=<?php echo session_id(); ?>" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&type=popup&sid=<?php echo session_id(); ?>'); return false;">
|
||||||
<img align="middle" border="0" src="<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&thumb=1&sid=<?php echo session_id(); ?>" alt="Album Art" height="75" width="75" /></a>
|
<img align="middle" border="0" src="<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&thumb=1&sid=<?php echo session_id(); ?>" alt="Album Art" height="75" width="75" /></a>
|
||||||
|
|
|
@ -31,7 +31,11 @@ $web_path = conf('web_path');
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?php echo $web_path; ?>/albums.php?action=show&album=<?php echo $album_id; ?>">
|
<a href="<?php echo $web_path; ?>/albums.php?action=show&album=<?php echo $album_id; ?>">
|
||||||
|
<?php if (conf('show_album_art')) { ?>
|
||||||
<img src="<?php echo $web_path; ?>/image.php?thumb=3&id=<?php echo $album_id; ?>" width="80" height="80" border="0" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
|
<img src="<?php echo $web_path; ?>/image.php?thumb=3&id=<?php echo $album_id; ?>" width="80" height="80" border="0" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
|
||||||
|
<?php } else { ?>
|
||||||
|
<?php echo '[' . $album->f_artist . '] ' . $album->f_name; ?>
|
||||||
|
<?php } ?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue