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