diff --git a/search-deezer-api.fish b/search-deezer-api.fish index a597c4f..6349f68 100755 --- a/search-deezer-api.fish +++ b/search-deezer-api.fish @@ -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" \