Don't create the new file if it has no data. Also make the Track portion optional so that the files do not become hidden with a .
.
This commit is contained in:
parent
9fcb460c96
commit
ab58617815
@ -75,7 +75,7 @@ find "$OLD" -type f ! -name "*".mp3 | sort | while read file; do
|
||||
if [[ $status != 0 ]]; then
|
||||
echo "*** FAILED: Exited with status '$status'."
|
||||
echo "**** To troubleshoot, try running this:"
|
||||
echo "ffmpeg -i '$file' '$file'.converted.mp3"
|
||||
echo "ffmpeg -i \"$file\" \"$file\".converted.mp3"
|
||||
else
|
||||
echo "*** Success!"
|
||||
fi
|
||||
@ -127,7 +127,9 @@ function migrate_music {
|
||||
[[ ${#track} == 1 ]] && track="0$track"
|
||||
echo "*** Track=$track"
|
||||
|
||||
new_file="$track. $new_file"
|
||||
if [[ -s "$track" ]]; then
|
||||
new_file="$track. $new_file"
|
||||
fi
|
||||
|
||||
# Add the Album and Year.
|
||||
album=""
|
||||
@ -209,6 +211,26 @@ function migrate_music {
|
||||
|
||||
new_file="$grandparent/$new_file"
|
||||
|
||||
# Check that the file has proper data.
|
||||
skip=false
|
||||
if [[ -z "$grandparent" ]]; then
|
||||
echo "ERROR: Could not find Artist information."
|
||||
skip="true"
|
||||
fi
|
||||
if [[ -z "$parent" ]]; then
|
||||
echo "ERROR: Could not find Album or Year information."
|
||||
skip="true"
|
||||
fi
|
||||
if [[ -z "$track" && -z "$title" ]]; then
|
||||
echo "ERROR: Could not find Track or Title information."
|
||||
skip="true"
|
||||
fi
|
||||
|
||||
if [[ "$skip" == "true" ]]; then
|
||||
echo "*** Skipping file, critical data missing."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Create the new directories if they do not already exist.
|
||||
mkdir -pv "$NEW/$grandparent/$parent"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user