The show processing needs to be refactored #5
This commit is contained in:
parent
5feaed5f46
commit
e1df438111
BIN
hpr_tags/fix_tags.bin
Executable file
BIN
hpr_tags/fix_tags.bin
Executable file
Binary file not shown.
@ -73,7 +73,7 @@ function program_checks() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
is_installed audio2image.bash awk base64 cat curl date detox eval extract_images ffprobe file find grep grep head jq kate magick mediainfo mv realpath rsync seamonkey sed sed sort sponge ssh touch touch wget
|
is_installed audio2image.bash awk base64 cat csvtojson curl date detox eval extract_images ffprobe file find grep grep head jq kate magick mediainfo mv realpath rsync seamonkey sed sed sort sponge ssh touch touch wget
|
||||||
|
|
||||||
for arg in $*
|
for arg in $*
|
||||||
do
|
do
|
||||||
@ -1136,6 +1136,68 @@ function manual_final_review() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
# Register the assets with the hpr database
|
||||||
|
|
||||||
|
function register_assets() {
|
||||||
|
|
||||||
|
echo_debug "Registering the assets with the hpr database"
|
||||||
|
|
||||||
|
if [[ -s "${working_dir}/hpr${ep_num}_assets.csv" ]]
|
||||||
|
then
|
||||||
|
echo_debug "Removing \"${working_dir}/hpr${ep_num}_assets.csv\"."
|
||||||
|
rm -v "${working_dir}/hpr${ep_num}_assets.csv"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo '"episode_id","filename","extension","size", "sha1sum", "mime_type", "file_type"' | tee "${working_dir}/hpr${ep_num}_assets.csv"
|
||||||
|
|
||||||
|
for this_asset in hpr${ep_num}.flac hpr${ep_num}.wav hpr${ep_num}.mp3 hpr${ep_num}.ogg hpr${ep_num}.opus hpr${ep_num}.srt hpr${ep_num}.txt hpr${ep_num}_image_*.*
|
||||||
|
do
|
||||||
|
echo_debug "Registering \"${this_asset}\"."
|
||||||
|
if [[ ! -s "${working_dir}/${this_asset}" ]]
|
||||||
|
then
|
||||||
|
echo_error "Failed to register missing file \"${working_dir}/${this_asset}\"."
|
||||||
|
ls -al "${working_dir}/${this_asset}"
|
||||||
|
fi
|
||||||
|
this_asset_basename=$( basename "${this_asset}" )
|
||||||
|
this_asset_extension="${this_asset_basename##*.}"
|
||||||
|
this_asset_size="$( ls -al "${this_asset}" | awk '{print $5}' )"
|
||||||
|
this_asset_sha1sum="$( sha1sum "${this_asset}" | awk '{print $1}' )"
|
||||||
|
this_asset_mime_type=$( file --dereference --brief --mime "${this_asset}" )
|
||||||
|
this_asset_file_type=$( file --dereference --brief "${this_asset}" )
|
||||||
|
|
||||||
|
variables=( ep_num this_asset_basename this_asset_extension this_asset_size this_asset_sha1sum this_asset_mime_type this_asset_file_type working_dir ep_num )
|
||||||
|
|
||||||
|
for variable in "${variables[@]}"
|
||||||
|
do
|
||||||
|
if [ -z "${!variable}" ]
|
||||||
|
then # indirect expansion here
|
||||||
|
echo_error "The variable \"${variable}\" is missing.";
|
||||||
|
else
|
||||||
|
echo_debug "The variable \"${variable}\" is set to \"${!variable}\"";
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "${ep_num},\"${this_asset_basename}\",\"${this_asset_extension}\",\"${this_asset_size}\",\"${this_asset_sha1sum}\",\"${this_asset_mime_type}\",\"${this_asset_file_type}\"" | tee --append "${working_dir}/hpr${ep_num}_assets.csv"
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -s "${working_dir}/hpr${ep_num}_assets.csv" ]
|
||||||
|
then
|
||||||
|
cat "${working_dir}/hpr${ep_num}_assets.csv" | csvtojson | jq '{"assets":[.[]]}' | tee "${working_dir}/hpr${ep_num}_assets.json"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -s "${working_dir}/hpr${ep_num}_assets.json" ]
|
||||||
|
then
|
||||||
|
echo_error "The asset json file \"${working_dir}/hpr${ep_num}_assets.json\" is missing.";
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$( curl --silent --netrc-file $HOME/.netrc --write-out '%{http_code}' --request POST https://hub.hackerpublicradio.org/cms/assets.php --data-ascii @"${working_dir}/hpr${ep_num}_assets.json" --header "Content-Type: application/json" )" != 200 ]
|
||||||
|
then
|
||||||
|
echo_error "The assets for episode hpr${ep_num} has not been registered."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
# 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 the Internet Archive
|
||||||
|
|
||||||
@ -1270,8 +1332,9 @@ generate_final_report
|
|||||||
|
|
||||||
manual_final_review
|
manual_final_review
|
||||||
|
|
||||||
#TODO update the assets table
|
register_assets
|
||||||
|
|
||||||
copy_derived_files_to_borg_for_the_internet_archive
|
copy_derived_files_to_borg_for_the_internet_archive
|
||||||
|
|
||||||
echo_debug "here" ; exit # TODO
|
echo_debug "The End"
|
||||||
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user