forked from HPR/hpr-tools
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
|
# fi
|
||||||
;;
|
;;
|
||||||
shownotes_json)
|
shownotes_json)
|
||||||
if [[ ! -s "${shownotes_json}" || -z "${shownotes_json}" ]]
|
if [ ! -s "${shownotes_json}" ]
|
||||||
then
|
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
|
fi
|
||||||
if [ "$( file --brief --mime-type "${shownotes_json}" | grep --count 'application/json' )" -ne "1" ]
|
if [ "$( file --brief --mime-type "${shownotes_json}" | grep --count 'application/json' )" -ne "1" ]
|
||||||
then
|
then
|
||||||
@ -646,8 +650,6 @@ function get_next_show_from_hpr_hub() {
|
|||||||
ssh hpr -t "detox -v ${hpr_upload_dir}/"
|
ssh hpr -t "detox -v ${hpr_upload_dir}/"
|
||||||
rsync -ave ssh --partial --progress ${source_dir}/ ${working_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
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_variable_is_correct working_dir shownotes_json
|
check_variable_is_correct working_dir
|
||||||
|
|
||||||
set_working_dir_variables
|
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}"
|
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_*.*" \) | \
|
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
|
do
|
||||||
this_asset_filename="$( basename "${this_asset_filename}" )"
|
this_asset_filename="$( basename "${this_asset_filename}" )"
|
||||||
echo_debug "Registering \"${this_asset_filename}\"."
|
echo_debug "Registering \"${this_asset_filename}\"."
|
||||||
@ -1933,12 +1935,16 @@ function register_assets() {
|
|||||||
|
|
||||||
check_variable_is_correct assets_csv
|
check_variable_is_correct assets_csv
|
||||||
|
|
||||||
if [[ -s "${assets_csv}" && "$( wc -l "${assets_csv}" )" -gt "1" ]]
|
echo_debug "${assets_csv}, ${assets_json}"
|
||||||
|
|
||||||
|
if [[ -s "${assets_csv}" && "$( wc -l "${assets_csv}" | awk '{print $1}' )" -gt "1" ]]
|
||||||
then
|
then
|
||||||
cat "${assets_csv}" | csvtojson | jq '{"assets":[.[]]}' | tee "${assets_json}"
|
cat "${assets_csv}" | csvtojson | jq '{"assets":[.[]]}' | tee "${assets_json}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -s "${assets_json}" ]
|
check_variable_is_correct assets_json
|
||||||
|
|
||||||
|
if [[ ! -s "${assets_json}" && "$( wc -l "${assets_json}" | awk '{print $1}' )" -gt "4" ]]
|
||||||
then
|
then
|
||||||
echo_error "The asset json file \"${assets_json}\" is missing.";
|
echo_error "The asset json file \"${assets_json}\" is missing.";
|
||||||
fi
|
fi
|
||||||
@ -1950,6 +1956,7 @@ function register_assets() {
|
|||||||
else
|
else
|
||||||
echo_debug "The assets for episode hpr${ep_num} have been registered. The response was \"${response}\""
|
echo_debug "The assets for episode hpr${ep_num} have been registered. The response was \"${response}\""
|
||||||
fi
|
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 --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"
|
# 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