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

account for already sorted files and try to move the album art as well

This commit is contained in:
Karl 'vollmerk' Vollmer 2006-01-08 09:06:16 +00:00
parent 3529017916
commit 327a27fa81

View file

@ -66,8 +66,12 @@ while ($r = mysql_fetch_row($db_results)) {
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) */
sort_move_file($song,$fullpath);
/* We need to actually do the moving (fake it if we are testing)
* Don't try to move it, if it's already the same friggin thing!
*/
if ($song->file != $fullpath) {
sort_move_file($song,$fullpath);
}
$fullpath = $directory . "/" . $filename;
@ -202,6 +206,8 @@ function sort_element_name($key) {
*/
function sort_move_file($song,$fullname) {
$old_dir = dirname($song->file);
$info = pathinfo($fullname);
$directory = $info['dirname'];
@ -214,7 +220,6 @@ function sort_move_file($song,$fullname) {
foreach ($data as $dir) {
$path .= "/" . $dir;
/* We need to check for the existance of this directory */
@ -241,6 +246,20 @@ function sort_move_file($song,$fullname) {
}
else {
$results = copy($song->file,$fullname);
/* Look for the folder art and copy that as well */
if (!conf('album_art_preferred_filename')) {
$folder_art = $directory . '/folder.jpg';
$old_art = $old_dir . '/folder.jpg';
}
else {
$folder_art = $directory . "/" . conf('album_art_preferred_filename');
$old_art = $old_dir . "/" . conf('album_art_preferred_filename');
}
@copy($old_art,$folder_art);
if (!$results) { echo "Error: Unable to copy file to $fullname\n"; return false; }
/* Check the md5sums */