Untracked changes in hprtranscode
This commit is contained in:
parent
1d14028ba0
commit
d87c9ed979
@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/
|
||||
# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/
|
||||
#============================================================
|
||||
PATH=$PATH:/home/ken/sourcecode/hpr/hpr_hub/bin/
|
||||
#source /home/ken/tmp/pip3.9/bin/activate
|
||||
PATH=$PATH:$HOME/sourcecode/hpr/hpr_hub/bin/
|
||||
source $HOME/tmp/pip3.9/bin/activate
|
||||
# https://hub.tcno.co/ai/whisper/install/
|
||||
|
||||
TEMP_DIR="/var/tmp/"
|
||||
CHANNELS="1"
|
||||
CHANNELS="2"
|
||||
FIXAUDIO="1"
|
||||
ARTIST="EMPTY"
|
||||
TITLE="EMPTY"
|
||||
@ -15,9 +16,10 @@ basedir="/var/IA"
|
||||
upload_dir="${basedir}/uploads"
|
||||
theme="${basedir}/theme.wav"
|
||||
outro="${basedir}/2022-03-07-outro.wav"
|
||||
outro_c2="${basedir}/2022-03-07-outro_c2.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"
|
||||
processing_dir="$HOME/tmp/hpr/processing"
|
||||
git_image_dir="$HOME/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"
|
||||
@ -42,7 +44,7 @@ function create_tts_summary {
|
||||
###################
|
||||
# Locate media directory
|
||||
#
|
||||
#
|
||||
#
|
||||
show_type=""
|
||||
if [[ -f "${1}" && -n "${2}" ]]
|
||||
then
|
||||
@ -79,6 +81,15 @@ else
|
||||
#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
|
||||
|
||||
upload_dir_ep_num="${upload_dir}/hpr${ep_num}"
|
||||
mkdir -p "${upload_dir_ep_num}" 2>/dev/null
|
||||
if [ ! -d "${upload_dir_ep_num}" ]
|
||||
then
|
||||
echo "DEBUG: Missing directory \"upload_dir_ep_num\" \"${upload_dir}\", /hpr and \"${ep_num}\"" 1>&2
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "DEBUG: Checking variables" 1>&2
|
||||
@ -103,10 +114,12 @@ 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 ]]
|
||||
echo "DEBUG: Using media directory as \"${media_dir}\""
|
||||
|
||||
if [[ "$( find "${media_dir}" \( -iname "hpr${ep_num}_sandwitch.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}_sandwitch.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" \)
|
||||
find "${media_dir}" \( -iname "hpr${ep_num}_sandwitch.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}_sandwitch.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]$ ]]
|
||||
@ -115,7 +128,7 @@ then
|
||||
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
|
||||
find "${media_dir}" \( -iname "hpr${ep_num}_sandwitch.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}_sandwitch.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
|
||||
|
||||
@ -137,7 +150,7 @@ 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
|
||||
do
|
||||
echo "INFO: You selected \"${this_media}\"."
|
||||
ls -al "${this_media}"
|
||||
mediafile="${this_media}"
|
||||
@ -205,7 +218,7 @@ fi
|
||||
|
||||
|
||||
re='^[0-9]+$'
|
||||
if ! [[ $ep_num =~ $re ]]
|
||||
if ! [[ $ep_num =~ $re ]]
|
||||
then
|
||||
echo "error: episode \"${ep_num}\" is not a number"
|
||||
exit 1
|
||||
@ -217,6 +230,13 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${outro_c2}" ]
|
||||
then
|
||||
echo "sorry, file \"${outro_c2}\" does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "${theme}" ]
|
||||
then
|
||||
echo "sorry, file \"${theme}\" does not exist"
|
||||
@ -242,7 +262,7 @@ mpv -vo=null "${mediafile}"
|
||||
unset REPLY
|
||||
until [[ $REPLY =~ ^[yYnN]$ ]]
|
||||
do
|
||||
read -p "Is the audio ok (n|Y) ? " -n 1 -r
|
||||
read -p "Is the audio ok (n|Y) ? " -n 1 -r
|
||||
echo ""
|
||||
done
|
||||
|
||||
@ -339,7 +359,7 @@ fi
|
||||
|
||||
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
|
||||
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
|
||||
@ -380,22 +400,52 @@ sox -V2 silence.wav ~~hpr${ep_num}_summary.wav hpr${ep_num}_summary.wav >> ${fna
|
||||
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
|
||||
if [ ${CHANNELS} -eq "2" ]
|
||||
then
|
||||
echo "Converting mono to Stero" | tee -a ${fname}_tmp.log
|
||||
ffmpeg -y -i "hpr${ep_num}_intro.wav" -ac 2 "hpr${ep_num}_intro_c2.wav"
|
||||
echo "Creating the sandwitch: \"hpr${ep_num}_intro_c2.wav\" \"${fname}_mezzanine.wav\" \"${outro}\" \"hpr${ep_num}_sandwitch.wav\" " | tee -a ${fname}_tmp.log
|
||||
sox -V2 "hpr${ep_num}_intro_c2.wav" "${fname}_mezzanine.wav" "${outro_c2}" "hpr${ep_num}_sandwitch.wav" >> ${fname}_tmp.log 2>&1
|
||||
else
|
||||
echo "Creating the sandwitch: \"hpr${ep_num}_intro.wav\" \"${fname}_mezzanine.wav\" \"${outro}\" \"hpr${ep_num}_sandwitch.wav\" " | tee -a ${fname}_tmp.log
|
||||
sox -V2 "hpr${ep_num}_intro.wav" "${fname}_mezzanine.wav" "${outro}" "hpr${ep_num}_sandwitch.wav" >> ${fname}_tmp.log 2>&1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "Normalizing the wav files" | tee -a ${fname}_tmp.log
|
||||
#sox --temp "${TEMP_DIR}" --norm hpr${ep_num}.wav hpr${ep_num}_norm.wav
|
||||
#sox --temp "${TEMP_DIR}" --norm hpr${ep_num}_sandwitch.wav hpr${ep_num}_norm.wav
|
||||
#ffmpeg -y -i hpr${ep_num}_sandwitch.wav -filter:a "dynaudnorm=p=0.9:s=5" hpr${ep_num}_norm.wav >> ${fname}_tmp.log 2>&1
|
||||
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
|
||||
if [ ! -d "${upload_dir_ep_num}" ]
|
||||
then
|
||||
echo "DEBUG: Missing directory \"upload_dir_ep_num\" \"${upload_dir}\", /hpr and \"${ep_num}\"" 1>&2
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -e "hpr${ep_num}_norm.wav" ]
|
||||
then
|
||||
echo "DEBUG: Missing file \"hpr${ep_num}_norm.wav\"" 1>&2
|
||||
exit
|
||||
fi
|
||||
|
||||
cp -v hpr${ep_num}_norm.wav ${upload_dir_ep_num}/hpr${ep_num}.wav >> ${fname}_tmp.log 2>&1
|
||||
|
||||
if [ ! -e "${upload_dir_ep_num}/hpr${ep_num}.wav" ]
|
||||
then
|
||||
echo "DEBUG: Missing file \"${upload_dir_ep_num}/hpr${ep_num}.wav\"" 1>&2
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
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 &
|
||||
ffprobe ${upload_dir_ep_num}/hpr${ep_num}.wav 2>&1 | grep Audio:
|
||||
mediainfo ${upload_dir_ep_num}/hpr${ep_num}.wav
|
||||
audio2image.bash ${upload_dir_ep_num}/hpr${ep_num}.wav
|
||||
xdg-open ${upload_dir_ep_num}/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]$ ]]
|
||||
@ -403,13 +453,14 @@ then
|
||||
echo "skipping...."
|
||||
exit
|
||||
fi
|
||||
rm -v ${upload_dir}/hpr${ep_num}.png
|
||||
#rm -v ${upload_dir_ep_num}/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
|
||||
echo whisper --model tiny --language en --output_dir "${media_dir}" "${upload_dir_ep_num}/hpr${ep_num}.wav" | tee -a ${fname}_tmp.log
|
||||
whisper --model tiny --language en --output_dir "${media_dir}" "${upload_dir_ep_num}/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 &
|
||||
@ -427,34 +478,34 @@ then
|
||||
exit
|
||||
fi
|
||||
|
||||
mkdir "${upload_dir}/hpr${ep_num}" >/dev/null 2>&1
|
||||
mkdir "${upload_dir_ep_num}/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
|
||||
cp -v "${media_dir}/hpr${ep_num}".vtt "${upload_dir_ep_num}/hpr${ep_num}.vtt" | tee -a ${fname}_tmp.log
|
||||
cp -v "${media_dir}/hpr${ep_num}".srt "${upload_dir_ep_num}/hpr${ep_num}.srt" | tee -a ${fname}_tmp.log
|
||||
cp -v "${media_dir}/hpr${ep_num}".txt "${upload_dir_ep_num}/hpr${ep_num}.txt" | tee -a ${fname}_tmp.log
|
||||
cp -v "${media_dir}/hpr${ep_num}".tsv "${upload_dir_ep_num}/hpr${ep_num}.tsv" | tee -a ${fname}_tmp.log
|
||||
cp -v "${media_dir}/hpr${ep_num}".json "${upload_dir_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
|
||||
ffmpeg -y -i ${upload_dir_ep_num}/hpr${ep_num}.wav ${upload_dir_ep_num}/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
|
||||
ffmpeg -y -i ${upload_dir_ep_num}/hpr${ep_num}.wav ${upload_dir_ep_num}/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
|
||||
ffmpeg -y -i ${upload_dir_ep_num}/hpr${ep_num}.wav ${upload_dir_ep_num}/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
|
||||
#ffmpeg -y -i ${upload_dir_ep_num}/hpr${ep_num}.wav ${upload_dir_ep_num}/hpr${ep_num}.ogg 2>> ${fname}_tmp.log 1>&2
|
||||
ffmpeg -y -i ${upload_dir_ep_num}/hpr${ep_num}.wav -acodec libopus -f ogg ${upload_dir_ep_num}/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
|
||||
ffmpeg -y -i ${upload_dir_ep_num}/hpr${ep_num}.wav ${upload_dir_ep_num}/hpr${ep_num}.spx 2>> ${fname}_tmp.log 1>&2
|
||||
|
||||
### End conversion
|
||||
|
||||
@ -468,14 +519,14 @@ echo "Intro(${intro_duration}) + Show(${HPR_duration}) + Outro(${outro_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
|
||||
${upload_dir_ep_num}/hpr${ep_num}.wav \
|
||||
${upload_dir_ep_num}/hpr${ep_num}.opus \
|
||||
${upload_dir_ep_num}/hpr${ep_num}.flac \
|
||||
${upload_dir_ep_num}/hpr${ep_num}.mp3 \
|
||||
${upload_dir_ep_num}/hpr${ep_num}.spx \
|
||||
${upload_dir_ep_num}/hpr${ep_num}.ogg
|
||||
do
|
||||
# ${upload_dir}/hpr${ep_num}.spx
|
||||
# ${upload_dir_ep_num}/hpr${ep_num}.spx
|
||||
echo "INFO: Processing the file \"${check_file}\""
|
||||
if [[ ! -s "${check_file}" ]]
|
||||
then
|
||||
@ -506,7 +557,7 @@ else
|
||||
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 ]]
|
||||
if [[ ! -s ${upload_dir_ep_num}/hpr${ep_num}.wav ]] || [[ ! -s ${upload_dir_ep_num}/hpr${ep_num}.opus ]] || [[ ! -s ${upload_dir_ep_num}/hpr${ep_num}.flac ]] || [[ ! -s ${upload_dir_ep_num}/hpr${ep_num}.mp3 ]] || [[ ! -s ${upload_dir_ep_num}/hpr${ep_num}.ogg ]] || [[ ! -s ${upload_dir_ep_num}/hpr${ep_num}.spx ]]
|
||||
then
|
||||
echo "ERROR: Something went wrong encoding the files"
|
||||
exit 1
|
||||
@ -516,28 +567,28 @@ 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 -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_ep_num}/hpr${ep_num}* 2>> ${fname}_tmp.log 1>&2
|
||||
|
||||
fix_tags ${upload_dir}/hpr${ep_num}*
|
||||
fix_tags ${upload_dir_ep_num}/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}*
|
||||
touch -r ${mediafile} ${upload_dir_ep_num}/hpr${ep_num}*
|
||||
|
||||
ls -al hpr${ep_num}* ${upload_dir}/hpr${ep_num}* | tee -a ${fname}_tmp.log
|
||||
ls -al hpr${ep_num}* ${upload_dir_ep_num}/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
|
||||
# # ${upload_dir_ep_num}/hpr${ep_num}.wav \
|
||||
# # ${upload_dir_ep_num}/hpr${ep_num}.opus \
|
||||
# # ${upload_dir_ep_num}/hpr${ep_num}.flac \
|
||||
# # ${upload_dir_ep_num}/hpr${ep_num}.mp3 \
|
||||
# # ${upload_dir_ep_num}/hpr${ep_num}.spx \
|
||||
# # ${upload_dir_ep_num}/hpr${ep_num}.ogg
|
||||
# # do
|
||||
# # size="$( ls -al "${asset_file}" | awk '{print $5}' )"
|
||||
# # sha1sum="$( sha1sum "${asset_file}" | awk '{print $1}' )"
|
||||
@ -550,16 +601,16 @@ echo "--------------------------------------------------------------------------
|
||||
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/
|
||||
#rsync -ave ssh --partial --progress --ignore-existing ${upload_dir_ep_num}/hpr${ep_num}.mp3 ${upload_dir_ep_num}/hpr${ep_num}.ogg ${upload_dir_ep_num}/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 "file://${upload_dir_ep_num}/hpr${ep_num}.mp3" >/dev/null 2>&1 &
|
||||
firefox "file://${upload_dir_ep_num}/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"
|
||||
#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_ep_num}/hpr${ep_num}.spx" "file://${upload_dir_ep_num}/hpr${ep_num}.opus" "file://${upload_dir_ep_num}/hpr${ep_num}.ogg" "file://${upload_dir_ep_num}/hpr${ep_num}.mp3" "file://${upload_dir_ep_num}/hpr${ep_num}.flac"
|
||||
mpv "file://${upload_dir_ep_num}/hpr${ep_num}.spx" "file://${upload_dir_ep_num}/hpr${ep_num}.opus" "file://${upload_dir_ep_num}/hpr${ep_num}.ogg" "file://${upload_dir_ep_num}/hpr${ep_num}.mp3" "file://${upload_dir_ep_num}/hpr${ep_num}.flac"
|
||||
|
||||
read -p "Remove files for \"${fname}\" (y|N) ? " -n 1 -r
|
||||
echo # (optional) move to a new line
|
||||
@ -569,19 +620,19 @@ then
|
||||
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}"
|
||||
# f
|
||||
# ssh hpr -t "ls -al /home/hpr/www/eps/hpr${ep_num}*"
|
||||
cp -v "${mediafile}" "${upload_dir_ep_num}/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
|
||||
# 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 -
|
||||
@ -589,19 +640,42 @@ then
|
||||
|
||||
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
|
||||
|
||||
echo "INFO: rsync -ave ssh --partial --progress ${upload_dir}/hpr${ep_num}* rsync.net:processing/"
|
||||
rsync -ave ssh --partial --progress ${upload_dir}/hpr${ep_num}* rsync.net:processing/
|
||||
echo "$( ssh borg -t "ls -al /data/IA/uploads/hpr${ep_num}*" ; ssh rsync.net -t "ls -al rsync.net:processing/hpr${ep_num}*" ; ls -al ${upload_dir}/hpr${ep_num}* )" | grep "hpr${ep_num}" | awk '{print $5, $NF}' | sort
|
||||
# ken@kalani:
|
||||
# rsync -av --partial --progress /var/IA/uploads/ vger:processing/
|
||||
# $HOME/sourcecode/hpr/hpr_hub.wip/bin/hpr-assets.bash
|
||||
|
||||
# root@vger:~#
|
||||
# rsync -av --progress --partial $HOME/processing/ /mnt/data/hpr/eps/
|
||||
# find /mnt/data/hpr/eps/ -mindepth 1 -maxdepth 1 -type f | grep -vE 'assets.csv|assets.json' | while read i;do mv -fv ${i} $(dirname ${i})/$(basename ${i%.*} | cut -c -7 )/;done
|
||||
# find /mnt/data/hpr/eps/ -type f \( -iname "*source*" -o -iname "*flac*" -o -iname "*wav*" \) -delete -print
|
||||
# chcon -R --type=httpd_sys_rw_content_t /mnt/data/hpr/
|
||||
# chown apache:apache /mnt/data/hpr/
|
||||
|
||||
# ken@kalani:
|
||||
# sshfs vger:/ /mnt/sshfs/vger/
|
||||
# sshfs rsync.net: /mnt/sshfs/rsync.net/
|
||||
# rsync -av --partial --progress /mnt/sshfs/vger/mnt/data/hpr/eps/ /mnt/sshfs/rsync.net/hpr/eps/
|
||||
|
||||
# https://hpr.nyc3.cdn.digitaloceanspaces.com/eps/hpr1404/hpr1404.mp3
|
||||
# https://alpha.nl.eu.mirror.hackerpublicradio.org/eps/hpr4271/hpr4271.mp3
|
||||
# https://archive.org/download/hpr4268/hpr4268.ogg
|
||||
|
||||
# set eps.valid=1
|
||||
|
||||
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"
|
||||
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 "cp -v \"${mediafile}\" \"${upload_dir_ep_num}/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 -"
|
||||
|
Loading…
Reference in New Issue
Block a user