forked from HPR/hpr_hub
Adding stats and automating update. Check for url in uploads
This commit is contained in:
@@ -16,6 +16,16 @@ do
|
||||
echo "ERROR: \"${shownotes}\" not found"
|
||||
exit 1
|
||||
fi
|
||||
metadata_url="$( jq --raw-output '.metadata.url' "${shownotes}" )"
|
||||
if [ -n "${metadata_url}" ]
|
||||
then
|
||||
save_name=$( basename "${metadata_url}" | sed -e 's/[^A-Za-z0-9.]/_/g' -e 's/__/_/g' )
|
||||
if [ ! -s "${reserve_show_dir}/${save_name}" ]
|
||||
then
|
||||
echo "ERROR: \"${metadata_url}\" needs to be downloaded as \"${reserve_show_dir}/${save_name}\""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
Host_ID="$( jq --raw-output '.host.Host_ID' "${shownotes}" )"
|
||||
Host_Name="$( jq --raw-output '.host.Host_Name' "${shownotes}" | sed -e 's/[^A-Za-z0-9]/_/g' -e 's/__/_/g' )"
|
||||
Key="$( jq --raw-output '.metadata.Key' "${shownotes}" )"
|
||||
|
8
bin/update-stats.bash
Normal file
8
bin/update-stats.bash
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
hub_dir="/home/hpr/hub"
|
||||
|
||||
for format in txt csv json xml
|
||||
do
|
||||
curl --silent --netrc-file /home/hpr/.netrc https://hub.hackerpublicradio.org/cms/stats.php?format=${format} --output ${hub_dir}/stats.${format}
|
||||
done
|
Reference in New Issue
Block a user