Browse Source

test that API response contains total

master
bux 2 years ago
parent
commit
8b16a2b03d
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      search-deezer-api.fish

+ 14
- 0
search-deezer-api.fish 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" \


Loading…
Cancel
Save