config/music: adjust ordering helpers

This commit is contained in:
xeruf 2021-11-16 10:20:13 +01:00
parent 0bd4308ef6
commit bb2df41e23
4 changed files with 49 additions and 30 deletions

View File

@ -120,7 +120,12 @@
"melodic",
"Progressive House",
"calibrate",
"minecraft"
"virtual self",
"giants",
"fathers",
"father",
"piano",
""
]
},
"&Pattern": {
@ -208,7 +213,7 @@
",? ?( (&|fe?a?t(uring)?.?|x|and|/|\\+) |/|, ) ?",
",? ?( (&|fe?a?t(uring)?.?|x|and|/|\\+) |/|, |\\\\\\\\) ?",
"^; ",
"^; "
"(.*) & (.*)"
]
},
"Replace &matches with:": {
@ -230,7 +235,7 @@
"\\\\",
"; ",
"",
""
"$1; $2"
]
},
"&Separator": {

View File

@ -42,4 +42,7 @@ Mix; DnB
Mix; DnB; Energy
House; Canto
Soundtrack
Dubstep; Vocal; Liquid
Dubstep; Vocal; Liquid
Electronic
Piano
Electronic; Vocal

View File

@ -16,7 +16,7 @@
"main": {
"lang": "auto",
"lastfolder": "/home/janek/data/music",
"maximized": true
"maximized": false
},
"playlist": {
"extinfo": 1,
@ -42,7 +42,7 @@
"fontsize": 10,
"rowsize": 43,
"sort_fields": [
"album"
"track"
],
"sort_reverse": false
},
@ -84,11 +84,12 @@
"Length",
"Year",
"Genre",
"Path",
"BPM",
"Comment",
"Bitrate",
"Path",
"Album Artist"
"Album Artist",
"Tags"
],
"tags": [
"__dirpath",
@ -100,11 +101,12 @@
"__length",
"year",
"genre",
"__path",
"bpm",
"comment",
"__bitrate",
"__path",
"albumartist"
"albumartist",
"version"
]
},
"editor": {

View File

@ -4,7 +4,8 @@ MUSIC_RAW="$AUDIO/songs/_raw"
alias scbra='scpr zebra "/srv/funkwhale/data/music${PWD/$MUSIC}"'
findsongs() {
find -regextype posix-extended -maxdepth 1 -type f -regex "${1:-.*\.(mp3|flac|wav|m4a)}" -printf "%P\n"
find -regextype posix-extended -maxdepth 1 -type f \
-regex "${1:-.*\.(mp3|flac|wav|m4a)}" -printf "%P\n"
}
addmix() {
@ -36,17 +37,17 @@ addsong() {
addalbum() {
mkdir -p "$MUSIC/$1"
mkdir -p "$MUSIC_RAW/$1"
f1 -regextype posix-extended -type f -regex "\./(cover|folder)\.(png|jpg|jpeg)" | while read cover; do
foundcover="true"
cp -v "$cover" "$MUSIC/$1" &&
mv -v "$cover" "$MUSIC_RAW
/$1"
done
test "$foundcover" || f1 -regextype posix-extended -type f -regex ".*\.(png|jpg|jpeg)" | while read cover; do
cp -v "$cover" "$MUSIC/$1" &&
mv -v "$cover" "$MUSIC_RAW
/$1"
done
f1 -regextype posix-extended -type f -regex "\./(cover|folder)\.(png|jpg|jpeg)" |
while read cover; do
foundcover="true"
cp -v "$cover" "$MUSIC/$1" &&
mv -v "$cover" "$MUSIC_RAW/$1"
done
test "$foundcover" || f1 -regextype posix-extended -type f -regex ".*\.(png|jpg|jpeg)" |
while read cover; do
cp -v "$cover" "$MUSIC/$1" &&
mv -v "$cover" "$MUSIC_RAW/$1"
done
IFS=$'\n'
for s in $(findsongs ".*\.(flac|wav)"); do
@ -57,12 +58,12 @@ addalbum() {
}
formatsongs() {
_pwd="$PWD"
find "$PWD" "$@" -type d | while read d; do builtin cd $d; findsongs | while read song; do
new="$(formatsong "$song")"
test "$new" && test "$new" != "$song" && mv -iv "$song" "$new"
done; done
builtin cd "$_pwd"
(
find -maxdepth 1 -type d | formatin
find "$@" "$PWD" -type d | while read d;
do builtin cd $d && findsongs | formatin
done
)
IFS=$'\n'
for f in $(find "$@" -name "*.wav"); do
echo "Converting $f to ${f%.*}.flac"
@ -71,9 +72,17 @@ formatsongs() {
unset IFS
}
# Normalize filenames from stding
formatin() {
while read song; do
new="$(formatsong "$song")"
test "$new" && test "$new" != "$song" && mv -iv "$song" "$new"
done
}
formatsong() {
echo "$1" | sed -e 's/\([ ([]\)\(ft\|Ft\|Feat\|featuring\)\([ .]\)/\1feat\3/;
s/\([ ([]\)feat /\1feat. /;
echo "$1" | sed -e 's/\b\(ft\|Ft\|Feat\|featuring\)\([ .]\)/feat\2/;
s/\bfeat /feat. /;
s/ \((Original Mix)\|(Original)\|(Full Stream)\|.NCS Release.\)//i;
s/ (\(Acoustic\|Live\))/ [\1]/i;
s/ \[\(feat.*\)\]/ (\1)/i;