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

View File

@ -43,3 +43,6 @@ Mix; DnB; Energy
House; Canto House; Canto
Soundtrack Soundtrack
Dubstep; Vocal; Liquid Dubstep; Vocal; Liquid
Electronic
Piano
Electronic; Vocal

View File

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

View File

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