diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-08 09:06:16 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-08 09:06:16 +0000 |
commit | 327a27fa8101327595b3351973b5d6ce37056d3c (patch) | |
tree | b391596621ac134fb0bf357a46ca361caa58831a /bin | |
parent | 35290179165ec14a3003139777a4606c0a8f15f1 (diff) | |
download | ampache-327a27fa8101327595b3351973b5d6ce37056d3c.tar.gz ampache-327a27fa8101327595b3351973b5d6ce37056d3c.tar.bz2 ampache-327a27fa8101327595b3351973b5d6ce37056d3c.zip |
account for already sorted files and try to move the album art as well
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sort_files.php.inc | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/bin/sort_files.php.inc b/bin/sort_files.php.inc index b77f3405..1165b07f 100644 --- a/bin/sort_files.php.inc +++ b/bin/sort_files.php.inc @@ -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 */ |