IA create item working

This commit is contained in:
Ken Fallon 2025-05-09 21:02:45 +02:00
parent 12d76f8a52
commit 35305a5c45

View File

@ -997,7 +997,7 @@ function get_variables_from_episode_summary_json() {
for episode_summary_key in $( jq --raw-output '. | keys | @tsv' "${episode_summary_json}" ) for episode_summary_key in $( jq --raw-output '. | keys | @tsv' "${episode_summary_json}" )
do do
episode_summary_value="$( jq --raw-output ".${episode_summary_key}" "${episode_summary_json}" | sed -e 's/ \././g' -e 's/\.\./\./g' -e 's/ / /g' )" episode_summary_value="$( jq --raw-output ".${episode_summary_key}" "${episode_summary_json}" | sed -e 's/ \././g' -e 's/\.\./\./g' -e 's/ / /g' )"
declare "${episode_summary_key}=${episode_summary_value}" export "${episode_summary_key}=${episode_summary_value}"
echo_debug "Setting \"${episode_summary_key}\" to \"${episode_summary_value}\" from \"$( basename ${episode_summary_json} )\"" echo_debug "Setting \"${episode_summary_key}\" to \"${episode_summary_value}\" from \"$( basename ${episode_summary_json} )\""
check_variable_is_correct ${episode_summary_key} check_variable_is_correct ${episode_summary_key}
done done
@ -1627,22 +1627,26 @@ function wait_for_the_internet_archive_to_process() {
# 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
function create_item_on_the_internet_archive() { function create_item_on_the_internet_archive() {
echo_debug "Sending the derived files to Internet Archive. create_item_on_the_internet_archive()" echo_debug "Sending the derived files to Internet Archive. create_item_on_the_internet_archive()"
check_variable_is_correct ep_num check_variable_is_correct working_dir ep_num artist date synopsis title license_url
if [ ! -s "${working_dir}/hpr${ep_num}.txt" ] if [ ! -s "${working_dir}/hpr${ep_num}.txt" ]
then then
echo_error "The Internet Archive \"${working_dir}/hpr${ep_num}.txt\" is missing." echo_error "The Internet Archive \"${working_dir}/hpr${ep_num}.txt\" is missing."
fi fi
ia list "hpr${ep_num}" > /dev/null
if [ $? -ne 0 ]
then
echo_debug "The episode has not been posted to the Internet Archive"
ia upload hpr${ep_num} "${working_dir}/hpr${ep_num}.txt" --metadata=mediatype:audio --metadata="contributor:HackerPublicRadio" --metadata="creator:${artist}" --metadata="date:${date}" --metadata="description:${synopsis}." --metadata="language:eng" --metadata="licenseurl:${license_url}" --metadata="title:${title}." --metadata=reviews-allowed:none --header x-archive-keep-old-version:0 --retries=5 --no-derive --no-backup
else
echo_debug "The episode has been posted to the Internet Archive"
fi
echo 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 xdg-open https://archive.org/details/hpr${ep_num}
# curl --silent --netrc --write-out '%{http_code}' https://hub.hackerpublicradio.org/cms/say.php?id=${ep_num} --output "${episode_summary_json}"
# curl --netrc-file ${HOME}/.netrc --write-out '%{http_code}' https://hub.hackerpublicradio.org/cms/shownotes.php?id=${ep_num} --output "${working_dir}/shownotes.json"
wait_for_the_internet_archive_to_process wait_for_the_internet_archive_to_process
} }
@ -1828,12 +1832,8 @@ fi
######################################################################################### #########################################################################################
# Using DB info from here # Using DB info from here
get_variables_from_episode_summary_json # Get the episode from HPR. get_variables_from_episode_summary_json # Get the episode from HPR.
# #
# create_tts_summary # Generate text to speech summary # create_tts_summary # Generate text to speech summary
# #
@ -1857,7 +1857,7 @@ get_variables_from_episode_summary_json # Get the episode from HPR.
# copy_derived_files_to_borg # copy_derived_files_to_borg
#create_item_on_the_internet_archive create_item_on_the_internet_archive
#upload_files_to_the_internet_archive #upload_files_to_the_internet_archive
@ -1872,3 +1872,7 @@ exit 0
# else # else
# echo_debug "The setting \"force_overwrite\" is set to false, so when files exist the program will skip files if they exist." # echo_debug "The setting \"force_overwrite\" is set to false, so when files exist the program will skip files if they exist."
# fi # fi
# curl --silent --netrc --write-out '%{http_code}' https://hub.hackerpublicradio.org/cms/say.php?id=${ep_num} --output "${episode_summary_json}"
# curl --netrc-file ${HOME}/.netrc --write-out '%{http_code}' https://hub.hackerpublicradio.org/cms/shownotes.php?id=${ep_num} --output "${working_dir}/shownotes.json"