From a93ff0e3e6f010087896975f2ba5d5d5b4f78397 Mon Sep 17 00:00:00 2001 From: louie Date: Wed, 24 Feb 2021 13:04:54 -0800 Subject: Fixed packages that do not have screenshots --- pkg-screenshot.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg-screenshot.sh') diff --git a/pkg-screenshot.sh b/pkg-screenshot.sh index a10fd05..d9f5f8c 100755 --- a/pkg-screenshot.sh +++ b/pkg-screenshot.sh @@ -20,6 +20,8 @@ case $1 in URL=`wget -qO- https://screenshots.debian.net/json/package/$2 | jq '.screenshots[0].large_image_url' | tr -d \"` if [ -z $URL ]; then echo "Error: Package \"$2\" does not exist" + elif [ $URL = "null" ]; then + echo "Error: Package \"$2\" does not have any screenshots available" else xdg-open $URL fi @@ -34,6 +36,8 @@ case $1 in URL=`wget -qO- https://screenshots.debian.net/json/package/$1 | jq '.screenshots[0].large_image_url' | tr -d \"` if [ -z $URL ]; then echo "Error: Package \"$1\" does not exist" + elif [ $URL = "null" ]; then + echo "Error: Package \"$1\" does not have any screenshots available" else EXTENSION=`echo $URL | rev | cut -d . -f 1 | rev` wget -qO /tmp/pkg-screenshot.$EXTENSION $URL -- cgit