Compare commits
2 Commits
0f83256e05
...
da4462b46a
Author | SHA1 | Date | |
---|---|---|---|
da4462b46a | |||
a4b9be077d |
@ -66,11 +66,18 @@ mkdir -pv "$NEW" "$INT"
|
||||
|
||||
## Convert Media ##
|
||||
|
||||
echo "* Convert all files to mp3."
|
||||
find "$OLD" ! -name "*".mp3 | while read file; do
|
||||
echo "* Ensure all files are mp3."
|
||||
find "$OLD" -type f ! -name "*".mp3 | while read file; do
|
||||
echo "** Working on '$file'."
|
||||
ffmpeg -nostdin -hide_banner -loglevel quiet -i "$file" "$file".converted.mp3
|
||||
status="$?"
|
||||
if [[ $status != 0 ]]; then
|
||||
echo "*** FAILED: Exited with status '$status'."
|
||||
else
|
||||
echo "*** Success!"
|
||||
fi
|
||||
done
|
||||
echo "** Done converting mp3s."
|
||||
echo "** Done converting any mp3s."
|
||||
|
||||
## Transform Media ##
|
||||
|
||||
@ -78,7 +85,7 @@ function migrate_music {
|
||||
file="$1"
|
||||
command="$2"
|
||||
|
||||
if [[ -z $file ]]; then
|
||||
if [[ -z "$file" ]]; then
|
||||
echo "ERROR: No filename retrieved, cannot migrate."
|
||||
return 1
|
||||
fi
|
||||
@ -143,7 +150,7 @@ function migrate_music {
|
||||
echo "*** Year=$year"
|
||||
|
||||
parent=""
|
||||
if [[ -s $year && -s $album ]]; then
|
||||
if [[ -n $year && -n $album ]]; then
|
||||
parent="$year - $album"
|
||||
else
|
||||
parent="$year$album"
|
||||
@ -187,11 +194,11 @@ function migrate_music {
|
||||
|
||||
# Prefer Artist, then Band, then Albumartist
|
||||
grandparent=""
|
||||
if [[ -s $album ]]; then
|
||||
if [[ -n $album ]]; then
|
||||
grandparent="$album"
|
||||
elif [[ -s $band ]]; then
|
||||
elif [[ -n $band ]]; then
|
||||
grandparent="$band"
|
||||
elif [[ -s $album_artist ]]; then
|
||||
elif [[ -n $album_artist ]]; then
|
||||
grandparent="$album_artist"
|
||||
else
|
||||
grandparent="Unknown"
|
||||
@ -199,6 +206,9 @@ function migrate_music {
|
||||
|
||||
new_file="$grandparent/$new_file"
|
||||
|
||||
# Create the new directories if they do not already exist.
|
||||
mkdir -pv "$NEW/$grandparent/$parent"
|
||||
|
||||
# Move the file.
|
||||
new_file="$NEW/$new_file"
|
||||
$command -v "$file" "$new_file"
|
||||
|
Loading…
x
Reference in New Issue
Block a user