Fix date being null
This commit is contained in:
parent
8a2d934048
commit
945c2b499a
|
@ -46,7 +46,12 @@ for torrent_file in *.torrent; do
|
||||||
leechers=$(jq -r '.peers' <<< $health_text)
|
leechers=$(jq -r '.peers' <<< $health_text)
|
||||||
completed=$(jq -r '.completed' <<< $health_text)
|
completed=$(jq -r '.completed' <<< $health_text)
|
||||||
date_string=$(jq -r '.created' <<< $health_text)
|
date_string=$(jq -r '.created' <<< $health_text)
|
||||||
|
if [ -z $date_string ]; then
|
||||||
|
echo "Date was null, setting to now"
|
||||||
|
created_date=$(date +%s)
|
||||||
|
else
|
||||||
created_date=$(date -d "${date_string}" +"%s")
|
created_date=$(date -d "${date_string}" +"%s")
|
||||||
|
fi
|
||||||
scraped_date=$(date +%s)
|
scraped_date=$(date +%s)
|
||||||
|
|
||||||
# Construct add line
|
# Construct add line
|
||||||
|
|
Loading…
Reference in New Issue