test that API response contains total

This commit is contained in:
bux 2022-03-30 01:11:54 +02:00
parent cecbc9d41b
commit 8b16a2b03d

View File

@ -22,6 +22,11 @@ set DAPI "https://api.deezer.com/search/album"
set UA "search-deezer.fish/v0.0.3"
while read -l -d (printf '\t') ORG A T C B F E Y
if test -z "$A"; or test -z "$T"
echo "WARN: Skipping empty artist / title input"
continue
end
set _in_A "$A"; set _in_T "$T"; set _in_C "$C";
set _in_B "$B"; set _in_F "$F"; set _in_E "$E"; set _in_Y "$Y"
@ -53,6 +58,15 @@ while read -l -d (printf '\t') ORG A T C B F E Y
continue
end
if test "$API_COUNT" = "null"
begin
echo "ERR: API result has no total count"
echo $ORG
end >&2
rm "$API_OUT"
continue
end
if test $API_COUNT -eq 0
echo '{}' | jq -SMc --arg rls "$ORG" --arg api_count "$API_COUNT" \
--arg a "$_in_A" --arg t "$_in_T" --arg c "$_in_C" \