-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflac2mp3
More file actions
executable file
·32 lines (24 loc) · 766 Bytes
/
Copy pathflac2mp3
File metadata and controls
executable file
·32 lines (24 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 FILE..."
exit 0
fi
function recode() {
file="$1"
echo "Recoding $file"
mp3file="$(sed 's/flac$/mp3/' <<< $(basename "$file"))"
artist=$(metaflac --show-tag=artist "$file" | cut -d = -f 2-)
title=$(metaflac --show-tag=title "$file" | cut -d = -f 2-)
album=$(metaflac --show-tag=album "$file" | cut -d = -f 2-)
tracknumber=$(metaflac --show-tag=tracknumber "$file" | cut -d = -f 2-)
tracktotal=$(metaflac --show-tag=tracktotal "$file" | cut -d = -f 2-)
nice flac -dcs "$file" | lame --quiet - "$mp3file" || return
id3 -2 -altn "$artist" "$album" "$title" "$tracknumber/$tracktotal" "$mp3file" || return
}
files=()
while [ $# -gt 0 ]; do
files+=("$1")
shift
done
. ~/.bin/recode_base
recode_start