This commit is contained in:
a3x 2020-07-24 18:20:05 +00:00
parent 0bcf1a8ec4
commit 35a29a5048

View file

@ -16,9 +16,19 @@ metadata()
echo \;FFMETADATA1 > metadata.txt ;
echo "title=$title" >> metadata.txt ;
if [ -z "$url" ]; then
for i in ./*.mp3; do echo CHAPTER0$ni=$(date -u -d @$(($chs/1000)) +%H:%M:%S).00; echo CHAPTER0${ni}NAME=$(echo $i | sed -e 's/^\.\/\(.*\).mp3$/\1/'); chs=$(( $chs + $(date -u -d"$(ffmpeg -i "$i" 2>&1 | grep Duration | sed -e 's/.*ion: \(.*\), s.*/\1/')" +%s%N) / 1000000 )); ni=$(($ni+1)) ; done >> metadata.txt
for i in ./*.mp3;
do echo CHAPTER0$ni=$(date -u -d @$(($chs/1000)) +%H:%M:%S).00;
echo CHAPTER0${ni}NAME=$(echo $i | sed -e 's/^\.\/\(.*\).mp3$/\1/');
chs=$(( $chs + $(date -u -d"$(ffmpeg -i "$i" 2>&1 | grep Duration | sed -e 's/.*ion: \(.*\), s.*/\1/')" +%s%N) / 1000000 ));
ni=$(($ni+1)) ;
done >> metadata.txt
else
for i in $(echo $curl | sed -e 's/<nl>/\n/g') ; do echo CHAPTER0$ni=$(date -u -d @$(($chs/1000)) +%H:%M:%S).00; echo CHAPTER0${ni}NAME=$(echo $i | sed -e 's/<del>.*//' -e 's/<space>/ /g'); chs=$(( $chs + $(date -u -d"$(echo $i | sed -e 's/.*<del>//')" +%s%N) / 1000000 )); ni=$(($ni+1)) ; done >> metadata.txt
for i in $(echo $curl | sed -e 's/<nl>/\n/g') ; do
echo CHAPTER0$ni=$(date -u -d @$(($chs/1000)) +%H:%M:%S).00;
echo CHAPTER0${ni}NAME=$(echo $i | sed -e 's/<del>.*//' -e 's/<space>/ /g');
chs=$(( $chs + $(date -u -d"$(echo $i | sed -e 's/.*<del>//')" +%s%N) / 1000000 ));
ni=$(($ni+1)) ;
done >> metadata.txt
fi
}
@ -34,11 +44,19 @@ chaptersxml()
echo "<enclosure url=\"https://podcast.eris.cc/tkkg/$num.opus\" type=\"audio/ogg\" length=\"1\"/>" >> chapter.xml
echo "<guid>https://podcast.eris.cc/tkkg/$num.opus</guid>" >> chapter.xml
echo '<psc:chapters xmlns:psc="http://podlove.org/simple-chapters" version="1.2">' >> chapter.xml
if [ -z "$url" ]; then
for i in ./*.mp3; do echo "<psc:chapter start=\"$(date -u -d @$(($chs/1000)) +%H:%M:%S).000\" title=\"$(echo $i | sed -e 's/^\.\/\(.*\).mp3$/\1/')\"/>"; chs=$(( $chs + $(date -u -d"$(ffmpeg -i "$i" 2>&1 | grep Duration | sed -e 's/.*ion: \(.*\), s.*/\1/')" +%s%N) / 1000000 )); ni=$(($ni+1)) ; done >> chapter.xml
else
for i in $(echo $curl | sed -e 's/<nl>/\n/g'); do echo "<psc:chapter start=\"$(date -u -d @$(($chs/1000)) +%H:%M:%S).000\" title=\"$(echo $i | sed -e 's/<del>.*//' -e 's/<space>/ /g')\"/>"; chs=$(( $chs + $(date -u -d"$(echo $i | sed -e 's/.*<del>//')" +%s%N) / 1000000 )); ni=$(($ni+1)) ; done >> chapter.xml
if [ -z "$url" ]; then
for i in ./*.mp3; do
echo "<psc:chapter start=\"$(date -u -d @$(($chs/1000)) +%H:%M:%S).000\" title=\"$(echo $i | sed -e 's/^\.\/\(.*\).mp3$/\1/')\"/>";
chs=$(( $chs + $(date -u -d"$(ffmpeg -i "$i" 2>&1 | grep Duration | sed -e 's/.*ion: \(.*\), s.*/\1/')" +%s%N) / 1000000 ));
ni=$(($ni+1)) ;
done >> chapter.xml
else
for i in $(echo $curl | sed -e 's/<nl>/\n/g'); do
echo "<psc:chapter start=\"$(date -u -d @$(($chs/1000)) +%H:%M:%S).000\" title=\"$(echo $i | sed -e 's/<del>.*//' -e 's/<space>/ /g')\"/>";
chs=$(( $chs + $(date -u -d"$(echo $i | sed -e 's/.*<del>//')" +%s%N) / 1000000 ));
ni=$(($ni+1)) ;
done >> chapter.xml
fi
echo '</psc:chapters>' >> chapter.xml
echo "<itunes:duration>$(date -u -d @$(($chs/1000)) +%H:%M:%S)</itunes:duration>" >> chapter.xml
@ -49,7 +67,9 @@ chaptersxml()
cd "$1"
metadata
chaptersxml
for f in ./*.mp3; do echo "file '$(echo "$f" | sed "s/'/'\\\''/g" )'" >> mylist.txt ;done
for f in ./*.mp3; do
echo "file '$(echo "$f" | sed "s/'/'\\\''/g" )'" >> mylist.txt ;
done
ffmpeg -f concat -safe 0 -i mylist.txt -i metadata.txt -map_metadata 1 -codec libopus -vbr on -b:a 128000 "$path/$num.opus"
#rm metadata.txt mylist.txt
cd ..