Support last update date #20
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
destination_dir="$HOME/tmp/hpr/processing/"
|
||||
reserve_dir="$HOME/tmp/hpr/reserve/"
|
||||
server_dir="hub.hackerpublicradio.org"
|
||||
|
||||
debug=1
|
||||
#################################################
|
||||
# Display Error message, display help and exit
|
||||
|
||||
@@ -57,30 +58,39 @@ do
|
||||
|
||||
if [ "${ep_num}" == "9999" ]
|
||||
then
|
||||
source_dir="${server_dir}/reserve/"
|
||||
hpr_dir="${server_dir}/reserve/"
|
||||
local_dir="${reserve_dir}"
|
||||
else
|
||||
source_dir="${server_dir}/upload/"
|
||||
hpr_dir="${server_dir}/upload/"
|
||||
local_dir="${destination_dir}"
|
||||
fi
|
||||
if [ "$( find "${destination_dir}" -maxdepth 2 -mindepth 2 -type f -iname "*${key}*.srt" | wc --lines )" -ne "0" ]
|
||||
if [ "$( find "${local_dir}" -maxdepth 2 -mindepth 2 -type f -iname "*${key}*.srt" | wc --lines )" -ne "0" ]
|
||||
then
|
||||
echo_debug "The episode \"${timestamp_epoc} ${ep_num} ${ep_date} ${key} ${status} ${email}\" has been processed."
|
||||
continue
|
||||
fi
|
||||
|
||||
show_path="$( ssh -n hpr -t "find \"${source_dir}\" -maxdepth 1 -mindepth 1 -type d -iname \"*${key}*\"" 2>/dev/null | sed "s#${source_dir}##g#" )"
|
||||
|
||||
echo_debug "ssh -n hpr -t \"find \"${hpr_dir}\" -maxdepth 1 -mindepth 1 -type d -iname \"*${key}*\"\""
|
||||
show_path="$( ssh -n hpr -t "find \"${hpr_dir}\" -maxdepth 1 -mindepth 1 -type d -iname \"*${key}*\"" 2>/dev/null | sed "s#${hpr_dir}##g#" )"
|
||||
if [ -z "${show_path}" ]
|
||||
then
|
||||
echo_error "The show_path could not be found."
|
||||
echo_error "The show_path could not be found. \"${show_path}\""
|
||||
fi
|
||||
show_dir="${destination_dir}/${show_path}"
|
||||
echo_debug "Copying \"hpr:${source_dir}/${show_path}/\" to \"${show_dir}/\""
|
||||
rsync --archive --verbose --partial --progress hpr:${source_dir}/${show_path}/ ${show_dir}/
|
||||
show_dir="${local_dir}/${show_path}"
|
||||
if [ ! -d "${show_dir}" ]
|
||||
then
|
||||
mkdir -v "${show_dir}"
|
||||
fi
|
||||
echo_debug "Copying \"hpr:${hpr_dir}/${show_path}/\" to \"${show_dir}/\""
|
||||
echo_debug "rsync --archive --verbose --partial --progress hpr:${hpr_dir}/${show_path}/ ${show_dir}/"
|
||||
rsync --archive --verbose --partial --progress hpr:${hpr_dir}/${show_path}/ ${show_dir}/
|
||||
cd "${show_dir}"
|
||||
pwd
|
||||
find "${show_dir}/" -type f -exec file {} \; | grep -Ei 'audio|mpeg|video|MP4' | awk -F ': ' '{print $1}' | while read this_media
|
||||
do
|
||||
whisper --output_format srt --model tiny --language en --output_dir "${show_dir}" "${this_media}"
|
||||
done
|
||||
rsync --archive --verbose --partial --progress ${show_dir}/ hpr:${source_dir}/${show_path}/
|
||||
rsync --archive --verbose --partial --progress ${show_dir}/ hpr:${hpr_dir}/${show_path}/
|
||||
|
||||
done
|
||||
Reference in New Issue
Block a user