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:
parent
3529017916
commit
327a27fa81
1 changed files with 22 additions and 3 deletions
|
@ -66,8 +66,12 @@ while ($r = mysql_fetch_row($db_results)) {
|
||||||
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)
|
||||||
sort_move_file($song,$fullpath);
|
* 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;
|
$fullpath = $directory . "/" . $filename;
|
||||||
|
|
||||||
|
@ -202,6 +206,8 @@ function sort_element_name($key) {
|
||||||
*/
|
*/
|
||||||
function sort_move_file($song,$fullname) {
|
function sort_move_file($song,$fullname) {
|
||||||
|
|
||||||
|
$old_dir = dirname($song->file);
|
||||||
|
|
||||||
$info = pathinfo($fullname);
|
$info = pathinfo($fullname);
|
||||||
|
|
||||||
$directory = $info['dirname'];
|
$directory = $info['dirname'];
|
||||||
|
@ -214,7 +220,6 @@ function sort_move_file($song,$fullname) {
|
||||||
|
|
||||||
foreach ($data as $dir) {
|
foreach ($data as $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 */
|
||||||
|
@ -241,6 +246,20 @@ function sort_move_file($song,$fullname) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$results = copy($song->file,$fullname);
|
$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; }
|
if (!$results) { echo "Error: Unable to copy file to $fullname\n"; return false; }
|
||||||
|
|
||||||
/* Check the md5sums */
|
/* Check the md5sums */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue