From db9b491324a43b0feba28fec3f084e9366e4472d Mon Sep 17 00:00:00 2001 From: Ken Fallon Date: Tue, 24 Dec 2024 13:41:40 +0100 Subject: [PATCH] Cleanup of the show processing workflow --- workflow/hpr-logo.jpg | Bin 15105 -> 0 bytes workflow/hprid | 268 --------- workflow/hprid.sh | 268 --------- workflow/hprtranscode-archive.bash | 422 ------------- workflow/hprtranscode-just-transcode.bash | 238 -------- workflow/hprtranscode-simple.bash | 603 ------------------- workflow/hprtranscode-simple.bash.2022-07-31 | 397 ------------ workflow/show2youtube.bash | 60 -- workflow/status_lighttower.py | 233 ------- workflow/this_duration.bash | 18 - workflow/unpack.bash | 44 -- workflow/x.bash | 50 -- 12 files changed, 2601 deletions(-) delete mode 100644 workflow/hpr-logo.jpg delete mode 100755 workflow/hprid delete mode 100755 workflow/hprid.sh delete mode 100644 workflow/hprtranscode-archive.bash delete mode 100755 workflow/hprtranscode-just-transcode.bash delete mode 100755 workflow/hprtranscode-simple.bash delete mode 100644 workflow/hprtranscode-simple.bash.2022-07-31 delete mode 100755 workflow/show2youtube.bash delete mode 100644 workflow/status_lighttower.py delete mode 100755 workflow/this_duration.bash delete mode 100644 workflow/unpack.bash delete mode 100755 workflow/x.bash diff --git a/workflow/hpr-logo.jpg b/workflow/hpr-logo.jpg deleted file mode 100644 index c8985dd8eb69d830a86ec00814dde71ae1ec1282..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15105 zcmbumdo)!2`!_x+Au&!-#B?A^Ob3T@n5kPONmD68Or>&|n7f3LF;fXKm`ZV{50jiK zG+_pbnV3N*w=%A6c@AsPP+SmJfU9Z=5 z&Els;F+%Uq0j~oHH8nNFAMg)iQH5CROT2hB{_K?tF6-js z-1tXz%c|o&faT6}S8i&pFg97e#?)$)waw-&4vtRFyLP*H?Aw39^Ptxu-xDYO{7(f0 zhMvE0F)TbHGUjS*Ts$e^TJo)w)U?~_8TWGTKgiAd>tX(r;*!#`@~6+9*VMAub@dIe z8e4h%w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L|I-dY6UB-zK<1U?0QR6 z6js-BHOa8$=*Q4h_bY=U{=LS3Xt9P=cgN3)gHVbTl@YRIkW7#!@EfzMc5N57H3UrL zlUJd8=KdELgCBFXVWeI}tcBtT z-qhOyM=tI0P0|-S|C-@m3DZd6^42^$Q2U_&-hR`MTQBx%2Vs$)T`S!GuCUCm=}>B` z-eQ5v44EPDT;$X1wpo7com6MZ#||UBE;Um7;GA$*R8Ba%4sSHIaC0(0>52Umi6vU8 zIGidNHnP5Rm*$M^FgH?D-ScAr0W+V*$CNC8Y#mNv=qvtBN6+cB%B95C9!dQWG5CS0 zcw#KL2Tm~hZ!T{*97jHRzy6{Axst6_pCNxKTrBEo;QyMmFnq0ii9K&CuQNO{Y6xQ6 zgw}P1M}h~)+ojA*zh__T*GGkJw?XXJJE}*`&rX)YU+oE$dUIEjXu-hO{ubk)0uBFu z2U@zHyWH4|C8s5(%G^mJHZgax5co%ep#9>gNTyUG^|8}JQ z@aZzG@XKKrVN~m7+bwR ztEXzsax3PBgURBCJu|FXc=1CcDF1zsBP3749mR4c4dFt%??6m zkD|L-Hqv;+2M3FluNcd6YyV2wE5)<$inRq}OijoE!p~oUZ~%UOAE49RG=I(Fm6T9r zh##zq>VDt}@*2ZMOp0saab*HW=jW$$t4Ub7G6j>!nhc?DA&>lblEwPEpeHNRwrbZS%$P zmy;4)x1{*xPk!?XyPu-AH~yRvV%L)E*a$8G4Q*LO&?wuX+LK^N5gbx$6bVpT(%L)D zd{nw=Zsk=w7lU4}RWFi@N8LGPg5cVNl+I#-faH0w?~D2+S#;DvKSeyq%q9nbCVc0@ z&0tx50+SHm5Mcjf*m#%Sz!y^GRrx^!TX$!lx`^|}`OyqwRA}Uj4@BbXb4cs`2%}^B J5!A)u{{>=>Htzrc diff --git a/workflow/hprid b/workflow/hprid deleted file mode 100755 index 477da15..0000000 --- a/workflow/hprid +++ /dev/null @@ -1,268 +0,0 @@ -#!/bin/bash -# hprid - -################################################################################ -# -# script to prepare audio files for HPR shows -# -# input: mp3 or ogg file -# result: mp3, ogg in 44100 Hz, spx files 16000Hz with intro and outro -# provides 3 interactive checks for audio quality, intro and outro -# -################################################################################ -# This file is part of the HPR Tool set -# -# HPR Tool set is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# HPR Tool set is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with HPR Tool set. If not, see . -# http://www.gnu.org/licenses/agpl-3.0.html -# ######################################################################### - -################################################################################ -# -# PREREQUISITS -# - current folder has to be writable -# - there should NOT be a temp.ogg or temp.mp3 file -# - intro.mp3 and outro.mp3 have to be present -# - IMPORTANT: sox compiled with mp3 support -# see http://a0u.xanga.com/700438974/howto-soc-installation -# -# -# IMPORTANT -# Backup the files before feeding them to this script, no guarantees here -# Handling of .wav not yet tested, but it should work -# -# code.cruncher, May 2011 -# -################################################################################ - -################################################################################ -# -# TODO -# -# test handling of wav files -# add play final files or open them in specific player(s) -# add handling of ID3 tags -# create html interface for standardized info gathering -# -################################################################################ - - -#============================================================ -# Check input -usage="usage: $(basename $0 ) [ -i ] [ -o ] , -i to add intro and -o outro, fname is a file with audio for HPR" - -CHANNELS="1" -ADDINTRO="n" -ADDOUTRO="n" - - -while getopts "io" opt; do - case $opt in - i ) - ADDINTRO="y" - ;; - o ) - ADDOUTRO="y" - ;; - esac -done -shift $(($OPTIND - 1)) - -# if not ${mediafile} return usage -if [ $# -lt 1 ]; then - echo $usage - exit 1 -fi - -mediafile=${1} - -# test if file exists -if [ ! -f "intro.flac" ]; then - echo "sorry, file \"intro.flac\" does not exist" - echo "To download it run the command:" - echo " wget http://hackerpublicradio.org/media/theme-music/intro.flac" - exit 1 -fi - -if [ ! -f "outro.flac" ]; then - echo "sorry, file \"outro.flac\" does not exist" - echo "To download it run the command:" - echo " wget http://hackerpublicradio.org/media/theme-music/outro.flac" - exit 1 -fi - -for mediafile in "$@" -do - echo $var - - if [ ! -f "${mediafile}" ]; then - echo "sorry, file \"${mediafile}\" does not exist" - continue - fi - - # test if file exists - if [ ! -r "${mediafile}" ]; then - echo "sorry, file \"${mediafile}\" is not readable" - continue - fi - - if [ $(ffprobe "${mediafile}" 2>&1 | grep "Audio:" | wc -l ) -eq 0 ]; then - echo "sorry, file \"${mediafile}\" has no audio track" - continue - fi - - # extract file name and extension - fname=${mediafile%.*} - ext=${mediafile/*./} - - #Make a backup - # mediafilebackup=${mediafile}_$(md5sum ${mediafile} | cut -c -32 )_orig.${ext} - # cp -v ${mediafile} ${mediafilebackup} - # - # if [[ ! -e ${mediafilebackup} ]]; then - # echo "Backup not made: ${mediafilebackup}" - # exit - # fi - - # check audio quality - dur=7 # playtime of sample in seconds - go=1 # variable to repeat playing of sample - from=180 # start sample at 3 minutes in - - #============================================================ - # Question Time - - # # # while [ $go -ne 0 ] - # # # do - # # # echo - # # # echo "--------------------------------------------------------------------------------" - # # # echo "1/4 AUDIO TEST: check audio quality: ... playing $dur seconds ..." - # # # play "${mediafile}" trim $from $dur - # # # ((from+=180)) # next sample will be 3 minutes later - # # # read -s -n1 -p "sound quality ok?[y,n] ... or play another sample[a] ... [y,n,a]" - # # # echo - # # # case "$REPLY" in - # # # n) echo "aborting ... get better quality sound file ... good bye!"; exit 0;; - # # # y) go=0;; - # # # esac - # # # done - # # # - # # # # Check for intro - # # # echo - # # # echo "--------------------------------------------------------------------------------" - # # # echo "2/4 ADDINTRO TEST: Is the intro playing? " - # # # play "${mediafile}" trim 1 5 # play 5 seconds at beginning of file - # # # read -s -n1 -p "Is there a intro? [y, n]" -i "n"; echo - # # # if [ "$REPLY" = 'y' ]; then - # # # echo "Will add the intro" - # # # ADDINTRO="y" - # # # fi - # # # - # # # # Check for outro - # # # echo - # # # echo "--------------------------------------------------------------------------------" - # # # echo "3/4 ADDOUTRO TEST: Is the outro playing? " - # # # len=$(eval "soxi -D \"${mediafile}\"") - # # # len=$(echo "scale=0; $len - 50" | bc) - # # # play "${mediafile}" trim $len 5 - # # # read -s -n1 -p "Is there a outro ? [y, n]" -i "n"; echo - # # # if [ "$REPLY" = 'y' ]; then - # # # echo "Will add the outro" - # # # ADDOUTRO="y" - # # # fi - # # # - # # # - # # # echo - # # # echo "--------------------------------------------------------------------------------" - # # # echo "4/4 STEREO TEST: Should this be mono or stereo [m,s] ? " - # # # CHANNELS="1" - # # # read -s -n1 -p "intro ok? [m, s]" -i "m" ; echo - # # # if [ "$REPLY" = 's' ]; then - # # # echo "Will convert to stereo" - # # # CHANNELS="2" - # # # fi - - #============================================================ - # Preprocess the source file - - echo "Convert from ${mediafile} to known wav format ${fname}_tmp.wav" - ffmpeg -i ${mediafile} -ar 44100 -ac $CHANNELS ${fname}_tmp.wav > ${fname}_tmp.log 2>&1 - - # echo "Normalising the audio" - # normalize -a 0.5 ${fname}_tmp.wav >> ${fname}_tmp.log 2>&1 - - # TODO Compressor ! - - # TODO add a little speed up - - # TODO little overlap in fade in of intro - - # echo "Truncating the silence" - # sox ${fname}_tmp.wav ${fname}_sox.wav silence -l 1 0.1 1.6% -1 0.6 1.6% >> ${fname}_tmp.log 2>&1 - cp -v ${fname}_tmp.wav ${fname}_sox.wav - - echo "Add the intro if it is missing and add it to the temp pcm file" - if [ "$ADDINTRO" = 'y' ]; then - ffmpeg -i intro.flac -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - > ${fname}_tmp.pcm 2>> ${fname}_tmp.log - fi - - echo "convert the uploaded episode and add it to the temp pcm file" - ffmpeg -i ${fname}_sox.wav -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp.pcm 2>> ${fname}_tmp.log - - echo "Add the outro if it is missing and add it to the temp pcm file" - if [ "$ADDOUTRO" = 'y' ]; then - ffmpeg -i outro.flac -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp.pcm 2>> ${fname}_tmp.log - fi - - echo "Convert the pcm file to a know wav format" - ffmpeg -f s16le -ar 44100 -ac 1 -acodec pcm_s16le -i ${fname}_tmp.pcm ${fname}_mez.wav 2>> ${fname}_tmp.log - - # echo "Get an image of the converted audio" - # sox ${fname}_mez.wav -n spectrogram -x 800 -y 100 -o ${fname}_mez.png - - echo "--------------------------------------------------------------------------------" - echo "File information" - ffprobe ${fname}_mez.wav 2>&1 | grep Audio: - mediainfo ${fname}_mez.wav - - echo "--------------------------------------------------------------------------------" - # display ${fname}_mez.png & - # read -s -n1 -p "Spectrogram check: Everything look ok [y,n] ? " -i "y" ; echo - # if [ "$REPLY" = 'n' ]; then - # echo "Something went w rong. Aborting." - # exit - # fi - - # echo "--------------------------------------------------------------------------------" - # vlc ${fname}_mez.wav >> ${fname}_tmp.log 2>&1 & - # read -s -n1 -p "VLC check: Everything look ok [y,n] ? " -i "y" ; echo - # if [ "$REPLY" = 'n' ]; then - # echo "Something went wrong. Aborting." - # exit - # fi - - echo "Remove temp files" - rm -v ${fname}_tmp.wav ${fname}_sox.wav ${fname}_tmp.pcm ${fname}_tmp.log - - echo "Convert to mp3" # TODO and add tags" - sox -S ${fname}_mez.wav ${fname}_mez.mp3 - - echo "Convert to ogg" # TODO and add tags" - sox -S ${fname}_mez.wav ${fname}_mez.ogg - - echo "Convert to spx" # TODO and add tags" - sox -S ${fname}_mez.wav -c 1 -r 16000 -t wav - | speexenc - ${fname}_mez.spx - - echo "Changing the file dates to the time of upload" - touch -r ${mediafile} ${fname}* -done diff --git a/workflow/hprid.sh b/workflow/hprid.sh deleted file mode 100755 index 477da15..0000000 --- a/workflow/hprid.sh +++ /dev/null @@ -1,268 +0,0 @@ -#!/bin/bash -# hprid - -################################################################################ -# -# script to prepare audio files for HPR shows -# -# input: mp3 or ogg file -# result: mp3, ogg in 44100 Hz, spx files 16000Hz with intro and outro -# provides 3 interactive checks for audio quality, intro and outro -# -################################################################################ -# This file is part of the HPR Tool set -# -# HPR Tool set is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# HPR Tool set is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with HPR Tool set. If not, see . -# http://www.gnu.org/licenses/agpl-3.0.html -# ######################################################################### - -################################################################################ -# -# PREREQUISITS -# - current folder has to be writable -# - there should NOT be a temp.ogg or temp.mp3 file -# - intro.mp3 and outro.mp3 have to be present -# - IMPORTANT: sox compiled with mp3 support -# see http://a0u.xanga.com/700438974/howto-soc-installation -# -# -# IMPORTANT -# Backup the files before feeding them to this script, no guarantees here -# Handling of .wav not yet tested, but it should work -# -# code.cruncher, May 2011 -# -################################################################################ - -################################################################################ -# -# TODO -# -# test handling of wav files -# add play final files or open them in specific player(s) -# add handling of ID3 tags -# create html interface for standardized info gathering -# -################################################################################ - - -#============================================================ -# Check input -usage="usage: $(basename $0 ) [ -i ] [ -o ] , -i to add intro and -o outro, fname is a file with audio for HPR" - -CHANNELS="1" -ADDINTRO="n" -ADDOUTRO="n" - - -while getopts "io" opt; do - case $opt in - i ) - ADDINTRO="y" - ;; - o ) - ADDOUTRO="y" - ;; - esac -done -shift $(($OPTIND - 1)) - -# if not ${mediafile} return usage -if [ $# -lt 1 ]; then - echo $usage - exit 1 -fi - -mediafile=${1} - -# test if file exists -if [ ! -f "intro.flac" ]; then - echo "sorry, file \"intro.flac\" does not exist" - echo "To download it run the command:" - echo " wget http://hackerpublicradio.org/media/theme-music/intro.flac" - exit 1 -fi - -if [ ! -f "outro.flac" ]; then - echo "sorry, file \"outro.flac\" does not exist" - echo "To download it run the command:" - echo " wget http://hackerpublicradio.org/media/theme-music/outro.flac" - exit 1 -fi - -for mediafile in "$@" -do - echo $var - - if [ ! -f "${mediafile}" ]; then - echo "sorry, file \"${mediafile}\" does not exist" - continue - fi - - # test if file exists - if [ ! -r "${mediafile}" ]; then - echo "sorry, file \"${mediafile}\" is not readable" - continue - fi - - if [ $(ffprobe "${mediafile}" 2>&1 | grep "Audio:" | wc -l ) -eq 0 ]; then - echo "sorry, file \"${mediafile}\" has no audio track" - continue - fi - - # extract file name and extension - fname=${mediafile%.*} - ext=${mediafile/*./} - - #Make a backup - # mediafilebackup=${mediafile}_$(md5sum ${mediafile} | cut -c -32 )_orig.${ext} - # cp -v ${mediafile} ${mediafilebackup} - # - # if [[ ! -e ${mediafilebackup} ]]; then - # echo "Backup not made: ${mediafilebackup}" - # exit - # fi - - # check audio quality - dur=7 # playtime of sample in seconds - go=1 # variable to repeat playing of sample - from=180 # start sample at 3 minutes in - - #============================================================ - # Question Time - - # # # while [ $go -ne 0 ] - # # # do - # # # echo - # # # echo "--------------------------------------------------------------------------------" - # # # echo "1/4 AUDIO TEST: check audio quality: ... playing $dur seconds ..." - # # # play "${mediafile}" trim $from $dur - # # # ((from+=180)) # next sample will be 3 minutes later - # # # read -s -n1 -p "sound quality ok?[y,n] ... or play another sample[a] ... [y,n,a]" - # # # echo - # # # case "$REPLY" in - # # # n) echo "aborting ... get better quality sound file ... good bye!"; exit 0;; - # # # y) go=0;; - # # # esac - # # # done - # # # - # # # # Check for intro - # # # echo - # # # echo "--------------------------------------------------------------------------------" - # # # echo "2/4 ADDINTRO TEST: Is the intro playing? " - # # # play "${mediafile}" trim 1 5 # play 5 seconds at beginning of file - # # # read -s -n1 -p "Is there a intro? [y, n]" -i "n"; echo - # # # if [ "$REPLY" = 'y' ]; then - # # # echo "Will add the intro" - # # # ADDINTRO="y" - # # # fi - # # # - # # # # Check for outro - # # # echo - # # # echo "--------------------------------------------------------------------------------" - # # # echo "3/4 ADDOUTRO TEST: Is the outro playing? " - # # # len=$(eval "soxi -D \"${mediafile}\"") - # # # len=$(echo "scale=0; $len - 50" | bc) - # # # play "${mediafile}" trim $len 5 - # # # read -s -n1 -p "Is there a outro ? [y, n]" -i "n"; echo - # # # if [ "$REPLY" = 'y' ]; then - # # # echo "Will add the outro" - # # # ADDOUTRO="y" - # # # fi - # # # - # # # - # # # echo - # # # echo "--------------------------------------------------------------------------------" - # # # echo "4/4 STEREO TEST: Should this be mono or stereo [m,s] ? " - # # # CHANNELS="1" - # # # read -s -n1 -p "intro ok? [m, s]" -i "m" ; echo - # # # if [ "$REPLY" = 's' ]; then - # # # echo "Will convert to stereo" - # # # CHANNELS="2" - # # # fi - - #============================================================ - # Preprocess the source file - - echo "Convert from ${mediafile} to known wav format ${fname}_tmp.wav" - ffmpeg -i ${mediafile} -ar 44100 -ac $CHANNELS ${fname}_tmp.wav > ${fname}_tmp.log 2>&1 - - # echo "Normalising the audio" - # normalize -a 0.5 ${fname}_tmp.wav >> ${fname}_tmp.log 2>&1 - - # TODO Compressor ! - - # TODO add a little speed up - - # TODO little overlap in fade in of intro - - # echo "Truncating the silence" - # sox ${fname}_tmp.wav ${fname}_sox.wav silence -l 1 0.1 1.6% -1 0.6 1.6% >> ${fname}_tmp.log 2>&1 - cp -v ${fname}_tmp.wav ${fname}_sox.wav - - echo "Add the intro if it is missing and add it to the temp pcm file" - if [ "$ADDINTRO" = 'y' ]; then - ffmpeg -i intro.flac -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - > ${fname}_tmp.pcm 2>> ${fname}_tmp.log - fi - - echo "convert the uploaded episode and add it to the temp pcm file" - ffmpeg -i ${fname}_sox.wav -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp.pcm 2>> ${fname}_tmp.log - - echo "Add the outro if it is missing and add it to the temp pcm file" - if [ "$ADDOUTRO" = 'y' ]; then - ffmpeg -i outro.flac -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp.pcm 2>> ${fname}_tmp.log - fi - - echo "Convert the pcm file to a know wav format" - ffmpeg -f s16le -ar 44100 -ac 1 -acodec pcm_s16le -i ${fname}_tmp.pcm ${fname}_mez.wav 2>> ${fname}_tmp.log - - # echo "Get an image of the converted audio" - # sox ${fname}_mez.wav -n spectrogram -x 800 -y 100 -o ${fname}_mez.png - - echo "--------------------------------------------------------------------------------" - echo "File information" - ffprobe ${fname}_mez.wav 2>&1 | grep Audio: - mediainfo ${fname}_mez.wav - - echo "--------------------------------------------------------------------------------" - # display ${fname}_mez.png & - # read -s -n1 -p "Spectrogram check: Everything look ok [y,n] ? " -i "y" ; echo - # if [ "$REPLY" = 'n' ]; then - # echo "Something went w rong. Aborting." - # exit - # fi - - # echo "--------------------------------------------------------------------------------" - # vlc ${fname}_mez.wav >> ${fname}_tmp.log 2>&1 & - # read -s -n1 -p "VLC check: Everything look ok [y,n] ? " -i "y" ; echo - # if [ "$REPLY" = 'n' ]; then - # echo "Something went wrong. Aborting." - # exit - # fi - - echo "Remove temp files" - rm -v ${fname}_tmp.wav ${fname}_sox.wav ${fname}_tmp.pcm ${fname}_tmp.log - - echo "Convert to mp3" # TODO and add tags" - sox -S ${fname}_mez.wav ${fname}_mez.mp3 - - echo "Convert to ogg" # TODO and add tags" - sox -S ${fname}_mez.wav ${fname}_mez.ogg - - echo "Convert to spx" # TODO and add tags" - sox -S ${fname}_mez.wav -c 1 -r 16000 -t wav - | speexenc - ${fname}_mez.spx - - echo "Changing the file dates to the time of upload" - touch -r ${mediafile} ${fname}* -done diff --git a/workflow/hprtranscode-archive.bash b/workflow/hprtranscode-archive.bash deleted file mode 100644 index 659a390..0000000 --- a/workflow/hprtranscode-archive.bash +++ /dev/null @@ -1,422 +0,0 @@ -#!/bin/bash -# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/ -#============================================================ -# Check input -usage="usage: $(basename $0 ) [ -i ] [ -o ] , -i to add intro and -o outro, fname is a file with audio for HPR" - -# Argument = -t test -r server -p password -v - -echoerr() -{ -echo "$@" 1>&2; -} - -usage() -{ -cat << EOF -usage: $0 [options] {media file to encode} {episode number} - -OPTIONS: - -h Show this message - -p add a promo - -i add the intro - -s Automatically generate the summary - -o add the outro - -b add the intro and outro ( and summary default) - -2 encode to 2 channels - -n no audio normalization - -x eXclude sponsor mention - -EOF -} - -TEMP_DIR="/var/tmp/" -CHANNELS="1" -FIXAUDIO="1" -ADDSUMMARY="n" -ADDINTRO="n" -ADDPROMO="n" -ADDOUTRO="n" -ADDSPONSOR="y" -ARTIST="EMPTY" -TITLE="EMPTY" -YEAR="EMPTY" -SLOT="EMPTY" -basedir="/var/IA" -intro="${basedir}/intro.flac" -promo="${basedir}/promo.flac" -outro="${basedir}/outro.flac" -anhonesthost="${basedir}/sponsor-anhonesthost.com-hpr15.flac" -internetarchive="${basedir}/sponsor-archive.org.flac" - -while getopts "hipsob2nx" OPTION -do - case $OPTION in - h) - usage - exit 1 - ;; - s) - ADDSUMMARY="y" - ;; - i) - ADDINTRO="y" - ;; - p) - ADDPROMO="y" - ;; - o) - ADDOUTRO="y" - ;; - b) - ADDINTRO="y" - ADDOUTRO="y" - ;; - 2) - CHANNELS="2" - ;; - n) - FIXAUDIO="0" - ;; - x) - ADDSPONSOR="n" - ;; - ?) - usage - exit - ;; - esac -done - -shift $(($OPTIND - 1)) - -if [ "$#" -ne 2 ]; then - echoerr "Please enter the source file and episode number" - exit -fi - -mediafile=${1} -ep_num=${2} - -ep_num=$(echo $ep_num | sed 's/hpr//g') -re='^[0-9]+$' -if ! [[ $ep_num =~ $re ]] ; then - echoerr "error: episode \"${ep_num}\" is not a number" - exit 1 -fi - -if [ ! -f "${anhonesthost}" ]; then - echoerr "sorry, file \"${anhonesthost}\" does not exist" - exit 1 -fi - -if [ ! -f "${internetarchive}" ]; then - echoerr "sorry, file \"${internetarchive}\" does not exist" - exit 1 -fi - -if [ ! -f "${intro}" ]; then - echoerr "sorry, file \"intro.flac\" does not exist" - exit 1 -fi - -if [ "$ADDPROMO" = 'y' ]; then - if [ ! -f "${promo}" ]; then - echoerr "sorry, file \"promo.flac\" does not exist" - exit 1 - fi -fi - -if [ ! -f "${outro}" ]; then - echoerr "sorry, file \"outro.flac\" does not exist" - exit 1 -fi - -if [ ! -f "${mediafile}" ]; then - echoerr "sorry, media file \"${mediafile}\" does not exist" - exit -fi - -if [ ! -r "${mediafile}" ]; then - echoerr "sorry, media file \"${mediafile}\" is not readable" - exit -fi - -if [ $(ffprobe "${mediafile}" 2>&1 | grep "Audio:" | wc -l ) -eq 0 ]; then - echoerr "sorry, media file \"${mediafile}\" has no audio track" - exit -fi - -# extract file name and extension -media_dir=$(dirname ${mediafile}) -fname=${mediafile%.*} -ext=${mediafile/*./} - -if [ "$ADDSUMMARY" = 'n' ]; then - if [ ! -e "${media_dir}/summary.wav" ] - then - echoerr "ERROR: Can not find the summary file \"${media_dir}/summary.wav\"" - wget -O- --timeout=10 --tries=1 --quiet http://hackerpublicradio.org/say.php?id=${ep_num} | grep HPR_summary - exit 1 - fi -fi - -if [[ -e hpr${ep_num}.wav ]] || [[ -e hpr${ep_num}.mp3 ]] || [[ -e hpr${ep_num}.ogg ]] || [[ -e hpr${ep_num}.spx ]] || [[ -e hpr${ep_num}_summary.wav ]] || [[ -e ${fname}_mez_norm.wav ]] || [[ -e ${fname}_mez.wav ]] || [[ -e ${fname}_sox_norm.wav ]] || [[ -e ${fname}_sox.wav ]] || [[ -e ${fname}_tmp_hh.pcm ]] || [[ -e ${fname}_tmp_ia.pcm ]] || [[ -e ${fname}_tmp.log ]] -then - echoerr "Files for this episode already exist." - ls -1 hpr${ep_num}* ${fname}_* 2>/dev/null - exit 1 -fi - -echo "--------------------------------------------------------------------------------" -echo "Geting metadata for hpr${ep_num}" - -while read -r line -do - field=$(echo $line | awk -F ':' '{print $1}') - case $field in - "HPR_summary") - HPR_summary=$(echo $line | grep "HPR_summary: " | cut -c 14- ) - continue - ;; - "HPR_album") - HPR_album=$(echo $line | grep "HPR_album: " | cut -c 12- ) - continue - ;; - "HPR_artist") - HPR_artist=$(echo $line | grep "HPR_artist: " | cut -c 13- ) - continue - ;; - "HPR_comment") - HPR_comment=$(echo $line | grep "HPR_comment: " | cut -c 14- ) - continue - ;; - "HPR_genre") - HPR_genre=$(echo $line | grep "HPR_genre: " | cut -c 12- ) - continue - ;; - "HPR_title") - HPR_title=$(echo $line | grep "HPR_title: " | cut -c 12- ) - continue - ;; - "HPR_track") - HPR_track=$(echo $line | grep "HPR_track: " | cut -c 12- ) - continue - ;; - "HPR_year") - HPR_year=$(echo $line | grep "HPR_year: " | cut -c 11- ) - continue - ;; - "HPR_duration") - HPR_duration=$(echo $line | grep "HPR_duration: " | cut -c 15- ) - continue - ;; - "HPR_explicit") - HPR_explicit=$(echo $line | grep "HPR_explicit: " | cut -c 15- ) - continue - ;; - "HPR_license") - HPR_license=$(echo $line | grep "HPR_license: " | cut -c 14- ) - continue - ;; - esac -done < <( wget --timeout=10 --tries=1 --quiet http://hackerpublicradio.org/say.php?id=${ep_num} -O - ) - -if [[ -z "$ADDINTRO" || -z "$ADDPROMO" || -z "$ADDSUMMARY" || -z "$ADDOUTRO" || -z "$HPR_album" || -z "$HPR_artist" || -z "$HPR_comment" || -z "$HPR_genre" || -z "$HPR_title" || -z "$HPR_track" || -z "$HPR_year" || -z "$HPR_summary" || -z "$HPR_duration" || -z "$HPR_explicit" || -z "$HPR_license" ]] -then - echoerr "Could not find information on ${ep_num}. Has the show been posted ?" - exit; -fi -echo "--------------------------------------------------------------------------------" -echo "Add intro : $ADDINTRO" -echo "Add promo : $ADDPROMO" -echo "Add Summary : $ADDSUMMARY" -echo "Add outro : $ADDOUTRO" -echo "album : $HPR_album" -echo "artist : $HPR_artist" -echo "comment : $HPR_comment" -echo "genre : $HPR_genre" -echo "title : $HPR_title" -echo "track : $HPR_track" -echo "year : $HPR_year" -echo "summary : $HPR_summary" -echo "duration : $HPR_duration" -echo "explicit : $HPR_explicit" -echo "license : $HPR_license" - -if [[ $HPR_duration == "0" ]] -then - echoerr "The duration is set to 0. Please update the show with the correct time." - exit; -fi - -#============================================================ -# Preproc`s the source file - -echo "--------------------------------------------------------------------------------" -echo "Prepare mezzanine file" -ffmpeg -i ${mediafile} -ar 44100 -ac $CHANNELS ${fname}_sox.wav > ${fname}_tmp.log 2>&1 - -if [ "$FIXAUDIO" = "1" ];then - echo "normalizing audio" - sox --temp "${TEMP_DIR}" --norm ${fname}_sox.wav ${fname}_sox_norm.wav - mv -v ${fname}_sox_norm.wav ${fname}_sox.wav >> ${fname}_tmp.log 2>&1 -# normalize -a 0.5 ${fname}_sox.wav >> ${fname}_tmp.log 2>&1 -fi - -echo "--------------------------------------------------------------------------------" -echo "Add HPR Branding" - -if [ "$ADDSUMMARY" = 'y' ]; then - echo "Creating the summary" - #echo "$HPR_summary" - | espeak -w hpr${ep_num}_summary.wav - echo "$HPR_summary" - | text2wave - -o hpr${ep_num}_summary.wav #festival --tts - #echo "${HPR_summary}" | gtts-cli - --output hpr${ep_num}_summary.mp3 - #ffmpeg -i hpr${ep_num}_summary.mp3 hpr${ep_num}_summary.wav - #rm -v hpr${ep_num}_summary.mp3 -else - echo "Copying the supplied summary" - if [ ! -e "${media_dir}/summary.wav" ] - then - echoerr "ERROR: Can not find the summary file \"${media_dir}/summary.wav\"" - exit 1 - fi - cp -v "${media_dir}/summary.wav" hpr${ep_num}_summary.wav -fi - -ffmpeg -i hpr${ep_num}_summary.wav -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_hh.pcm 2>> ${fname}_tmp.log -ffmpeg -i hpr${ep_num}_summary.wav -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_ia.pcm 2>> ${fname}_tmp.log -rm hpr${ep_num}_summary.wav - -if [ "$ADDSPONSOR" = 'y' ]; then - echo "Adding the sponsor" - ffmpeg -i "$anhonesthost" -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_hh.pcm 2>> ${fname}_tmp.log - ffmpeg -i "$internetarchive" -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_ia.pcm 2>> ${fname}_tmp.log -else - echo "NOT Adding the sponsor" -fi - -if [ "$ADDPROMO" = 'y' ]; then - echo "Adding the promo" - ffmpeg -i "$promo" -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_hh.pcm 2>> ${fname}_tmp.log - ffmpeg -i "$promo" -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_ia.pcm 2>> ${fname}_tmp.log -fi - -if [ "$ADDINTRO" = 'y' ]; then - echo "Adding the intro" - ffmpeg -i "$intro" -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_hh.pcm 2>> ${fname}_tmp.log - ffmpeg -i "$intro" -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_ia.pcm 2>> ${fname}_tmp.log -fi - -echo "convert the uploaded episode and add it to the temp pcm file" -ffmpeg -i ${fname}_sox.wav -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_hh.pcm 2>> ${fname}_tmp.log -ffmpeg -i ${fname}_sox.wav -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_ia.pcm 2>> ${fname}_tmp.log - -if [ "$ADDOUTRO" = 'y' ]; then - echo "Adding the outro" - ffmpeg -i "$outro" -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_hh.pcm 2>> ${fname}_tmp.log - ffmpeg -i "$outro" -ar 44100 -ac $CHANNELS -acodec pcm_s16le -f s16le - >> ${fname}_tmp_ia.pcm 2>> ${fname}_tmp.log -fi - -echo "Convert the pcm file to a know wav format" -ffmpeg -f s16le -ar 44100 -ac $CHANNELS -acodec pcm_s16le -i ${fname}_tmp_hh.pcm ${fname}_mez.wav 2>> ${fname}_tmp.log -ffmpeg -f s16le -ar 44100 -ac $CHANNELS -acodec pcm_s16le -i ${fname}_tmp_ia.pcm hpr${ep_num}.wav 2>> ${fname}_tmp.log - -echo "Normalizing the wav files" -sox --temp "${TEMP_DIR}" --norm ${fname}_mez.wav ${fname}_mez_norm.wav -mv -v ${fname}_mez_norm.wav ${fname}_mez.wav >> ${fname}_tmp.log 2>&1 -# normalize -a 0.5 ${fname}_mez.wav >> ${fname}_tmp.log 2>&1 -sox --temp "${TEMP_DIR}" --norm hpr${ep_num}.wav hpr${ep_num}_norm.wav -mv -v hpr${ep_num}_norm.wav /var/IA/uploads/hpr${ep_num}.wav >> ${fname}_tmp.log 2>&1 -# normalize -a 0.5 hpr${ep_num}.wav >> ${fname}_tmp.log 2>&1 - -echo "--------------------------------------------------------------------------------" -echo "File information" -ffprobe ${fname}_mez.wav 2>&1 | grep Audio: -mediainfo ${fname}_mez.wav - -echo "--------------------------------------------------------------------------------" -echo "Convert to opus for IA" -opusenc hpr${ep_num}.wav /var/IA/uploads/hpr${ep_num}.opus - -echo "--------------------------------------------------------------------------------" -echo "Convert to flac for IA" -sox --temp "${TEMP_DIR}" -S hpr${ep_num}.wav /var/IA/uploads/hpr${ep_num}.flac - -echo "--------------------------------------------------------------------------------" -echo "Convert to mp3 for HPR" -sox --temp "${TEMP_DIR}" -S ${fname}_mez.wav hpr${ep_num}.mp3 -echo "Convert to mp3 for IA" -sox --temp "${TEMP_DIR}" -S hpr${ep_num}.wav /var/IA/uploads/hpr${ep_num}.mp3 - -echo "--------------------------------------------------------------------------------" -echo "Convert to ogg for HPR" -sox --temp "${TEMP_DIR}" -S ${fname}_mez.wav hpr${ep_num}.ogg -echo "Convert to ogg for IA" -sox --temp "${TEMP_DIR}" -S hpr${ep_num}.wav /var/IA/uploads/hpr${ep_num}.ogg - -echo "--------------------------------------------------------------------------------" -echo "Convert to spx for HPR" -sox --temp "${TEMP_DIR}" -S ${fname}_mez.wav -c 1 -r 16000 -t wav - | speexenc - hpr${ep_num}.spx -echo "Convert to spx for IA" -sox --temp "${TEMP_DIR}" -S hpr${ep_num}.wav -c 1 -r 16000 -t wav - | speexenc - /var/IA/uploads/hpr${ep_num}.spx - - -if [[ ! -s /var/IA/uploads/hpr${ep_num}.wav ]] || [[ ! -s /var/IA/uploads/hpr${ep_num}.mp3 ]] || [[ ! -s /var/IA/uploads/hpr${ep_num}.ogg ]] || [[ ! -s /var/IA/uploads/hpr${ep_num}.spx ]] || [[ ! -s hpr${ep_num}.mp3 ]] || [[ ! -s hpr${ep_num}.ogg ]] || [[ ! -s hpr${ep_num}.spx ]] -then - echoerr "ERROR: Something went wrong encoding the files" - exit 1 -fi - -fix_tags -album="$HPR_album" -artist="$HPR_artist" -comment="${HPR_comment} The license is ${HPR_license}" -genre="$HPR_genre" -title="$HPR_title" -track="$HPR_track" -year="$HPR_year" hpr${ep_num}* 2>> ${fname}_tmp.log 1>&2 -fix_tags -album="$HPR_album" -artist="$HPR_artist" -comment="$HPR_comment" -genre="$HPR_genre" -title="$HPR_title" -track="$HPR_track" -year="$HPR_year" /var/IA/uploads/hpr${ep_num}* 2>> ${fname}_tmp.log 1>&2 -fix_tags hpr${ep_num}* -fix_tags /var/IA/uploads/hpr${ep_num}* - -#echo "Changing the file dates to the time of upload" -touch -r ${mediafile} hpr${ep_num}* -touch -r ${mediafile} /var/IA/uploads/hpr${ep_num}* - - -rsync -ave ssh --partial --progress --ignore-existing hpr${ep_num}.mp3 hpr${ep_num}.ogg hpr${ep_num}.spx hpr:www/eps/ - -firefox http://hackerpublicradio.org/local/hpr${ep_num}.mp3 -firefox http://hackerpublicradio.org/local/hpr${ep_num}.ogg -firefox file:///var/IA/uploads/hpr${ep_num}.mp3 -firefox file:///var/IA/uploads/hpr${ep_num}.ogg - -echo "Source: $( mediainfo --Output=XML --Full "${mediafile}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )" -mediainfo --Output=XML --Full hpr${ep_num}* /var/IA/uploads/hpr${ep_num}* | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' | sort | uniq -c - -read -p "Remove files for \"${fname}\" (y|N) ? " -n 1 -r -echo # (optional) move to a new line -if [[ $REPLY =~ ^[Yy]$ ]] -then - mediafilename=$(basename "${mediafile}") - mediaextension="${mediafilename##*.}" - - ssh hpr -t "mkdir /home/hpr/www/eps/hpr${ep_num}" >/dev/null 2>&1 - rsync -ave ssh --partial --progress --ignore-existing "${mediafile}" hpr:www/eps/hpr${ep_num}/hpr${ep_num}_source.${mediaextension} - ssh hpr -t "ls -al /home/hpr/www/eps/hpr${ep_num}*" - cp -v "${mediafile}" "/var/IA/uploads/hpr${ep_num}_source.${mediaextension}" - - #echo "Remove temp files" - rm -v ${fname}_sox.wav ${fname}_tmp*.pcm ${fname}_tmp.log ${fname}_mez.wav - mv -v ${fname}* hpr${ep_num}* *_${ep_num}_* /var/IA/done/ - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1" -O - | xmlstarlet val --err - - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1" -O - | xmlstarlet val --err - - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1" -O - | xmlstarlet val --err - - - #rsync -ave ssh --partial --progress /var/IA/uploads/ hpr:/home/hpr/upload/processed/ - rsync -ave ssh --partial --progress /var/IA/uploads/ borg:/data/IA/uploads/ - find /var/IA/done/ -empty -delete -else - echo "skipping...." - echo "cp -v \"${mediafile}\" \"/var/IA/uploads/hpr${ep_num}_source.${mediaextension}\"" - echo "rm -v ${fname}_sox.wav ${fname}_tmp*.pcm ${fname}_tmp.log ${fname}_mez.wav" - echo "mv -v ${fname}* hpr${ep_num}* *_${ep_num}_* /var/IA/done/" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "rsync -ave ssh --partial --progress /var/IA/uploads/ borg:/data/IA/uploads/" -fi diff --git a/workflow/hprtranscode-just-transcode.bash b/workflow/hprtranscode-just-transcode.bash deleted file mode 100755 index e14ecbb..0000000 --- a/workflow/hprtranscode-just-transcode.bash +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/bash -# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/ -#============================================================ - -echoerr() -{ -echo "$@" 1>&2; -} - -TEMP_DIR="/var/tmp/" -CHANNELS="1" -FIXAUDIO="1" -ARTIST="EMPTY" -TITLE="EMPTY" -YEAR="EMPTY" -SLOT="EMPTY" -basedir="/var/IA" -upload_dir="${basedir}/uploads" -intro="${basedir}/short.flac" - - -if [ "$#" -ne 2 ]; then - echoerr "Please enter the source file and episode number" - exit -fi - -mediafile=${1} -ep_num=${2} - -ep_num=$(echo $ep_num | sed 's/hpr//g') -re='^[0-9]+$' -if ! [[ $ep_num =~ $re ]] ; then - echoerr "error: episode \"${ep_num}\" is not a number" - exit 1 -fi - -if [ ! -f "${mediafile}" ]; then - echoerr "sorry, media file \"${mediafile}\" does not exist" - exit -fi - -if [ ! -r "${mediafile}" ]; then - echoerr "sorry, media file \"${mediafile}\" is not readable" - exit -fi - -if [ $(ffprobe "${mediafile}" 2>&1 | grep "Audio:" | wc -l ) -eq 0 ]; then - echoerr "sorry, media file \"${mediafile}\" has no audio track" - exit -fi - -# extract file name and extension -media_dir=$(dirname ${mediafile}) -fname=${mediafile%.*} -ext=${mediafile/*./} - -if [[ -e hpr${ep_num}.wav ]] || [[ -e hpr${ep_num}.mp3 ]] || [[ -e hpr${ep_num}.ogg ]] || [[ -e hpr${ep_num}.spx ]] || [[ -e hpr${ep_num}_summary.wav ]] || [[ -e hpr${ep_num}.wav ]] || [[ -e ${fname}_mez.wav ]] || [[ -e ${fname}_sox_norm.wav ]] || [[ -e ${fname}_mezzanine.wav ]] || [[ -e ${fname}_tmp.pcm ]] || [[ -e ${fname}_tmp.log ]] -then - echoerr "Files for this episode already exist." - ls -1 hpr${ep_num}* ${fname}_* 2>/dev/null - exit 1 -fi - -echo "--------------------------------------------------------------------------------" -echo "Geting metadata for hpr${ep_num}" - -while read -r line -do - field=$(echo $line | awk -F ':' '{print $1}') - case $field in - "HPR_summary") - HPR_summary=$(echo $line | grep "HPR_summary: " | cut -c 14- ) - continue - ;; - "HPR_album") - HPR_album=$(echo $line | grep "HPR_album: " | cut -c 12- ) - continue - ;; - "HPR_artist") - HPR_artist=$(echo $line | grep "HPR_artist: " | cut -c 13- ) - continue - ;; - "HPR_comment") - HPR_comment=$(echo $line | grep "HPR_comment: " | cut -c 14- ) - continue - ;; - "HPR_genre") - HPR_genre=$(echo $line | grep "HPR_genre: " | cut -c 12- ) - continue - ;; - "HPR_title") - HPR_title=$(echo $line | grep "HPR_title: " | cut -c 12- ) - continue - ;; - "HPR_track") - HPR_track=$(echo $line | grep "HPR_track: " | cut -c 12- ) - continue - ;; - "HPR_year") - HPR_year=$(echo $line | grep "HPR_year: " | cut -c 11- ) - continue - ;; - "HPR_duration") - HPR_duration=$(echo $line | grep "HPR_duration: " | cut -c 15- ) - continue - ;; - "HPR_explicit") - HPR_explicit=$(echo $line | grep "HPR_explicit: " | cut -c 15- ) - continue - ;; - "HPR_license") - HPR_license=$(echo $line | grep "HPR_license: " | cut -c 14- ) - continue - ;; - esac -done < <( wget --timeout=10 --tries=1 --quiet http://hackerpublicradio.org/say.php?id=${ep_num} -O - ) - -if [[ -z "$HPR_album" || -z "$HPR_artist" || -z "$HPR_comment" || -z "$HPR_genre" || -z "$HPR_title" || -z "$HPR_track" || -z "$HPR_year" || -z "$HPR_summary" || -z "$HPR_duration" || -z "$HPR_explicit" || -z "$HPR_license" ]] -then - echoerr "Could not find information on ${ep_num}. Has the show been posted ?" - exit; -fi -echo "--------------------------------------------------------------------------------" -echo "album : $HPR_album" -echo "artist : $HPR_artist" -echo "comment : $HPR_comment" -echo "genre : $HPR_genre" -echo "title : $HPR_title" -echo "track : $HPR_track" -echo "year : $HPR_year" -echo "summary : $HPR_summary" -echo "duration : $HPR_duration" -echo "explicit : $HPR_explicit" -echo "license : $HPR_license" - -if [[ $HPR_duration == "0" ]] -then - echoerr "The duration is set to 0. Please update the show with the correct time." - exit; -fi - -#============================================================ -# Preproc`s the source file - -echo "--------------------------------------------------------------------------------" -echo "Prepare mezzanine file" -ffmpeg -i ${mediafile} -ar 44100 -ac $CHANNELS hpr${ep_num}.wav > ${fname}_tmp.log 2>&1 - -echo "Normalizing the wav files" -sox --temp "${TEMP_DIR}" --norm hpr${ep_num}.wav hpr${ep_num}_norm.wav -mv -v hpr${ep_num}_norm.wav ${upload_dir}/hpr${ep_num}.wav >> ${fname}_tmp.log 2>&1 - -echo "--------------------------------------------------------------------------------" -echo "File information" -ffprobe ${upload_dir}/hpr${ep_num}.wav 2>&1 | grep Audio: -mediainfo ${upload_dir}/hpr${ep_num}.wav - -echo "--------------------------------------------------------------------------------" -echo "Convert to opus" -opusenc ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.opus 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" -echo "Convert to flac" -sox --temp "${TEMP_DIR}" -S ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.flac 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" -echo "Convert to mp3" -sox --temp "${TEMP_DIR}" -S ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.mp3 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" -echo "Convert to ogg" -sox --temp "${TEMP_DIR}" -S ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.ogg 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" -echo "Convert to spx" -sox --temp "${TEMP_DIR}" -S ${upload_dir}/hpr${ep_num}.wav -c 1 -r 16000 -t wav - | speexenc - ${upload_dir}/hpr${ep_num}.spx 2>> ${fname}_tmp.log 1>&2 - -if [[ ! -s ${upload_dir}/hpr${ep_num}.wav ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.opus ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.flac ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.mp3 ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.ogg ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.spx ]] -then - echoerr "ERROR: Something went wrong encoding the files" - exit 1 -fi - -fix_tags -album="$HPR_album" -artist="$HPR_artist" -comment="${HPR_comment} The license is ${HPR_license}" -genre="$HPR_genre" -title="$HPR_title" -track="$HPR_track" -year="$HPR_year" ${upload_dir}/hpr${ep_num}* 2>> ${fname}_tmp.log 1>&2 - -fix_tags ${upload_dir}/hpr${ep_num}* - -#echo "Changing the file dates to the time of upload" -touch -r ${mediafile} hpr${ep_num}* -touch -r ${mediafile} ${upload_dir}/hpr${ep_num}* - -ls -al hpr${ep_num}* ${upload_dir}/hpr${ep_num}* - -rsync -ave ssh --partial --progress --ignore-existing ${upload_dir}/hpr${ep_num}.mp3 ${upload_dir}/hpr${ep_num}.ogg ${upload_dir}/hpr${ep_num}.spx hpr:www/eps/ - -firefox http://hackerpublicradio.org/local/hpr${ep_num}.mp3 -firefox http://hackerpublicradio.org/local/hpr${ep_num}.ogg -firefox file://${upload_dir}/hpr${ep_num}.mp3 -firefox file://${upload_dir}/hpr${ep_num}.ogg -mpv "http://hackerpublicradio.org/local/hpr${ep_num}.spx" "http://hackerpublicradio.org/local/hpr${ep_num}.ogg" "http://hackerpublicradio.org/local/hpr${ep_num}.mp3" "file://${upload_dir}/hpr${ep_num}.spx" "file://${upload_dir}/hpr${ep_num}.opus" "file://${upload_dir}/hpr${ep_num}.ogg" "file://${upload_dir}/hpr${ep_num}.mp3" "file://${upload_dir}/hpr${ep_num}.flac" - -echo "Source: $( mediainfo --Output=XML --Full "${mediafile}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )" -mediainfo --Output=XML --Full hpr${ep_num}* ${upload_dir}/hpr${ep_num}* | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' | sort | uniq -c - -read -p "Remove files for \"${fname}\" (y|N) ? " -n 1 -r -echo # (optional) move to a new line -if [[ $REPLY =~ ^[Yy]$ ]] -then - mediafilename=$(basename "${mediafile}") - mediaextension="${mediafilename##*.}" - - ssh hpr -t "mkdir /home/hpr/www/eps/hpr${ep_num}" >/dev/null 2>&1 - rsync -ave ssh --partial --progress --ignore-existing "${mediafile}" hpr:www/eps/hpr${ep_num}/hpr${ep_num}_source.${mediaextension} - ssh hpr -t "ls -al /home/hpr/www/eps/hpr${ep_num}*" - cp -v "${mediafile}" "${upload_dir}/hpr${ep_num}_source.${mediaextension}" - - #echo "Remove temp files" - rm -v ${fname}_mezzanine.wav ${fname}_tmp*.pcm ${fname}_tmp.log ${fname}_mez.wav - mv -v ${fname}* hpr${ep_num}* *_${ep_num}_* /var/IA/done/ - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1" -O - | xmlstarlet val --err - - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1" -O - | xmlstarlet val --err - - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1" -O - | xmlstarlet val --err - - wget --timeout=0 -q "http://hackerpublicradio.org/rss-future.php" -O - | xmlstarlet val --err - - - #rsync -ave ssh --partial --progress ${upload_dir}/ hpr:/home/hpr/upload/processed/ - rsync -ave ssh --partial --progress ${upload_dir}/ borg:/data/IA/uploads/ - echo "$( ssh borg -t "ls -al /data/IA/uploads/hpr${ep_num}*" ; ls -al ${upload_dir}/hpr${ep_num}* )" | grep "hpr${ep_num}" | awk '{print $5, $NF}' | sort - find /var/IA/done/ -empty -delete -else - echo "skipping...." - echo "cp -v \"${mediafile}\" \"${upload_dir}/hpr${ep_num}_source.${mediaextension}\"" - echo "rm -v ${fname}_mezzanine.wav ${fname}_tmp*.pcm ${fname}_tmp.log ${fname}_mez.wav" - echo "mv -v ${fname}* hpr${ep_num}* *_${ep_num}_* /var/IA/done/" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "rsync -ave ssh --partial --progress ${upload_dir}/ borg:/data/IA/uploads/" -fi diff --git a/workflow/hprtranscode-simple.bash b/workflow/hprtranscode-simple.bash deleted file mode 100755 index 191f1ae..0000000 --- a/workflow/hprtranscode-simple.bash +++ /dev/null @@ -1,603 +0,0 @@ -#!/usr/bin/env bash -# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/ -#============================================================ -TEMP_DIR="/var/tmp/" -CHANNELS="1" -FIXAUDIO="1" -ARTIST="EMPTY" -TITLE="EMPTY" -YEAR="EMPTY" -SLOT="EMPTY" -basedir="/var/IA" -upload_dir="${basedir}/uploads" -theme="${basedir}/theme.wav" -outro="${basedir}/2022-03-07-outro.wav" -ttsserver="http://localhost:5500" -processing_dir="/home/ken/tmp/hpr/processing" -git_image_dir="/home/ken/sourcecode/hpr/HPR_Public_Code/www/images/hosts" -acceptable_duration_difference="2" # Seconds -thedate=$(/usr/bin/date -u +%Y-%m-%d_%H-%M-%SZ_%A) -echo "Processing the next HPR Show in the queue" - - -if [ $( curl -s -o /dev/null -w "%{http_code}" -X 'GET' "${ttsserver}/api/voices" -H 'accept: */*' ) != "200" ] -then - echo "Please start the tts-server \"podman run -it -p 5500:5500 synesthesiam/opentts:en\"" - exit -fi - -function abs_diff { - echo $(($1 >= $2 ? $1 - $2 : $2 - $1)) -} - -function create_tts_summary { - HPR_summary="$( cat "hpr${ep_num}_summary.txt" )" - echo "INFO: Converting text \"${HPR_summary}\" to speech." - curl -X 'GET' -G --data-urlencode "voice=coqui-tts:en_ljspeech" --data-urlencode "text=${HPR_summary}" --data-urlencode "vocoder=high" --data-urlencode "denoiserStrength=0.03" --data-urlencode "cache=false" ${ttsserver}/api/tts -H 'accept: */*' --output ~hpr${ep_num}_summary.wav -} - -################### -# Locate media directory -# -# -show_type="" -if [[ -f "${1}" && -n "${2}" ]] -then - show_type="local" - mediafile="${1}" - media_dir="$( dirname "${mediafile}" )" - ep_num="${2}" - echo "The duration is \"$( \date -ud "1970-01-01 $( ffprobe -i "${mediafile}" 2>&1| awk -F ': |, ' '/Duration:/ { print $2 }' )" +%s )\"." -else - show_type="remote" - response=$( curl --silent --netrc-file ${HOME}/.netrc "https://hub.hackerpublicradio.org/cms/status.php" | \ - grep 'SHOW_POSTED' | \ - head -1 | \ - sed 's/,/ /g' ) - - if [ -z "${response}" ] - then - echo "INFO: There appear to be no more shows with the status \"SHOW_POSTED\"." - echo "Getting a list of all the reservations." - curl --silent --netrc-file ${HOME}/.netrc "https://hub.hackerpublicradio.org/cms/status.php" - exit 3 - fi - - timestamp_epoc="$( echo ${response} | awk '{print $1}' )" - ep_num="$( echo ${response} | awk '{print $2}' )" - ep_date="$( echo ${response} | awk '{print $3}' )" - key="$( echo ${response} | awk '{print $4}' )" - status="$( echo ${response} | awk '{print $5}' )" - email="$( echo ${response} | awk '{print $6}' )" - - #source_dir="hpr:/home/hpr/upload/${timestamp_epoc}_${ep_num}_${ep_date}_${key}" - dest_dir="${timestamp_epoc}_${ep_num}_${ep_date}_${key}" - media_dir="${processing_dir}/${timestamp_epoc}_${ep_num}_${ep_date}_${key}" -fi - -if [ -z "${show_type}" ] -then - echo "sorry, variable \"show_type\" is not set." - exit -fi - -if [ -z "${media_dir}" ] -then - echo "sorry, variable \"media_dir\" is not set." - exit -fi - -if [ ! -d "${media_dir}" ] -then - echo "sorry, directory \"media_dir: ${media_dir}\" does not exist" - exit 1 -fi - -echo detox -v "${media_dir}/" -detox -vr "${media_dir}/" - -if [[ "$( find "${media_dir}" \( -iname "hpr${ep_num}.wav" -o -iname "hpr${ep_num}.mp3" -o -iname "hpr${ep_num}.ogg" -o -iname "hpr${ep_num}.spx" -o -iname "hpr${ep_num}_summary.txt" -o -iname "hpr${ep_num}_summary.wav" -o -iname "hpr${ep_num}.wav" -o -iname "*_mez.wav" -o -iname "*_sox_norm.wav" -o -iname "*_mezzanine.wav" -o -iname "*_tmp.pcm" -o -iname "hpr${ep_num}_intro.wav" -o -iname "~hpr${ep_num}_summary.wav" -o -iname "~~hpr${ep_num}_summary.wav" -o -iname "*_tmp.log" -o -iname "silence.wav" -o -iname "hpr${ep_num}_norm.wav" \) | wc -l )" -ne 0 ]] -then - echo "Files for this episode already exist." - find "${media_dir}" \( -iname "hpr${ep_num}.wav" -o -iname "hpr${ep_num}.mp3" -o -iname "hpr${ep_num}.ogg" -o -iname "hpr${ep_num}.spx" -o -iname "hpr${ep_num}_summary.txt" -o -iname "hpr${ep_num}_summary.wav" -o -iname "hpr${ep_num}.wav" -o -iname "*_mez.wav" -o -iname "*_sox_norm.wav" -o -iname "*_mezzanine.wav" -o -iname "*_tmp.pcm" -o -iname "hpr${ep_num}_intro.wav" -o -iname "~hpr${ep_num}_summary.wav" -o -iname "~~hpr${ep_num}_summary.wav" -o -iname "*_tmp.log" -o -iname "silence.wav" -o -iname "hpr${ep_num}_norm.wav" \) - read -p "Shall I remove them ? (N|y) ? " -n 1 -r - echo # (optional) move to a new line - if [[ ! $REPLY =~ ^[yY]$ ]] - then - echo "skipping...." - exit - else - echo "Removing old files ...." - find "${media_dir}" \( -iname "hpr${ep_num}.wav" -o -iname "hpr${ep_num}.mp3" -o -iname "hpr${ep_num}.ogg" -o -iname "hpr${ep_num}.spx" -o -iname "hpr${ep_num}_summary.txt" -o -iname "hpr${ep_num}_summary.wav" -o -iname "hpr${ep_num}.wav" -o -iname "*_mez.wav" -o -iname "*_sox_norm.wav" -o -iname "*_mezzanine.wav" -o -iname "*_tmp.pcm" -o -iname "hpr${ep_num}_intro.wav" -o -iname "~hpr${ep_num}_summary.wav" -o -iname "~~hpr${ep_num}_summary.wav" -o -iname "*_tmp.log" -o -iname "silence.wav" -o -iname "hpr${ep_num}_norm.wav" \) -delete -print - fi -fi - - -##################################################### -# Process media - -media=$( find "${media_dir}" -type f -exec file {} \; | grep -Ei 'audio|mpeg|video|MP4' | awk -F ': ' '{print $1}' ) -if [ -z "${media}" ] -then - echo "ERROR: Can't find any media in \"${media_dir}/\"" - find "${media_dir}/" -type f - exit 1 -fi - -mediafile="" - -echo "Found more than one media file. Please select which one to use ?" -if [ "$( echo "${media}" | wc -l )" -ne 1 ] -then - select this_media in $( echo "${media}" ) - do - echo "INFO: You selected \"${this_media}\"." - ls -al "${this_media}" - mediafile="${this_media}" - break - done -else - echo "INFO: Selecting media as \"${media}\"." - mediafile="${media}" -fi - -# extract file name and extension -fname="$( basename "${mediafile%.*}" )" -ext="${mediafile/*./}" - -cd "${media_dir}/" -pwd - -echo "INFO: Processing hpr${ep_num} from ${email}" -echo "INFO: Working directory is \"${media_dir}/\"" -echo "" - - -if [ -z "${mediafile}" ] -then - echo "sorry, variable \"mediafile\" is not set." - exit -fi - -if [ -z "${fname}" ] -then - echo "sorry, variable \"fname\" is not set." - exit -fi - -if [ -z "${ext}" ] -then - echo "sorry, variable \"ext\" is not set." - exit -fi - -if [ ! -f "${mediafile}" ] -then - echo "sorry, media file \"${mediafile}\" does not exist" - exit -fi - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "File information for \"${mediafile}\"" | tee -a ${fname}_tmp.log -ffprobe ${mediafile} 2>&1 | grep Audio: -mediainfo ${mediafile} -audio2image.bash ${mediafile} -xdg-open ${mediafile%.*}.png >/dev/null 2>&1 & -unset REPLY -until [[ $REPLY =~ ^[yYnN]$ ]] -do - read -p "Source Waveform look ok ? (N|y) ? " -n 1 -r - echo "" -done - -if [[ ! $REPLY =~ ^[yY]$ ]] -then - echo "skipping.... $REPLY" - exit -fi - - -re='^[0-9]+$' -if ! [[ $ep_num =~ $re ]] -then - echo "error: episode \"${ep_num}\" is not a number" - exit 1 -fi - -if [ ! -f "${outro}" ] -then - echo "sorry, file \"${outro}\" does not exist" - exit 1 -fi - -if [ ! -f "${theme}" ] -then - echo "sorry, file \"${theme}\" does not exist" - exit 1 -fi - -if [ ! -r "${mediafile}" ] -then - echo "sorry, media file \"${mediafile}\" is not readable" - exit -fi - -if [ $(ffprobe "${mediafile}" 2>&1 | grep "Audio:" | wc -l ) -eq 0 ] -then - echo "sorry, media file \"${mediafile}\" has no audio track" - exit -fi - -xdg-open "https://hackerpublicradio.org/eps/hpr${ep_num}/index.html" >/dev/null 2>&1 & - -mpv -vo=null "${mediafile}" - -unset REPLY -until [[ $REPLY =~ ^[yYnN]$ ]] -do - read -p "Is the audio ok (n|Y) ? " -n 1 -r - echo "" -done - -if [[ ! $REPLY =~ ^[yY]$ ]] -then - echo "skipping.... $REPLY" - exit -fi - -echo "--------------------------------------------------------------------------------" -echo "Geting metadata for hpr${ep_num}" - -while read -r line -do - field=$(echo $line | awk -F ':' '{print $1}') - case $field in - "HPR_summary") - HPR_summary=$(echo $line | grep "HPR_summary: " | cut -c 14- ) - continue - ;; - "HPR_album") - HPR_album=$(echo $line | grep "HPR_album: " | cut -c 12- ) - continue - ;; - "HPR_artist") - HPR_artist=$(echo $line | grep "HPR_artist: " | cut -c 13- ) - continue - ;; - "HPR_comment") - HPR_comment=$(echo $line | grep "HPR_comment: " | cut -c 14- ) - continue - ;; - "HPR_genre") - HPR_genre=$(echo $line | grep "HPR_genre: " | cut -c 12- ) - continue - ;; - "HPR_title") - HPR_title=$(echo $line | grep "HPR_title: " | cut -c 12- ) - continue - ;; - "HPR_track") - HPR_track=$(echo $line | grep "HPR_track: " | cut -c 12- ) - continue - ;; - "HPR_year") - HPR_year=$(echo $line | grep "HPR_year: " | cut -c 11- ) - continue - ;; - "HPR_duration") - HPR_duration=$(echo $line | grep "HPR_duration: " | cut -c 15- ) - continue - ;; - "HPR_explicit") - HPR_explicit=$(echo $line | grep "HPR_explicit: " | cut -c 15- ) - continue - ;; - "HPR_license") - HPR_license=$(echo $line | grep "HPR_license: " | cut -c 14- ) - continue - ;; - esac -done < <( curl --silent --netrc-file ${HOME}/.netrc "https://hub.hackerpublicradio.org/cms/say.php?id=${ep_num}" ) - -if [[ -z "$HPR_album" || -z "$HPR_artist" || -z "$HPR_comment" || -z "$HPR_genre" || -z "$HPR_title" || -z "$HPR_track" || -z "$HPR_year" || -z "$HPR_summary" || -z "$HPR_duration" || -z "$HPR_explicit" || -z "$HPR_license" ]] -then - echo "Could not find information on ${ep_num}. Has the show been posted ?" - exit; -fi -echo "--------------------------------------------------------------------------------" -echo "album : $HPR_album" -echo "artist : $HPR_artist" -echo "comment : $HPR_comment" -echo "genre : $HPR_genre" -echo "title : $HPR_title" -echo "track : $HPR_track" -echo "year : $HPR_year" -echo "summary : $HPR_summary" -echo "duration : $HPR_duration" -echo "explicit : $HPR_explicit" -echo "license : $HPR_license" -echo "media_dir : ${media_dir}" -echo "mediafile : ${mediafile}" -echo "fname : ${fname}" -echo "ext : ${ext}" - -if [[ $HPR_duration == "0" ]] -then - echo "The duration is set to 0. Please update the show with the correct time." - exit; -fi - -#============================================================ -# Preproc`s the source file - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Prepare mezzanine file" | tee -a ${fname}_tmp.log -ffmpeg -y -i ${mediafile} -ar 44100 -ac $CHANNELS ${fname}_mezzanine.wav > ${fname}_tmp.log 2>&1 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Add HPR Branding" | tee -a ${fname}_tmp.log - -echo "Creating the summary" | tee -a ${fname}_tmp.log -#echo "$HPR_summary" - | text2wave -F 44100 - -o hpr${ep_num}_summary.wav #festival --tts -#echo "$HPR_summary" - | espeak -w ~hpr${ep_num}_summary.wav - -echo "$HPR_summary" > "hpr${ep_num}_summary.txt" - -create_tts_summary_ok="not-ok" - -while [ "${create_tts_summary_ok}" != "OK" ] -do - create_tts_summary - - xdg-open "hpr${ep_num}_summary.txt" 2>&1 & - mpv --speed=1.8 ~hpr${ep_num}_summary.wav - - read -p "Is the text to speech correct (y|N) ? " -n 1 -r - echo # (optional) move to a new line - if [[ $REPLY =~ ^[Yy]$ ]] - then - create_tts_summary_ok="OK" - else - echo "WARN: Please correct the text and try again." - inotifywait --event modify "hpr${ep_num}_summary.txt" - fi -done -echo "INFO: TTS complete." - -ffmpeg -y -i ~hpr${ep_num}_summary.wav -ar 44100 ~~hpr${ep_num}_summary.wav >> ${fname}_tmp.log 2>&1 - -sox -V2 -n -r 44100 -c 1 silence.wav trim 0.0 6.0 >> ${fname}_tmp.log 2>&1 - -sox -V2 silence.wav ~~hpr${ep_num}_summary.wav hpr${ep_num}_summary.wav >> ${fname}_tmp.log 2>&1 - -echo "Adding the theme" | tee -a ${fname}_tmp.log -sox -V2 -m "hpr${ep_num}_summary.wav" "${theme}" "hpr${ep_num}_intro.wav" >> ${fname}_tmp.log 2>&1 - -echo "Creating the sandwitch: \"hpr${ep_num}_intro.wav\" \"${fname}_mezzanine.wav\" \"${outro}\" \"hpr${ep_num}.wav\" " | tee -a ${fname}_tmp.log - -sox -V2 "hpr${ep_num}_intro.wav" "${fname}_mezzanine.wav" "${outro}" "hpr${ep_num}.wav" >> ${fname}_tmp.log 2>&1 - -echo "Normalizing the wav files" | tee -a ${fname}_tmp.log -#sox --temp "${TEMP_DIR}" --norm hpr${ep_num}.wav hpr${ep_num}_norm.wav -ffmpeg -y -i hpr${ep_num}.wav -af loudnorm=I=-16:LRA=11:TP=-1.5 hpr${ep_num}_norm.wav >> ${fname}_tmp.log 2>&1 - -mv -v hpr${ep_num}_norm.wav ${upload_dir}/hpr${ep_num}.wav >> ${fname}_tmp.log 2>&1 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "File information" | tee -a ${fname}_tmp.log -ffprobe ${upload_dir}/hpr${ep_num}.wav 2>&1 | grep Audio: -mediainfo ${upload_dir}/hpr${ep_num}.wav -audio2image.bash ${upload_dir}/hpr${ep_num}.wav -xdg-open ${upload_dir}/hpr${ep_num}.png >/dev/null 2>&1 & -read -p "Processed Waveform look ok ? (N|y) ? " -n 1 -r -echo # (optional) move to a new line -if [[ ! $REPLY =~ ^[yY]$ ]] -then - echo "skipping...." - exit -fi -rm -v ${upload_dir}/hpr${ep_num}.png - - -echo "--------------------------------------------------------------------------------" -echo "Geting transcript of hpr${ep_num}" - -whisper --model tiny --language en --output_dir "${media_dir}" "${upload_dir}/hpr${ep_num}.wav" | tee -a ${fname}_tmp.log - -ls -al "${media_dir}/hpr${ep_num}".* -xdg-open "${media_dir}/hpr${ep_num}".txt 2>&1 & -echo mpv --no-audio-display --audio-channels=stereo --speed="3.5" "${media_dir}/hpr${ep_num}".txt -unset REPLY -until [[ $REPLY =~ ^[yYnN]$ ]] -do - read -p "Processed transcript look ok ? (N|y) ? " -n 1 -r - echo "" -done - -if [[ ! $REPLY =~ ^[yY]$ ]] -then - echo "skipping.... $REPLY" - exit -fi - -mkdir "${upload_dir}/hpr${ep_num}" >/dev/null 2>&1 - -cp -v "${media_dir}/hpr${ep_num}".vtt "${upload_dir}/hpr${ep_num}/hpr${ep_num}.vtt" | tee -a ${fname}_tmp.log -cp -v "${media_dir}/hpr${ep_num}".srt "${upload_dir}/hpr${ep_num}/hpr${ep_num}.srt" | tee -a ${fname}_tmp.log -cp -v "${media_dir}/hpr${ep_num}".txt "${upload_dir}/hpr${ep_num}/hpr${ep_num}.txt" | tee -a ${fname}_tmp.log -cp -v "${media_dir}/hpr${ep_num}".tsv "${upload_dir}/hpr${ep_num}/hpr${ep_num}.tsv" | tee -a ${fname}_tmp.log -cp -v "${media_dir}/hpr${ep_num}".json "${upload_dir}/hpr${ep_num}/hpr${ep_num}.json" | tee -a ${fname}_tmp.log - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to opus" | tee -a ${fname}_tmp.log -ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.opus 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to flac" | tee -a ${fname}_tmp.log -ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.flac 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to mp3" | tee -a ${fname}_tmp.log -ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.mp3 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to ogg" | tee -a ${fname}_tmp.log -#ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.ogg 2>> ${fname}_tmp.log 1>&2 -ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav -acodec libopus -f ogg ${upload_dir}/hpr${ep_num}.ogg 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to spx" | tee -a ${fname}_tmp.log -ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.spx 2>> ${fname}_tmp.log 1>&2 - -### End conversion - -intro_duration="$( mediainfo --Output=XML --Full "hpr${ep_num}_intro.wav" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )" -outro_duration="$( mediainfo --Output=XML --Full "${outro}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )" -source_duration="$( mediainfo --Output=XML --Full "${mediafile}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )" -expected_duration=$(( ${intro_duration} + ${HPR_duration} + ${outro_duration} )) - -echo "Intro(${intro_duration}) + Show(${HPR_duration}) + Outro(${outro_duration}) = ${expected_duration}" - -media_error="0" - -for check_file in \ -${upload_dir}/hpr${ep_num}.wav \ -${upload_dir}/hpr${ep_num}.opus \ -${upload_dir}/hpr${ep_num}.flac \ -${upload_dir}/hpr${ep_num}.mp3 \ -${upload_dir}/hpr${ep_num}.spx \ -${upload_dir}/hpr${ep_num}.ogg -do - # ${upload_dir}/hpr${ep_num}.spx - echo "INFO: Processing the file \"${check_file}\"" - if [[ ! -s "${check_file}" ]] - then - echo "ERROR: Something went wrong encoding of the file \"${check_file}\"" - exit - else - mediainfo --Output=XML --Full "${check_file}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' - this_duration=$( mediainfo --Output=XML --Full "${check_file}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' ) - if [[ $(abs_diff "${this_duration}" "${expected_duration}" ) -le "${acceptable_duration_difference}" ]] - then - echo "INFO: The file \"${check_file}\" duration of ${this_duration} () is close enough to ${expected_duration}" - else - echo "ERROR: The file \"${check_file}\" actual duration of ${this_duration} is not close enough to posted duration of ${expected_duration}." - echo " Fix or update the posted duration to ${source_duration}." - media_error="1" - fi - #${expected_duration} - fi -done -echo "Source: ${source_duration}" - -if [[ "${media_error}" -eq "1" ]] -then - echo "ERROR: Media is not encoded correctly" - exit -else - echo "INFO: Media duration is correct" -fi - - -if [[ ! -s ${upload_dir}/hpr${ep_num}.wav ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.opus ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.flac ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.mp3 ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.ogg ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.spx ]] -then - echo "ERROR: Something went wrong encoding the files" - exit 1 -fi - - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Fixing Tags" | tee -a ${fname}_tmp.log - -fix_tags -album="$HPR_album" -artist="$HPR_artist" -comment="${HPR_comment} The license is ${HPR_license}" -genre="$HPR_genre" -title="$HPR_title" -track="$HPR_track" -year="$HPR_year" ${upload_dir}/hpr${ep_num}* 2>> ${fname}_tmp.log 1>&2 - -fix_tags ${upload_dir}/hpr${ep_num}* - -#echo "Changing the file dates to the time of upload" -touch -r ${mediafile} hpr${ep_num}* -touch -r ${mediafile} ${upload_dir}/hpr${ep_num}* - -ls -al hpr${ep_num}* ${upload_dir}/hpr${ep_num}* | tee -a ${fname}_tmp.log - -# # echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -# # echo "Getting info for the asset table" | tee -a ${fname}_tmp.log -# # -# # echo "INSERT INTO assets (episode_id,filename,extension,size,sha1sum,mime_type,file_type) VALUES" -# # -# # for asset_file in \ -# # ${upload_dir}/hpr${ep_num}.wav \ -# # ${upload_dir}/hpr${ep_num}.opus \ -# # ${upload_dir}/hpr${ep_num}.flac \ -# # ${upload_dir}/hpr${ep_num}.mp3 \ -# # ${upload_dir}/hpr${ep_num}.spx \ -# # ${upload_dir}/hpr${ep_num}.ogg -# # do -# # size="$( ls -al "${asset_file}" | awk '{print $5}' )" -# # sha1sum="$( sha1sum "${asset_file}" | awk '{print $1}' )" -# # mime_type=$( file --dereference --brief --mime "${asset_file}" ) -# # file_type=$( file --dereference --brief "${asset_file}" ) -# # echo "(${ep_num},'${filename}','${extension}','${size}','${sha1sum}','${mime_type}','${file_type}')," -# # done - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Transferring files to Servers" | tee -a ${fname}_tmp.log - - -#rsync -ave ssh --partial --progress --ignore-existing ${upload_dir}/hpr${ep_num}.mp3 ${upload_dir}/hpr${ep_num}.ogg ${upload_dir}/hpr${ep_num}.spx hpr:www/eps/ - -#firefox "https://hackerpublicradio.org/local/hpr${ep_num}.mp3" >/dev/null 2>&1 & -#firefox "https://hackerpublicradio.org/local/hpr${ep_num}.ogg" >/dev/null 2>&1 & -firefox "file://${upload_dir}/hpr${ep_num}.mp3" >/dev/null 2>&1 & -firefox "file://${upload_dir}/hpr${ep_num}.ogg" >/dev/null 2>&1 & -#firefox "https://hackerpublicradio.org/eps.php?id=${ep_num}" >/dev/null 2>&1 & - -#mpv "http://hackerpublicradio.org/local/hpr${ep_num}.spx" "http://hackerpublicradio.org/local/hpr${ep_num}.ogg" "http://hackerpublicradio.org/local/hpr${ep_num}.mp3" "file://${upload_dir}/hpr${ep_num}.spx" "file://${upload_dir}/hpr${ep_num}.opus" "file://${upload_dir}/hpr${ep_num}.ogg" "file://${upload_dir}/hpr${ep_num}.mp3" "file://${upload_dir}/hpr${ep_num}.flac" -mpv "file://${upload_dir}/hpr${ep_num}.spx" "file://${upload_dir}/hpr${ep_num}.opus" "file://${upload_dir}/hpr${ep_num}.ogg" "file://${upload_dir}/hpr${ep_num}.mp3" "file://${upload_dir}/hpr${ep_num}.flac" - -read -p "Remove files for \"${fname}\" (y|N) ? " -n 1 -r -echo # (optional) move to a new line -if [[ $REPLY =~ ^[Yy]$ ]] -then - mediafilename=$(basename "${mediafile}") - mediaextension="${mediafilename##*.}" # " -# ssh hpr -t "mkdir /home/hpr/www/eps/hpr${ep_num}" >/dev/null 2>&1 -# rsync -ave ssh --partial --progress --ignore-existing "${mediafile}" hpr:www/eps/hpr${ep_num}/hpr${ep_num}_source.${mediaextension} | tee -a ${fname}_tmp.log -# -# rsync -ave ssh --partial --progress --ignore-existing "${media_dir}/hpr${ep_num}.wav".vtt hpr:www/eps/hpr${ep_num}/hpr${ep_num}.vtt | tee -a ${fname}_tmp.log -# rsync -ave ssh --partial --progress --ignore-existing "${media_dir}/hpr${ep_num}.wav".srt hpr:www/eps/hpr${ep_num}/hpr${ep_num}.srt | tee -a ${fname}_tmp.log -# rsync -ave ssh --partial --progress --ignore-existing "${media_dir}/hpr${ep_num}.wav".txt hpr:www/eps/hpr${ep_num}/hpr${ep_num}.txt | tee -a ${fname}_tmp.log -# -# ssh hpr -t "ls -al /home/hpr/www/eps/hpr${ep_num}*" -# cp -v "${mediafile}" "${upload_dir}/hpr${ep_num}_source.${mediaextension}" - - #echo "Remove temp files" - rm -v ~hpr${ep_num}_summary.wav ~~hpr${ep_num}_summary.wav silence.wav - rm -v ${fname}_mezzanine.wav ${fname}_tmp*.pcm ${fname}_tmp.log ${fname}_mez.wav - #mv -v ${fname}* hpr${ep_num}* *_${ep_num}_* /var/IA/done/ - -# wget --timeout=0 -q "http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1" -O - | xmlstarlet val --err - -# wget --timeout=0 -q "http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1" -O - | xmlstarlet val --err - -# wget --timeout=0 -q "http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1" -O - | xmlstarlet val --err - -# wget --timeout=0 -q "http://hackerpublicradio.org/rss-future.php" -O - | xmlstarlet val --err - - - echo "INFO: rsync -ave ssh --partial --progress ${upload_dir}/hpr${ep_num}* borg:/data/IA/uploads/" - rsync -ave ssh --partial --progress ${upload_dir}/hpr${ep_num}* borg:/data/IA/uploads/ - echo "$( ssh borg -t "ls -al /data/IA/uploads/hpr${ep_num}*" ; ls -al ${upload_dir}/hpr${ep_num}* )" | grep "hpr${ep_num}" | awk '{print $5, $NF}' | sort - - if [ ${show_type} == "remote" ] - then - echo "INFO: Setting the status" - # SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET - curl --netrc-file ${HOME}/.netrc "https://hub.hackerpublicradio.org/cms/status.php?ep_num=${ep_num}&status=MEDIA_TRANSCODED" - curl --silent --netrc-file ${HOME}/.netrc "https://hub.hackerpublicradio.org/cms/status.php" - fi -else - echo "skipping...." - echo "cp -v \"${mediafile}\" \"${upload_dir}/hpr${ep_num}_source.${mediaextension}\"" - echo "rm -v ${fname}_mezzanine.wav ${fname}_tmp*.pcm ${fname}_tmp.log ${fname}_mez.wav" - #echo "mv -v ${fname}* hpr${ep_num}* *_${ep_num}_* /var/IA/done/" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "rsync -ave ssh --partial --progress ${upload_dir}/ borg:/data/IA/uploads/" -fi diff --git a/workflow/hprtranscode-simple.bash.2022-07-31 b/workflow/hprtranscode-simple.bash.2022-07-31 deleted file mode 100644 index eada88e..0000000 --- a/workflow/hprtranscode-simple.bash.2022-07-31 +++ /dev/null @@ -1,397 +0,0 @@ -#!/usr/bin/env bash -# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/ -#============================================================ -TEMP_DIR="/var/tmp/" -CHANNELS="1" -FIXAUDIO="1" -ARTIST="EMPTY" -TITLE="EMPTY" -YEAR="EMPTY" -SLOT="EMPTY" -basedir="/var/IA" -upload_dir="${basedir}/uploads" -theme="${basedir}/theme.wav" -outro="${basedir}/2022-03-07-outro.wav" -ttsserver="http://localhost:5500" -processing_dir="/home/ken/tmp/hpr/processing" -git_image_dir="/home/ken/sourcecode/hpr/HPR_Public_Code/www/images/hosts" -thedate=$(/usr/bin/date -u +%Y-%m-%d_%H-%M-%SZ_%A) -echo "Processing the next HPR Show in the queue" - - -if [ $( curl -s -o /dev/null -w "%{http_code}" -X 'GET' "${ttsserver}/api/voices" -H 'accept: */*' ) != "200" ] -then - echo "Please start the tts-server \"podman run -it -p 5500:5500 synesthesiam/opentts:en\"" - exit -fi - -################### -# Get the show -# -# -if [[ -f "${1}" && -n "${2}" ]] -then - mediafile="${1}" - ep_num="${2}" - echo "The duration is \"$( \date -ud "1970-01-01 $( ffprobe -i "${mediafile}" 2>&1| awk -F ': |, ' '/Duration:/ { print $2 }' )" +%s )\"." -else - response=$( curl --silent --netrc-file ${HOME}/.netrc "https://hackerpublicradio.org/cms/status.php" | \ - grep 'SHOW_POSTED' | \ - head -1 | \ - sed 's/,/ /g' ) - - if [ -z "${response}" ] - then - echo "INFO: There appear to be no more shows with the status \"SHOW_POSTED\"." - echo "Getting a list of all the reservations." - curl --silent --netrc-file ${HOME}/.netrc "https://hackerpublicradio.org/cms/status.php" - exit 3 - fi - - timestamp_epoc="$( echo ${response} | awk '{print $1}' )" - ep_num="$( echo ${response} | awk '{print $2}' )" - ep_date="$( echo ${response} | awk '{print $3}' )" - key="$( echo ${response} | awk '{print $4}' )" - status="$( echo ${response} | awk '{print $5}' )" - email="$( echo ${response} | awk '{print $6}' )" - - #source_dir="hpr:/home/hpr/upload/${timestamp_epoc}_${ep_num}_${ep_date}_${key}" - dest_dir="${timestamp_epoc}_${ep_num}_${ep_date}_${key}" - echo detox -v "${processing_dir}/${dest_dir}/" - detox -vr "${processing_dir}/${dest_dir}/" - cd "${processing_dir}/${dest_dir}/" - pwd - - echo "INFO: Processing hpr${ep_num} from ${email}" - echo "INFO: Working directory is \"${processing_dir}/${dest_dir}/\"" - echo "" - - media=$( find "${processing_dir}/${timestamp_epoc}_${ep_num}_${ep_date}_${key}" -type f -exec file {} \; | grep -Ei 'audio|mpeg|video|MP4' | awk -F ': ' '{print $1}' ) - if [ -z "${media}" ] - then - echo "ERROR: Can't find any media in \"${processing_dir}/${dest_dir}/\"" - find "${processing_dir}/${dest_dir}/" -type f - exit 1 - fi - - mediafile="" - - if [ "$( echo "${media}" | wc -l )" -ne 1 ] - then - select this_media in $( echo "${media}" ) - do - echo "INFO: You selected \"${this_media}\"." - ls -al "${this_media}" - mediafile="${this_media}" - break - done - else - echo "INFO: Selecting media as \"${media}\"." - mediafile="${media}" - fi - echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log - echo "File information for \"${mediafile}\"" | tee -a ${fname}_tmp.log - ffprobe ${mediafile} 2>&1 | grep Audio: - mediainfo ${mediafile} - audio2image.bash ${mediafile} - xdg-open ${mediafile%.*}.png >/dev/null 2>&1 & - read -p "Source Waveform look ok ? (N|y) ? " -n 1 -r - echo # (optional) move to a new line - if [[ ! $REPLY =~ ^[yY]$ ]] - then - echo "skipping...." - exit - fi - -fi - -re='^[0-9]+$' -if ! [[ $ep_num =~ $re ]] -then - echo "error: episode \"${ep_num}\" is not a number" - exit 1 -fi - -if [ ! -f "${outro}" ] -then - echo "sorry, file \"${outro}\" does not exist" - exit 1 -fi - -if [ ! -f "${theme}" ] -then - echo "sorry, file \"${theme}\" does not exist" - exit 1 -fi - -if [ ! -f "${mediafile}" ] -then - echo "sorry, media file \"${mediafile}\" does not exist" - exit -fi - -if [ ! -r "${mediafile}" ] -then - echo "sorry, media file \"${mediafile}\" is not readable" - exit -fi - -if [ $(ffprobe "${mediafile}" 2>&1 | grep "Audio:" | wc -l ) -eq 0 ] -then - echo "sorry, media file \"${mediafile}\" has no audio track" - exit -fi - -mpv -vo=null "${mediafile}" -read -p "Is there any problems with the audio (N|y) ? " -n 1 -r -echo # (optional) move to a new line -if [[ $REPLY =~ ^[yY]$ ]] -then - echo "skipping...." - exit 1 -fi - -# extract file name and extension -media_dir=$(dirname ${mediafile}) -fname=${mediafile%.*} -ext=${mediafile/*./} - -if [[ -e hpr${ep_num}.wav ]] || [[ -e hpr${ep_num}.mp3 ]] || [[ -e hpr${ep_num}.ogg ]] || [[ -e hpr${ep_num}.spx ]] || [[ -e hpr${ep_num}_summary.wav ]] || [[ -e hpr${ep_num}.wav ]] || [[ -e ${fname}_mez.wav ]] || [[ -e ${fname}_sox_norm.wav ]] || [[ -e ${fname}_mezzanine.wav ]] || [[ -e ${fname}_tmp.pcm ]] || [[ -e ${fname}_tmp.log ]] || [[ -e hpr${ep_num}_intro.wav ]] || [[ -e ~hpr${ep_num}_summary.wav ]] || [[ -e ~~hpr${ep_num}_summary.wav ]] -then - echo "Files for this episode already exist." - ls -1 *hpr${ep_num}* ${fname}_* 2>/dev/null - exit 1 -fi - -echo "--------------------------------------------------------------------------------" -echo "Geting metadata for hpr${ep_num}" - -while read -r line -do - field=$(echo $line | awk -F ':' '{print $1}') - case $field in - "HPR_summary") - HPR_summary=$(echo $line | grep "HPR_summary: " | cut -c 14- ) - continue - ;; - "HPR_album") - HPR_album=$(echo $line | grep "HPR_album: " | cut -c 12- ) - continue - ;; - "HPR_artist") - HPR_artist=$(echo $line | grep "HPR_artist: " | cut -c 13- ) - continue - ;; - "HPR_comment") - HPR_comment=$(echo $line | grep "HPR_comment: " | cut -c 14- ) - continue - ;; - "HPR_genre") - HPR_genre=$(echo $line | grep "HPR_genre: " | cut -c 12- ) - continue - ;; - "HPR_title") - HPR_title=$(echo $line | grep "HPR_title: " | cut -c 12- ) - continue - ;; - "HPR_track") - HPR_track=$(echo $line | grep "HPR_track: " | cut -c 12- ) - continue - ;; - "HPR_year") - HPR_year=$(echo $line | grep "HPR_year: " | cut -c 11- ) - continue - ;; - "HPR_duration") - HPR_duration=$(echo $line | grep "HPR_duration: " | cut -c 15- ) - continue - ;; - "HPR_explicit") - HPR_explicit=$(echo $line | grep "HPR_explicit: " | cut -c 15- ) - continue - ;; - "HPR_license") - HPR_license=$(echo $line | grep "HPR_license: " | cut -c 14- ) - continue - ;; - esac -done < <( wget --timeout=10 --tries=1 --quiet http://hackerpublicradio.org/say.php?id=${ep_num} -O - ) - -if [[ -z "$HPR_album" || -z "$HPR_artist" || -z "$HPR_comment" || -z "$HPR_genre" || -z "$HPR_title" || -z "$HPR_track" || -z "$HPR_year" || -z "$HPR_summary" || -z "$HPR_duration" || -z "$HPR_explicit" || -z "$HPR_license" ]] -then - echo "Could not find information on ${ep_num}. Has the show been posted ?" - exit; -fi -echo "--------------------------------------------------------------------------------" -echo "album : $HPR_album" -echo "artist : $HPR_artist" -echo "comment : $HPR_comment" -echo "genre : $HPR_genre" -echo "title : $HPR_title" -echo "track : $HPR_track" -echo "year : $HPR_year" -echo "summary : $HPR_summary" -echo "duration : $HPR_duration" -echo "explicit : $HPR_explicit" -echo "license : $HPR_license" - -if [[ $HPR_duration == "0" ]] -then - echo "The duration is set to 0. Please update the show with the correct time." - exit; -fi - -#============================================================ -# Preproc`s the source file - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Prepare mezzanine file" | tee -a ${fname}_tmp.log -ffmpeg -i ${mediafile} -ar 44100 -ac $CHANNELS ${fname}_mezzanine.wav > ${fname}_tmp.log 2>&1 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Add HPR Branding" | tee -a ${fname}_tmp.log - -echo "Creating the summary" | tee -a ${fname}_tmp.log -#echo "$HPR_summary" - | text2wave -F 44100 - -o hpr${ep_num}_summary.wav #festival --tts -#echo "$HPR_summary" - | espeak -w ~hpr${ep_num}_summary.wav -echo "$HPR_summary" - | curl -X 'GET' -G --data-urlencode "voice=coqui-tts:en_ljspeech" --data-urlencode "text=${HPR_summary}" --data-urlencode "vocoder=high" --data-urlencode "denoiserStrength=0.03" --data-urlencode "cache=false" ${ttsserver}/api/tts -H 'accept: */*' --output ~hpr${ep_num}_summary.wav - -ffmpeg -i ~hpr${ep_num}_summary.wav -ar 44100 ~~hpr${ep_num}_summary.wav >> ${fname}_tmp.log 2>&1 - -sox -n -r 44100 -c 1 silence.wav trim 0.0 6.0 >> ${fname}_tmp.log 2>&1 - -sox silence.wav ~~hpr${ep_num}_summary.wav hpr${ep_num}_summary.wav >> ${fname}_tmp.log 2>&1 - -echo "Adding the theme" | tee -a ${fname}_tmp.log -sox -m "hpr${ep_num}_summary.wav" "${theme}" "hpr${ep_num}_intro.wav" >> ${fname}_tmp.log 2>&1 - -echo "Creating the sandwitch" | tee -a ${fname}_tmp.log - -sox "hpr${ep_num}_intro.wav" "${fname}_mezzanine.wav" "${outro}" "hpr${ep_num}.wav" >> ${fname}_tmp.log 2>&1 - -echo "Normalizing the wav files" | tee -a ${fname}_tmp.log -#sox --temp "${TEMP_DIR}" --norm hpr${ep_num}.wav hpr${ep_num}_norm.wav -ffmpeg -i hpr${ep_num}.wav -af loudnorm=I=-16:LRA=11:TP=-1.5 hpr${ep_num}_norm.wav >> ${fname}_tmp.log 2>&1 - -mv -v hpr${ep_num}_norm.wav ${upload_dir}/hpr${ep_num}.wav >> ${fname}_tmp.log 2>&1 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "File information" | tee -a ${fname}_tmp.log -ffprobe ${upload_dir}/hpr${ep_num}.wav 2>&1 | grep Audio: -mediainfo ${upload_dir}/hpr${ep_num}.wav -audio2image.bash ${upload_dir}/hpr${ep_num}.wav -xdg-open ${upload_dir}/hpr${ep_num}.png >/dev/null 2>&1 & -read -p "Processed Waveform look ok ? (N|y) ? " -n 1 -r -echo # (optional) move to a new line -if [[ ! $REPLY =~ ^[yY]$ ]] -then - echo "skipping...." - exit -fi -rm -v ${upload_dir}/hpr${ep_num}.png - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to opus" | tee -a ${fname}_tmp.log -ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.opus 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to flac" | tee -a ${fname}_tmp.log -sox --temp "${TEMP_DIR}" -S ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.flac 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to mp3" | tee -a ${fname}_tmp.log -sox --temp "${TEMP_DIR}" -S ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.mp3 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to ogg" | tee -a ${fname}_tmp.log -ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.ogg 2>> ${fname}_tmp.log 1>&2 - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Convert to spx" | tee -a ${fname}_tmp.log -ffmpeg -y -i ${upload_dir}/hpr${ep_num}.wav ${upload_dir}/hpr${ep_num}.spx 2>> ${fname}_tmp.log 1>&2 - -for check_file in \ -${upload_dir}/hpr${ep_num}.wav \ -${upload_dir}/hpr${ep_num}.opus \ -${upload_dir}/hpr${ep_num}.flac \ -${upload_dir}/hpr${ep_num}.mp3 \ -${upload_dir}/hpr${ep_num}.ogg \ -${upload_dir}/hpr${ep_num}.spx -do - if [[ ! -s "${check_file}" ]] - then - echo "ERROR: Something went wrong encoding of the file \"${check_file}\"" - fi -done - -if [[ ! -s ${upload_dir}/hpr${ep_num}.wav ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.opus ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.flac ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.mp3 ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.ogg ]] || [[ ! -s ${upload_dir}/hpr${ep_num}.spx ]] -then - echo "ERROR: Something went wrong encoding the files" - exit 1 -fi - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Fixing Tags" | tee -a ${fname}_tmp.log - -fix_tags -album="$HPR_album" -artist="$HPR_artist" -comment="${HPR_comment} The license is ${HPR_license}" -genre="$HPR_genre" -title="$HPR_title" -track="$HPR_track" -year="$HPR_year" ${upload_dir}/hpr${ep_num}* 2>> ${fname}_tmp.log 1>&2 - -fix_tags ${upload_dir}/hpr${ep_num}* - -#echo "Changing the file dates to the time of upload" -touch -r ${mediafile} hpr${ep_num}* -touch -r ${mediafile} ${upload_dir}/hpr${ep_num}* - -ls -al hpr${ep_num}* ${upload_dir}/hpr${ep_num}* | tee -a ${fname}_tmp.log - - -echo "--------------------------------------------------------------------------------" | tee -a ${fname}_tmp.log -echo "Transferring files to Servers" | tee -a ${fname}_tmp.log - - -rsync -ave ssh --partial --progress --ignore-existing ${upload_dir}/hpr${ep_num}.mp3 ${upload_dir}/hpr${ep_num}.ogg ${upload_dir}/hpr${ep_num}.spx hpr:www/eps/ - -firefox "https://hackerpublicradio.org/local/hpr${ep_num}.mp3" >/dev/null 2>&1 & -firefox "https://hackerpublicradio.org/local/hpr${ep_num}.ogg" >/dev/null 2>&1 & -firefox "file://${upload_dir}/hpr${ep_num}.mp3" >/dev/null 2>&1 & -firefox "file://${upload_dir}/hpr${ep_num}.ogg" >/dev/null 2>&1 & -firefox "https://hackerpublicradio.org/eps.php?id=${ep_num}" >/dev/null 2>&1 & - -mpv "http://hackerpublicradio.org/local/hpr${ep_num}.spx" "http://hackerpublicradio.org/local/hpr${ep_num}.ogg" "http://hackerpublicradio.org/local/hpr${ep_num}.mp3" "file://${upload_dir}/hpr${ep_num}.spx" "file://${upload_dir}/hpr${ep_num}.opus" "file://${upload_dir}/hpr${ep_num}.ogg" "file://${upload_dir}/hpr${ep_num}.mp3" "file://${upload_dir}/hpr${ep_num}.flac" - -echo "Source: $( mediainfo --Output=XML --Full "${mediafile}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )" -mediainfo --Output=XML --Full hpr${ep_num}* ${upload_dir}/hpr${ep_num}* | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' | sort | uniq -c - -read -p "Remove files for \"${fname}\" (y|N) ? " -n 1 -r -echo # (optional) move to a new line -if [[ $REPLY =~ ^[Yy]$ ]] -then - mediafilename=$(basename "${mediafile}") - mediaextension="${mediafilename##*.}" # " - ssh hpr -t "mkdir /home/hpr/www/eps/hpr${ep_num}" >/dev/null 2>&1 - rsync -ave ssh --partial --progress --ignore-existing "${mediafile}" hpr:www/eps/hpr${ep_num}/hpr${ep_num}_source.${mediaextension} - ssh hpr -t "ls -al /home/hpr/www/eps/hpr${ep_num}*" - cp -v "${mediafile}" "${upload_dir}/hpr${ep_num}_source.${mediaextension}" - - #echo "Remove temp files" - rm -v ~hpr${ep_num}_summary.wav ~~hpr${ep_num}_summary.wav silence.wav - rm -v ${fname}_mezzanine.wav ${fname}_tmp*.pcm ${fname}_tmp.log ${fname}_mez.wav - #mv -v ${fname}* hpr${ep_num}* *_${ep_num}_* /var/IA/done/ - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1" -O - | xmlstarlet val --err - - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1" -O - | xmlstarlet val --err - - wget --timeout=0 -q "http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1" -O - | xmlstarlet val --err - - wget --timeout=0 -q "http://hackerpublicradio.org/rss-future.php" -O - | xmlstarlet val --err - - - rsync -ave ssh --partial --progress ${upload_dir}/hpr${ep_num}* borg:/data/IA/uploads/ - echo "$( ssh borg -t "ls -al /data/IA/uploads/hpr${ep_num}*" ; ls -al ${upload_dir}/hpr${ep_num}* )" | grep "hpr${ep_num}" | awk '{print $5, $NF}' | sort - # SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET - curl --netrc-file ${HOME}/.netrc "https://hackerpublicradio.org/cms/status.php?ep_num=${ep_num}&status=MEDIA_TRANSCODED" -else - echo "skipping...." - echo "cp -v \"${mediafile}\" \"${upload_dir}/hpr${ep_num}_source.${mediaextension}\"" - echo "rm -v ${fname}_mezzanine.wav ${fname}_tmp*.pcm ${fname}_tmp.log ${fname}_mez.wav" - #echo "mv -v ${fname}* hpr${ep_num}* *_${ep_num}_* /var/IA/done/" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_ogg_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_mp3_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "wget --timeout=0 -q \"http://hackerpublicradio.org/hpr_spx_rss.php?gomax=1\" -O - | xmlstarlet val --err -" - echo "rsync -ave ssh --partial --progress ${upload_dir}/ borg:/data/IA/uploads/" -fi diff --git a/workflow/show2youtube.bash b/workflow/show2youtube.bash deleted file mode 100755 index f72c08d..0000000 --- a/workflow/show2youtube.bash +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# http://eddmann.com/posts/uploading-podcast-audio-to-youtube/ -# http://cutycapt.sourceforge.net/ xvfb-run -# https://el-tramo.be/blog/ken-burns-ffmpeg/ - -#hpr${ep_num}.wav - -ep_num=2463 - -xvfb-run --server-args="-screen 0, 1024x768x24" CutyCapt --url="http://hackerpublicradio.org/eps.php?id=${ep_num}" --out=${ep_num}.png --insecure - -ffmpeg -i input.wav -filter_complex "[0:a]showwaves=s=800x600:mode=line:rate=25,format=yuv420p[v]" -map "[v]" -map 0:a output-showwaves.mp4 - - -# ffmpeg -start_number n -i test_%d.jpg -vcodec mpeg4 test.avi -# ffmpeg -loop 1 -r 2 -i image.jpg -i input.mp3 -vf scale=-1:380 -c:v libx264 -preset slow -tune stillimage -crf 18 -c:a copy -shortest -pix_fmt yuv420p -threads 0 output.mkv - -# https://video.stackexchange.com/questions/9644/how-do-i-turn-audio-into-video-that-is-show-the-waveforms-in-a-video - -#this -# -# rm out.mp4 output.mp4 ; ffmpeg -i 2463.png -filter_complex "pad=w=9600:h=6000:x='(ow-iw)/2':y='(oh-ih)/2',zoompan=x='(iw-0.625*ih)/2':y='(1-on/(25*4))*(ih-ih/zoom)':z='if(eq(on,1),2.56,zoom+0.002)':d=25*4:s=1280x800" -pix_fmt yuv420p -c:v libx264 out.mp4 -# -# rm out.mp4 output.mp4; ffmpeg -i 2463.png -filter_complex "pad=w=9600:h=6000:x='(ow-iw)/2':y='(oh-ih)/2',zoompan=z='zoom+0':d=25*4:s=1280x2048,crop=w=1280:h=800:x='(iw-ow)/2':y='(ih-oh)/2' " -pix_fmt yuv420p -c:v libx264 out.mp4 -# -# ffmpeg -i in.jpg -# -filter_complex -# "zoompan=z='zoom+0.002':d=25*4:s=1280x800" -# -pix_fmt yuv420p -c:v libx264 out.mp4 -# -# -# -# ffmpeg -i input.flac -filter_complex "[0:a]ahistogram,format=yuv420p[v]" -map "[v]" -map 0:a output.mp4 -# -# -# ffmpeg -i input -i background.png -filter_complex "[0:a]showwavespic=s=640x240[fg];[1:v][top]overlay=format=auto" -frames:v 1 output.png - - -ffmpeg -loop 1 -i background.png -i video1.mp4 -i video2.mp4 -filter_complex \ -"[1:v]scale=(iw/2)-20:-1[a]; \ - [2:v]scale=(iw/2)-20:-1[b]; \ - [0:v][a]overlay=10:(main_h/2)-(overlay_h/2):shortest=1[c]; \ - [c][b]overlay=main_w-overlay_w-10:(main_h/2)-(overlay_h/2)[video]" \ --map "[video]" output.mkv - - -https://stackoverflow.com/questions/13390714/superimposing-two-videos-onto-a-static-image -https://video.stackexchange.com/questions/14519/add-image-under-the-video-with-ffmepg - - -ffmpeg \ - -loop 1 -i hprback.png \ - -i output-showwaves-320x240.mp4 \ - -filter_complex "overlay=0:0:shortest=1" \ - out.m4v - - -# ffmpeg -i input.wav -filter_complex "[0:a]showfreqs=s=320x266:mode=line:fscale=log,format=yuv420p[v]" -map "[v]" -map 0:a output-showfreqs-319x266.mp4 -# ffmpeg -loop 1 -i hprback.png -i output-showfreqs-319x266.mp4 -filter_complex "overlay=663:143:shortest=1" out1.m4v - diff --git a/workflow/status_lighttower.py b/workflow/status_lighttower.py deleted file mode 100644 index 9ac21e3..0000000 --- a/workflow/status_lighttower.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2017 Ken Fallon ken@fallon.ie -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -# UTF-8 Test >> ÇirçösÚáóíéőöÓÁśł << -# 213.46.252.136 gateway - -import sys, getopt, json, os, logging, sys, requests, datetime, re, dateutil.parser, base64, xmltodict, random, psycopg2, time, automationhat - -from pprint import pprint -#import traceback -logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') -#logging.disable(logging.DEBUG) -settings = dict() - -def usage(exitcode, message = None): - ''' - prints usage and exits - ''' - if message is not None: - logging.error( message ) - print( os.path.basename(sys.argv[0]) + ' [--help -l -c ]') - sys.exit(exitcode) - -def get_lab_settings(settings): - ''' - Get configuration for the lab, usually from http://172.30.218.244/autotest/settings.json - ''' - if os.path.isfile( settings[ 'config_url' ] ): - with open( settings[ 'config_url' ] ) as json_file: - info_dict = json.load(json_file) - return info_dict - else: - session = requests.session() - resp = session.get(url=settings[ 'config_url' ], headers={'Accept-Encoding': 'gzip'}) - if resp.status_code == 200: - info_dict = json.loads(resp.text) - return info_dict - return None - -def argumentTest(): - ''' - Gets the required paramaters that the program needs in order to run. These can either be provided on the command line, or as environemental variables, or both. - - export LAB="lab4b" - export config_url="http://172.30.218.244/autotest/settings.json" - export service="purcha#!/usr/bin/env python - -import automationhat -import time -import os -import sys - -counter = -1 -lightPattern = [ - [1,0,0], - [0,1,0], - [0,0,1], - [0,1,1], - [0,1,0], - [1,1,0], - [1,0,0], - [1,1,0], - [0,1,0], - [0,1,1], - [0,0,1], - [0,0,0], - [1,0,1], - [0,1,0], - [0,0,0], -] - -def increment(): - global counter - counter+=1 - if counter==len(lightPattern): - counter = 0 - -def doCurrentCycle(): - currentCycle = lightPattern[counter] - print currentCycle - if (currentCycle[0]==1) : - automationhat.output.one.on() - else: - automationhat.output.one.off() - - if (currentCycle[1] == 1): - automationhat.output.two.on() - else: - automationhat.output.two.off() - - if (currentCycle[2] == 1): - automationhat.output.three.on() - else: - automationhat.output.three.off() - - time.sleep(2) - - - -while True: - increment() - doCurrentCycle()se-service" - export customers="customers.json" - - ''' - lab = str() - config_url = str() - service = str() - settings = dict() - - for evariable in [ 'LAB', 'config_url' ]: - if os.getenv( evariable ) is not None: - settings[ evariable ] = os.environ[ evariable ] - logging.debug( "Setting \"" + evariable + "\" set to \"" + settings[ evariable ] + "\" from an enviroment variable.") - - try: - options, remainder = getopt.getopt(sys.argv[1:], 'hl:c:', [ 'help', 'lab=', 'config=' ]) - - except getopt.GetoptError: - usage(1, "Unrecognized option was found or missing argument." ) - - for opt, arg in options: - if opt in ('-h', '--help'): - usage(2) - elif opt in ('-l', '--lab'): - logging.debug( "Setting \"LAB\" set to \"" + arg + "\" from the \"" + opt + "\" command line argument.") - settings[ 'LAB' ] = arg - elif opt in ('-c', '--config'): - logging.debug( "Setting \"config_url\" set to \"" + arg + "\" from the \"" + opt + "\" command line argument.") - settings[ 'config_url' ] = arg - - for param in [ 'LAB', 'config_url' ]: - if not param in settings: - usage( 3, "Cant find value for \"" + param +"\"") - - try: - settings[ 'config' ] = get_lab_settings( settings )[ settings[ 'LAB' ] ] - if 'jenkins' in settings.keys(): - logging.debug('Updating TraxIS Customer file to include the Purchase Service status.') - - except Exception as e: - print('Error: Could not get Lab Configuration for "%s".' % settings[ 'LAB' ] ) - traceback.print_exc() - exit(1) - - return settings - - -#def get_server_instance(): - #jenkins_url = 'http://172.22.137.160:8080' - #server = Jenkins(jenkins_url, username='autotest', password='autotest') - #return server - -def get_server_instance(settings): - jenkins_url = 'http://%s:%s' % ( settings[ 'config' ][ 'jenkins' ][ 'host' ] , settings[ 'config' ][ 'jenkins' ][ 'port' ] ) - server = Jenkins(jenkins_url, username = settings[ 'config' ][ 'jenkins' ][ 'user' ], password = settings[ 'config' ][ 'jenkins' ][ 'password' ]) - return server - -def alloff(): - automationhat.relay.one.off() - automationhat.output.one.off() - automationhat.output.two.off() - automationhat.output.three.off() - -# Set according to status -def setstatus(status): - if status != "": - alloff() - if status == "SUCCESS": - automationhat.output.three.on() - print( "SUCCESS" ) - - if status == "UNSTABLE": - automationhat.output.two.on() - print( "UNSTABLE" ) - - if status == "FAILURE": - automationhat.output.one.on() - print( "FAILURE" ) - return - -def get_job_details( settings ): - # Refer Example #1 for definition of function 'get_server_instance' - server = get_server_instance( settings ) - settings[ 'teststatus' ] = str() - for job in settings[ 'config' ][ 'jenkins' ][ 'jobs' ]: - logging.debug( "Checking job %s" % job ) - job_instance = server.get_job( job ) - this_status = job_instance.get_last_build().get_status() - if not ( settings[ 'teststatus' ] == "FAILURE" or (settings[ 'teststatus' ] == "UNSTABLE" and this_status == "SUCCESS") ): - settings[ 'teststatus' ] = this_status - return settings - -if __name__ == "__main__": - logging.debug( "start" ) - try: - while True: - alloff() - automationhat.relay.one.on() - settings = argumentTest() - #pprint( settings[ 'config' ][ 'jenkins' ] ) - #print( "Hello" ) - #pprint ( get_server_instance( settings ).version ) - settings = get_job_details( settings ) - status = settings[ 'teststatus' ] - setstatus(status) - #print( get_server_instance().version ) - time.sleep(300) - - except Exception as e: - print("Error: " + str(e)) - traceback.print_exc() - exit(1) - logging.debug('done') - -''' -export LAB="lab4b" -export config_url="http://172.30.218.244/autotest/settings.json" -''' diff --git a/workflow/this_duration.bash b/workflow/this_duration.bash deleted file mode 100755 index 5245ac2..0000000 --- a/workflow/this_duration.bash +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/ -find ${pwd} -type f | while read mediafile -do - duration=$( mediainfo --full --Output=XML "${mediafile}" | xmlstarlet sel -T -t -m "_:MediaInfo/_:media/_:track[@type='Audio']/_:Duration[1]" -v "." -n - | awk -F '.' '{print $1}' ) - if [ "${duration}" != "" ] - then - echo "${duration} ${mediafile}" - continue - fi - duration=$( /bin/date -ud "1970-01-01 $( ffprobe -i "${mediafile}" 2>&1| awk -F ': |, ' '/Duration:/ { print $2 }' )" +%s ) - if [ "${duration}" != 0 ] - then - echo "${duration} ${mediafile}" - continue - fi -done -find -type f -exec file {} \; | grep -vEi 'audio|mpeg|video' diff --git a/workflow/unpack.bash b/workflow/unpack.bash deleted file mode 100644 index 6cfeaa3..0000000 --- a/workflow/unpack.bash +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/ -intro_clip_end="00:01:30" -quality_clip_duration="90" -outro_clip="90" -#DEBUG="echo " -cd /mnt/DUMP/hpr-for-archive.org/todo/ -for FILEX in * -do - if [[ "$(file "$FILEX" | grep -i audio | wc -l )" -ne 1 && "$(mediainfo "$FILEX" | grep -i audio | wc -l )" -ne 1 ]] - then - echo "$FILEX is not an audio file" - else - echo "Processing $FILEX" - fname=${FILEX%.*} - ext=${FILEX/*./} - # We get the druation from mediainfo in miliseconds and remove the last three digits to convert it to seconds - # Then calculate the times of the end clip working back from the end of the file - # We then pick a random segment between the intro and outro. - # Finally we convert to hour minute second format and the date command is the easiest way to do that - duration=$( mediainfo --full "${fname}.${ext}" | grep Duration | egrep -v ".*:.*:|ms|s|mn" | head -1 | awk -F ': ' '{print $2}' ) - duration="${duration:0:${#duration}-3}" - outro_clip_start="$(($duration-$outro_clip))" - quality_clip_end="$(($outro_clip_start-$quality_clip_duration))" - quality_clip_start=$(shuf -i ${intro_clip_end}-${quality_clip_end} -n 1) - quality_clip_end="$(($quality_clip_start+$quality_clip_duration))" - duration=$(\date -d@${duration} -u +%H:%M:%S) - quality_clip_start=$(\date -d@${quality_clip_start} -u +%H:%M:%S) - quality_clip_end=$(\date -d@${quality_clip_end} -u +%H:%M:%S) - outro_clip_start=$(\date -d@${outro_clip_start} -u +%H:%M:%S) - echo -e "\tExtracting spectrogram" - ${DEBUG} sox "${fname}.${ext}" -n spectrogram -Y 130 -l -r -t "${fname}.${ext}" -o "${fname}_spectrogram.png" - echo -e "\tExtracting intro clip from 0 to ${intro_clip_end}" - ${DEBUG} ffmpeg -y -ss 0 -t ${intro_clip_end} -i "${fname}.${ext}" "${fname}_intro_clip".wav 2>/dev/null - echo -e "\tExtracting quality clip from ${quality_clip_start} to ${quality_clip_end}" - ${DEBUG} ffmpeg -y -ss ${quality_clip_start} -t ${quality_clip_end} -i "${fname}.${ext}" "${fname}_quality_clip".wav 2>/dev/null - echo -e "\tExtracting outro clip from ${outro_clip_start} ${duration}" - ${DEBUG} ffmpeg -y -ss ${outro_clip_start} -t ${duration} -i "${fname}.${ext}" "${fname}_outro_clip".wav 2>/dev/null - echo -e "\tCreating low fidelity version" - ${DEBUG} ffmpeg -y -i "${fname}.${ext}" temp.wav 2>/dev/null - ${DEBUG} sox "temp.wav" -c 1 -r 16000 -t wav - 2>/dev/null | speexenc - "${fname}_low_fidelity.spx" 2>/dev/null - ${DEBUG} rm temp.wav - fi -done diff --git a/workflow/x.bash b/workflow/x.bash deleted file mode 100755 index 27abb48..0000000 --- a/workflow/x.bash +++ /dev/null @@ -1,50 +0,0 @@ -#cd /home/ken/processing/1659905303_3664_2022-08-18_037b55af6b77191b2610f5cedb5d2bd962f0251720bf0 -ttsserver="http://localhost:5500" -ep_num="3664" - -echo "This is Hacker Public Radio " > "hpr${ep_num}_summary.txt" - -## Jump to encoding - -function create_tts_summary { - HPR_summary="$( cat "hpr${ep_num}_summary.txt" )" - echo "INFO: Converting text \"${HPR_summary}\" to speech." - curl -X 'GET' -G --data-urlencode "voice=coqui-tts:en_ljspeech" --data-urlencode "text=${HPR_summary}" --data-urlencode "vocoder=high" --data-urlencode "denoiserStrength=0.03" --data-urlencode "cache=false" ${ttsserver}/api/tts -H 'accept: */*' --output ~hpr${ep_num}_summary.wav -} - -create_tts_summary_ok="not-ok" - -while [ "${create_tts_summary_ok}" != "OK" ] -do - create_tts_summary - - mpv ~hpr${ep_num}_summary.wav - - read -p "Is the text to speech correct (y|N) ? " -n 1 -r - echo # (optional) move to a new line - if [[ $REPLY =~ ^[Yy]$ ]] - then - create_tts_summary_ok="OK" - else - echo "WARN: Please correct the text and try again." - xdg-open "hpr${ep_num}_summary.txt" 2>&1 & - inotifywait --event modify "hpr${ep_num}_summary.txt" - fi -done -echo "INFO: TTS complete." -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# exit 9999