test that API response contains total
This commit is contained in:
parent
cecbc9d41b
commit
8b16a2b03d
@ -22,6 +22,11 @@ set DAPI "https://api.deezer.com/search/album"
|
|||||||
set UA "search-deezer.fish/v0.0.3"
|
set UA "search-deezer.fish/v0.0.3"
|
||||||
|
|
||||||
while read -l -d (printf '\t') ORG A T C B F E Y
|
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_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"
|
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
|
continue
|
||||||
end
|
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
|
if test $API_COUNT -eq 0
|
||||||
echo '{}' | jq -SMc --arg rls "$ORG" --arg api_count "$API_COUNT" \
|
echo '{}' | jq -SMc --arg rls "$ORG" --arg api_count "$API_COUNT" \
|
||||||
--arg a "$_in_A" --arg t "$_in_T" --arg c "$_in_C" \
|
--arg a "$_in_A" --arg t "$_in_T" --arg c "$_in_C" \
|
||||||
|
Loading…
Reference in New Issue
Block a user