diff --git a/workflow/process_episode.bash b/workflow/process_episode.bash index ef1dd96..63e9703 100755 --- a/workflow/process_episode.bash +++ b/workflow/process_episode.bash @@ -9,15 +9,16 @@ # Variables debug="1" -force_overwrite=true # Sets the behavour when files exist or not -processing_dir="$HOME/tmp/hpr/processing" # The directory where the files will be copied to for processing -theme="${processing_dir}/theme.flac" # The hpr theme -silence="${processing_dir}/silence.flac" # A segment of silence to offset the tts in the intro -outro_flac="${processing_dir}/outro.flac" # The outro edited media -outro_srt="${processing_dir}/outro.srt" # The outro subtitle file -intro_srt="${processing_dir}/intro.srt" # The intro subtitle template file +force_overwrite=true # Sets the behavour when files exist or not +git_dir="$HOME/sourcecode/hpr/hpr_website" # The git directory for extra assets +processing_dir="$HOME/tmp/hpr/processing" # The directory where the files will be copied to for processing +theme="${processing_dir}/theme.flac" # The hpr theme +silence="${processing_dir}/silence.flac" # A segment of silence to offset the tts in the intro +outro_flac="${processing_dir}/outro.flac" # The outro edited media +outro_srt="${processing_dir}/outro.srt" # The outro subtitle file +intro_srt="${processing_dir}/intro.srt" # The intro subtitle template file -piper_bin="/opt/bin/piper/piper/piper" # The location of the text to speech engine +piper_bin="/opt/bin/piper/piper/piper" # The location of the text to speech engine piper_voice="/opt/bin/piper/piper/piper-voices/en/en_US/lessac/medium/en_US-lessac-medium.onnx" working_dir_bypass="false" @@ -381,6 +382,16 @@ function check_variable_is_correct() { echo_error "The \"genre\" variable is missing." fi ;; + git_dir) + if [[ -z "${git_dir}" || "${git_dir}" == "null" ]] + then + echo_error "The \"git_dir\" variable is missing." + fi + if [[ ! -d "${git_dir}" || ! -d "${git_dir}/.git" ]] + then + echo_error "The \"git_dir\" variable is missing or file \"${git_dir}\" does not exist." + fi + ;; HOME) if [[ ! -d "${HOME}" || -z "${HOME}" ]] then @@ -2054,6 +2065,32 @@ function copy_files_to_hpr_server() { } +################################################# +# Copy the images to the hpr server + +function copy_files_to_git() { + + echo_debug "Copying the files to the hpr server. copy_files_to_git()" + + check_variable_is_correct working_dir ep_num git_dir files_json + + if [ ! -d "${git_dir}/www/eps/hpr${ep_num}/" ] + then + mkdir -v "${git_dir}/www/eps/hpr${ep_num}/" + fi + + for this_file in $( jq --raw-output ".hpr${ep_num} | keys | @tsv" "${files_json}" ) + do + skip_file="$( echo "$this_file" | grep --count --perl-regexp "hpr${ep_num}.flac|hpr${ep_num}.mp3|hpr${ep_num}.ogg|hpr${ep_num}.opus|hpr${ep_num}.spx|hpr${ep_num}.srt|hpr${ep_num}.txt|hpr${ep_num}.wav" )" + if [ "${skip_file}" -eq "1" ] + then + continue + fi + cp -v "${working_dir}/$this_file" "${git_dir}/www/eps/hpr${ep_num}/" + done + +} + ################################################# # Send the derived files to the server borg to be sent to borg @@ -2377,6 +2414,8 @@ check_variable_is_correct working_dir ep_num shownotes_edited copy_files_to_hpr_server +copy_files_to_git + copy_derived_files_to_borg create_item_on_the_internet_archive