This commit is contained in:
Ken Fallon 2025-05-08 17:35:06 +02:00
parent 16d62131a1
commit aba20faa1c

View File

@ -156,23 +156,6 @@ function get_working_dir_from_local_dir() {
echo_debug "Processing a local directory"
# Get supplied working dir and ep_num if provided
for argument in "$@"
do
if [ -d "${argument}" ]
then
working_dir="$( realpath ${argument} )"
fi
if [ "$( echo "${argument}" | grep --count "ep_num=" )" -eq "1" ]
then
ep_num="$( echo "${argument}" | sed 's/^.*ep_num=//g' | awk '{print $1}' )"
fi
done
if [[ ! -d "${working_dir}" || -z "${working_dir}" ]]
then
echo_error "The working dir is missing. Please supply a working directory."
@ -608,6 +591,7 @@ function generate_initial_report() {
</head>
<body>
<p>Skip to <a href=\"#derived_media\">Derived Media</a></p>
<h3>Field Mapping</h3>
<table>
@ -1098,7 +1082,7 @@ function generate_final_report() {
grep -Pv '</body>|</html>' "${working_dir}/processing/${media_basename%.*}_media_report.html" > "${final_report}"
echo "<h3>Text To Speech</h3>
echo "<h3 id=\"derived_media\" >Text To Speech</h3>
<p>
$( echo "${synopsis}" )
</p>
@ -1347,8 +1331,7 @@ function copy_files_to_origin_server() {
}
#################################################
# Send the derived files to the server borg to be sent to the Internet Archive
# Send the derived files to the server borg to be sent to borg
function copy_derived_files_to_borg() {
echo_debug "Sending the derived files to the admin server borg"
@ -1426,12 +1409,66 @@ function copy_derived_files_to_borg() {
}
#################################################
# Wait for the Internet Archive to finish processing
function wait_for_the_internet_archive_to_process() {
echo_debug "Sending the derived files to Internet Archive"
if [ -z "${ep_num}x" ]
then
echo_error "Could not find the episode number while uploading to the Internet Archive"
fi
}
#################################################
# Send the derived files to the server borg to be sent to the Internet Archive
function upload_to_the_internet_archive() {
echo_debug "Sending the derived files to Internet Archive"
continue
# hpr4371.flac
# hpr4371.mp3
# hpr4371.ogg
# hpr4371.opus
# hpr4371_source.flac
# hpr4371.srt
# hpr4371.txt
# hpr4371.wav
#
# for ext in flac mp3 ogg opus wav
# do
# if [[ ! -s "${working_dir}/hpr${ep_num}.${ext}" ]]
# then
# echo_error "The derived files to the Internet Archive are missing \"hpr${ep_num}.${ext}\"."
# ls -al "${working_dir}/hpr${ep_num}.${ext}"
# fi
# done
#
# "${working_dir}/hpr${ep_num}.${ext}"
#
# ep_num="4371"
# ia upload hpr${ep_num} "${working_dir}/hpr${ep_num}.txt" --metadata=mediatype:audio --metadata="contributor:HackerPublicRadio" --metadata="creator:HPR Volunteers" --metadata="date:2025-05-05" --metadata="description:This show is a placeholder and will be updated soon." --metadata="language:eng" --metadata="licenseurl:http://creativecommons.org/licenses/by-sa/4.0" --metadata="title:A placeholder for hpr${ep_num}." --metadata=reviews-allowed:none --header x-archive-keep-old-version:0 --retries=5 --no-derive --no-backup
#
# wait for ia to finish
# ia tasks "hpr${ep_num}" | jq --slurp '[.[] | if .category == "catalog" then .status else empty end] | length'
# locate placeholder
# ia upload hpr4321_a686b0995e77c32d9e6566596ed9e4a2 /home/ken/tmp/hpr/processing/1739652162_4321_2025-02-24_624fd1a95db1d05e693eaf06e2f69b8667b0fc42edbc9/hpr4321.txt --metadata=mediatype:audio --metadata="collection:test_collection" --metadata="contributor:HackerPublicRadio" --metadata="creator:Klaatu" --metadata="date:2025-02-24" --metadata="description:This show is a placeholder and will be updated soon." --metadata="language:eng" --metadata="licenseurl:http://creativecommons.org/licenses/by-sa/4.0" --metadata="title:A placeholder for hpr4321." --metadata=reviews-allowed:none --header x-archive-keep-old-version:0 --retries=5 --no-derive --no-backup
# locate placeholder
# for extension in .flac .mp3 .ogg .opus _source.ogg .srt .txt .wav;
# do
# echo ia upload hpr${ep_num} "${working_dir}/hpr${ep_num}${extension}" --header "x-archive-keep-old-version:0" --retries=5 --no-derive --no-backup
# done
#
# ia upload hpr hpr4283_image_* --header "x-archive-keep-old-version:0" --retries=5 --no-derive --no-backup
# # # # for ext in flac mp3 ogg opus wav
# # # # do
# # # # if [[ ! -s "${working_dir}/hpr${ep_num}.${ext}" ]]
@ -1481,7 +1518,6 @@ function upload_to_the_internet_archive() {
# # # # --header x-archive-keep-old-version:0 \
# # # # --retries=5 --no-derive --no-backup
# # # #
}
# ia upload hpr4295 /data/IA/uploads/hpr4295.wav \
@ -1501,6 +1537,8 @@ function upload_to_the_internet_archive() {
# --header x-archive-keep-old-version:0 \
# --retries=5 --no-derive --no-backup
}
#################################################
# Main exceution starts here
#
@ -1517,6 +1555,24 @@ function upload_to_the_internet_archive() {
# TODO incorporate direct upload to the IA
# TODO copy the files to the backup disk
# Get supplied working dir and ep_num if provided
for argument in "$@"
do
if [ "$( echo "${argument}" | grep --count "working_dir=" )" -eq "1" ]
then
working_dir="$( realpath $( echo "${argument}" | sed 's/^.*working_dir=//g' | awk '{print $1}' ) )/"
echo_debug "Using supplied 'working_dir' of \"${working_dir}\""
fi
if [ "$( echo "${argument}" | grep --count "ep_num=" )" -eq "1" ]
then
ep_num="$( echo "${argument}" | sed 's/^.*ep_num=//g' | awk '{print $1}' )"
echo_debug "Using supplied 'ep_num' of \"${ep_num}\""
fi
done
program_checks # We know that all the programs and variables are set
get_working_dir $@ # We have a working directory and a valid json file