Compare commits

...

5 Commits

Author SHA1 Message Date
ademant 1eaf25f777 serialize json 2020-10-04 12:51:43 +02:00
A. Demant 1ce158ea0d changed to metaflac, which is really faster 2018-10-29 21:34:54 +01:00
A. Demant 3f5026bedc copy flac by idv3 data 2018-10-29 20:10:28 +01:00
A. Demant a1865cf16d creates opus/mp3 in another directory 2018-10-29 20:06:59 +01:00
A. Demant a08228018c check if opus file exist 2018-10-29 19:42:16 +01:00
4 changed files with 51 additions and 2 deletions

24
copy_flac.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
TARGET=/tmp/Musik/flac
INPUT=$1
if [ ! -f "${INPUT}" ]; then
echo Input file missing
exit 1
fi
AUTHOR=$(metaflac --show-tag=ARTIST "${INPUT}"|cut -d= -f2|sed -e 's/^[\ ]*//g;s/\ /_/g;s/\///g')
echo $AUTHOR
ALBUM=$(metaflac --show-tag=ALBUM "${INPUT}"|cut -d= -f2|sed -e 's/^[\ ]*//g;s/\ /_/g;s/,//g;s/\///g')
echo $ALBUM
TITLE=$(metaflac --show-tag=TITLE "${INPUT}"|cut -d= -f2|cut -d\( -f1 |sed -e 's/^[\ ]*//g;s/\ /_/g;s/,//g;s/\///g;s/\&//g'|sed -e 's/__/_/g'|sed -e 's/_$//g')
echo $TITLE
TRACK=$(printf "%03d" $(metaflac --show-tag=TRACKNUMBER "${INPUT}"|cut -d= -f2|sed -e 's/^[\ ]*//g'))
echo $TRACK
if [ ! -d "${TARGET}"/"${AUTHOR}"/"${ALBUM}" ]; then
mkdir -p "${TARGET}"/"${AUTHOR}"/"${ALBUM}"
fi
cp --reflink=always "${INPUT}" "${TARGET}"/"${AUTHOR}"/"${ALBUM}"/${TRACK}_"${TITLE}".flac

14
flac2mp3.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
INFILE=$1
echo $INFILE
OUTFILE=$(basename "$1" .flac).mp3
DIRNAME=$(dirname "$1"|sed -e 's/flac/mp3/g')
echo $DIRNAME/$OUTFILE
if [ ! -d "$DIRNAME" ]; then
mkdir -p "$DIRNAME"
fi
if [ ! -z "$1" ]; then
ffmpeg -i "$INFILE" -qscale:a 7 "$DIRNAME/$OUTFILE"
fi

View File

@ -2,5 +2,13 @@
INFILE=$1
echo $INFILE
OUTFILE=$(basename "$1" .flac).ogg
echo $OUTFILE
opusenc --bitrate 22 --framesize 20 "${INFILE}" "${OUTFILE}"
DIRNAME=$(dirname "$1"|sed -e 's/flac/ogg/g')
echo $DIRNAME/$OUTFILE
if [ ! -d "$DIRNAME" ]; then
mkdir -p "$DIRNAME"
fi
if [ ! -z "$1" ]; then
opusenc --bitrate 22 --framesize 20 "${INFILE}" "${DIRNAME}/${OUTFILE}"
fi

3
serialize_json.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
read injson
echo ${injson}|sed -e 's/"//g;s/,/\n/g;s/{/{\n/g;s/}/\n}/g'|awk -F ":" 'BEGIN{topic=""};/:{/{length(topic)>0 ? topic=topic$1"/" : topic=$1"/"};!/{/&&!/}/{print "\""topic$1"\":\""$2"\""};/}/{l=split(topic,t,"/");topic="";for(i=1;i<(l-1);i++)topic=topic""t[i]"/"}'