mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 10:49:37 +02:00
new dealies and stuff
This commit is contained in:
parent
26b9269353
commit
8aa6fd30f5
3 changed files with 38 additions and 13 deletions
|
@ -5,9 +5,8 @@
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License v2
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation.
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -20,7 +19,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* DON'T USE ME! THIS SCRIPT _WILL_ MESS UP YOUR AUDIO FILES!!!
|
* Still not fully tested but "Appears to work" use at your own risk
|
||||||
* sort_files
|
* sort_files
|
||||||
* This script has a lot of stuff to worry about. It's primary duty is to re-organize
|
* This script has a lot of stuff to worry about. It's primary duty is to re-organize
|
||||||
* your files based on some sane, and predefined (in the interface) order using the
|
* your files based on some sane, and predefined (in the interface) order using the
|
||||||
|
@ -33,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Don't do anything just tell me what you would do */
|
/* Don't do anything just tell me what you would do */
|
||||||
/* $test_mode = true; */
|
//$test_mode = true;
|
||||||
|
|
||||||
/* m(__)m */
|
/* m(__)m */
|
||||||
$alphabet_prefix = true;
|
$alphabet_prefix = true;
|
||||||
|
@ -66,7 +65,7 @@ while ($r = mysql_fetch_row($db_results)) {
|
||||||
/* Check for Demo Mode */
|
/* Check for Demo Mode */
|
||||||
if ($test_mode) {
|
if ($test_mode) {
|
||||||
/* We're just talking here... no work */
|
/* We're just talking here... no work */
|
||||||
echo "Moving File:\n\tSource: $song->file\n\tDest: $fullpath\n";
|
echo "Moving File...\n\tSource: $song->file\n\tDest: $fullpath\n";
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
/* We need to actually do the moving (fake it if we are testing)
|
/* We need to actually do the moving (fake it if we are testing)
|
||||||
|
@ -105,10 +104,9 @@ function sort_find_filename($song,$rename_pattern) {
|
||||||
$replace_array = array('%a','%A','%t','%T','%y','%g');
|
$replace_array = array('%a','%A','%t','%T','%y','%g');
|
||||||
$content_array = array($artist,$album,$title,$track,$year,$genre);
|
$content_array = array($artist,$album,$title,$track,$year,$genre);
|
||||||
|
|
||||||
|
|
||||||
$rename_pattern = str_replace($replace_array,$content_array,$rename_pattern);
|
$rename_pattern = str_replace($replace_array,$content_array,$rename_pattern);
|
||||||
|
|
||||||
$rename_pattern = preg_replace("[^A-Za-z0-9\-\_\ \'\,\(\)]","_",$rename_pattern);
|
$rename_pattern = preg_replace("[\-\:\!]","_",$rename_pattern);
|
||||||
|
|
||||||
return $rename_pattern . "." . $extension;
|
return $rename_pattern . "." . $extension;
|
||||||
|
|
||||||
|
@ -207,9 +205,11 @@ function sort_element_name($key) {
|
||||||
function sort_clean_name($string) {
|
function sort_clean_name($string) {
|
||||||
|
|
||||||
/* First remove any / or \ chars */
|
/* First remove any / or \ chars */
|
||||||
$string = preg_replace("/[\/\\\]/","-",$string);
|
$string = preg_replace('/[\/\\\]/','-',$string);
|
||||||
|
|
||||||
$string = str_replace(":"," ",$string);
|
$string = str_replace(':',' ',$string);
|
||||||
|
|
||||||
|
$string = preg_replace('/[\!\:\*]/','_',$string);
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
|
|
||||||
|
@ -241,6 +241,7 @@ function sort_move_file($song,$fullname) {
|
||||||
|
|
||||||
foreach ($data as $dir) {
|
foreach ($data as $dir) {
|
||||||
|
|
||||||
|
$dir = sort_clean_name($dir);
|
||||||
$path .= "/" . $dir;
|
$path .= "/" . $dir;
|
||||||
|
|
||||||
/* We need to check for the existance of this directory */
|
/* We need to check for the existance of this directory */
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
v.3.3.3-Beta1
|
v.3.3.3-Beta1
|
||||||
|
- Updated flag class to make it easier to create a tag writer
|
||||||
|
- Fixed some potential issues with sort_files.php.inc
|
||||||
- Added the ability to Upload a M3u and have it attempt to build
|
- Added the ability to Upload a M3u and have it attempt to build
|
||||||
a playlist based on the filenames
|
a playlist based on the filenames
|
||||||
- Added the ability for admins to 'Push' the democratic link
|
- Added the ability for admins to 'Push' the democratic link
|
||||||
|
|
|
@ -142,6 +142,28 @@ class Flag {
|
||||||
|
|
||||||
} // get_flagged
|
} // get_flagged
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get_approved
|
||||||
|
* This returns an array of approved flagged songs
|
||||||
|
*/
|
||||||
|
function get_approved() {
|
||||||
|
|
||||||
|
$sql = "SELECT id FROM flagged WHERE approved='1'";
|
||||||
|
$db_results = mysql_query($sql,dbh());
|
||||||
|
|
||||||
|
|
||||||
|
/* Default the results array */
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
/* While it */
|
||||||
|
while ($r = mysql_fetch_assoc($db_results)) {
|
||||||
|
$results[] = $r['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
} // get_approved
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add
|
* add
|
||||||
* This adds a flag entry for an item, it takes an id, a type, the flag type
|
* This adds a flag entry for an item, it takes an id, a type, the flag type
|
||||||
|
@ -179,7 +201,7 @@ class Flag {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} // reject
|
} // delete_flag
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* approve
|
* approve
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue