1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 02:39:47 +02:00

new dealies and stuff

This commit is contained in:
Karl 'vollmerk' Vollmer 2006-11-24 06:51:15 +00:00
parent 26b9269353
commit 8aa6fd30f5
3 changed files with 38 additions and 13 deletions

View file

@ -5,9 +5,8 @@
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.
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
@ -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
* 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
@ -33,7 +32,7 @@
*/
/* Don't do anything just tell me what you would do */
/* $test_mode = true; */
//$test_mode = true;
/* m(__)m */
$alphabet_prefix = true;
@ -66,7 +65,7 @@ while ($r = mysql_fetch_row($db_results)) {
/* Check for Demo Mode */
if ($test_mode) {
/* 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();
}
/* 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');
$content_array = array($artist,$album,$title,$track,$year,$genre);
$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;
@ -207,9 +205,11 @@ function sort_element_name($key) {
function sort_clean_name($string) {
/* 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;
@ -241,6 +241,7 @@ function sort_move_file($song,$fullname) {
foreach ($data as $dir) {
$dir = sort_clean_name($dir);
$path .= "/" . $dir;
/* We need to check for the existance of this directory */

View file

@ -4,6 +4,8 @@
--------------------------------------------------------------------------
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
a playlist based on the filenames
- Added the ability for admins to 'Push' the democratic link

View file

@ -142,6 +142,28 @@ class Flag {
} // 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
* 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;
} // reject
} // delete_flag
/**
* approve