bug on asset csv and json checks
This commit is contained in:
parent
dd97a672aa
commit
24e36b945a
@ -510,9 +510,13 @@ function check_variable_is_correct() {
|
||||
# fi
|
||||
;;
|
||||
shownotes_json)
|
||||
if [[ ! -s "${shownotes_json}" || -z "${shownotes_json}" ]]
|
||||
if [ ! -s "${shownotes_json}" ]
|
||||
then
|
||||
echo_error "The \"shownotes_json\" variable/file is missing."
|
||||
echo_error "The \"shownotes_json\" variable is missing."
|
||||
fi
|
||||
if [ -z "${shownotes_json}" ]
|
||||
then
|
||||
echo_error "The \"shownotes_json\" file is missing."
|
||||
fi
|
||||
if [ "$( file --brief --mime-type "${shownotes_json}" | grep --count 'application/json' )" -ne "1" ]
|
||||
then
|
||||
@ -646,8 +650,6 @@ function get_next_show_from_hpr_hub() {
|
||||
ssh hpr -t "detox -v ${hpr_upload_dir}/"
|
||||
rsync -ave ssh --partial --progress ${source_dir}/ ${working_dir}/
|
||||
|
||||
check_variable_is_correct shownotes_json
|
||||
|
||||
}
|
||||
|
||||
#################################################
|
||||
@ -757,7 +759,7 @@ function get_episode_metadata() {
|
||||
return
|
||||
fi
|
||||
|
||||
check_variable_is_correct working_dir shownotes_json
|
||||
check_variable_is_correct working_dir
|
||||
|
||||
set_working_dir_variables
|
||||
|
||||
@ -1892,7 +1894,7 @@ function register_assets() {
|
||||
echo '"episode_id","filename","extension","size", "sha1sum", "mime_type", "file_type"' | tee "${assets_csv}"
|
||||
|
||||
find "${working_dir}/" -maxdepth 1 -type f \( -iname "hpr${ep_num}.*" -or -iname "hpr${ep_num}_image_*.*" \) | \
|
||||
while read for this_asset_filename
|
||||
while read this_asset_filename
|
||||
do
|
||||
this_asset_filename="$( basename "${this_asset_filename}" )"
|
||||
echo_debug "Registering \"${this_asset_filename}\"."
|
||||
@ -1932,13 +1934,17 @@ function register_assets() {
|
||||
done
|
||||
|
||||
check_variable_is_correct assets_csv
|
||||
|
||||
echo_debug "${assets_csv}, ${assets_json}"
|
||||
|
||||
if [[ -s "${assets_csv}" && "$( wc -l "${assets_csv}" )" -gt "1" ]]
|
||||
if [[ -s "${assets_csv}" && "$( wc -l "${assets_csv}" | awk '{print $1}' )" -gt "1" ]]
|
||||
then
|
||||
cat "${assets_csv}" | csvtojson | jq '{"assets":[.[]]}' | tee "${assets_json}"
|
||||
fi
|
||||
|
||||
check_variable_is_correct assets_json
|
||||
|
||||
if [ ! -s "${assets_json}" ]
|
||||
if [[ ! -s "${assets_json}" && "$( wc -l "${assets_json}" | awk '{print $1}' )" -gt "4" ]]
|
||||
then
|
||||
echo_error "The asset json file \"${assets_json}\" is missing.";
|
||||
fi
|
||||
@ -1950,6 +1956,7 @@ function register_assets() {
|
||||
else
|
||||
echo_debug "The assets for episode hpr${ep_num} have been registered. The response was \"${response}\""
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#################################################
|
||||
@ -2345,4 +2352,3 @@ exit 0
|
||||
|
||||
# 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"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user