summaryrefslogtreecommitdiff
path: root/webgut
diff options
context:
space:
mode:
authornikolaus <nikolaus@fishbox.fritz.box>2023-02-18 08:22:06 +0100
committernikolaus <nikolaus@fishbox.fritz.box>2023-02-18 08:22:06 +0100
commit6aaeba4e7934dfbfcf369fcfb24b1bf12979ef9e (patch)
tree703aa1c3b405d5f726f83d342859dfa131a98ce8 /webgut
parent1b14056883dc6bb267e710edf1fe6acbd84b6d79 (diff)
Improving the webgut-script.HEADmaster
Diffstat (limited to 'webgut')
-rwxr-xr-xwebgut33
1 files changed, 12 insertions, 21 deletions
diff --git a/webgut b/webgut
index 8b916bd..ba2a195 100755
--- a/webgut
+++ b/webgut
@@ -2,15 +2,11 @@
if [ -z "$1" ]
then
rm -rf ~/.cache/webgut/thumbnails/*
-#export list="~/.cache/webgut/list"
-#export thumlist="~/.cache/webgut/thumlist"
rm ~/.cache/webgut/list & touch ~/.cache/webgut/list &
-#chmod 775 ~/.cache/webgut/* &
echo "What do you want to search?" &&
-read resp &&
-rm .cache/webgut/resp && echo $resp >> ~/.cache/webgut/resp &&
-query=$(cat ~/.cache/webgut/resp | gsed 's/ /+/g') &&
- curl https://y.com.sb/api/v1/search?q="$query" \
+read resp
+query=$(echo $resp | gsed 's/ /+/g') &&
+ curl -s https://y.com.sb/api/v1/search?q="$query" \
| gsed 's/,"/\n"/g' \
| gsed 's/^\s//g' \
| gsed 's/^[A-Za-z].*$//g' \
@@ -23,25 +19,20 @@ query=$(cat ~/.cache/webgut/resp | gsed 's/ /+/g') &&
| gsed 's/\*\*_/\*\*/g' \
>>~/.cache/webgut/list
-#rm ~/.cache/webgut/thumlist & touch ~/.cache/webgut/thumlist &
-# cat ~/.cache/webgut/list | grep 'https://.*/default.jpg' \
-# | gsed -e 's/"url":"//g' \
-# | gsed -e 's/"$//g' >> ~/.cache/webgut/thumlist
-
-
-
+sp='/-\|'
for line in $(cat ~/.cache/webgut/list)
do
name=$(echo $line | gawk -F '***' '{print($1)}')
-# link=$(echo $line | gawk -F '***' '{print($2)}')
thumbnail=$(echo $line | gawk -F '***' '{print($3)}')
-# echo $name
-# echo $link
-# echo $thumbnail
- curl --create-dirs --output ~/.cache/webgut/thumbnails/$name.jpg $thumbnail &
+ curl -s --create-dirs --output ~/.cache/webgut/thumbnails/$(echo $name | sed 's/\//\ /g').jpg $thumbnail &
done &&
- sleep 10
- [ $(ls ~/.cache/webgut/thumbnails | wc -l) -gt 20 ] && nsxiv -t ~/.cache/webgut/thumbnails/*
+ printf 'Starting image download.\n'
+ printf ' Loading images' & while [ $(ls ~/.cache/webgut/thumbnails | wc -l) -le 22 ]; do
+ printf '\r\b %.1s' "$sp"
+ sp=${sp#?}${sp%???}
+ sleep 0.1
+ done &&
+ nsxiv -t ~/.cache/webgut/thumbnails/*
else
videoId=$(cat ~/.cache/webgut/list | grep $1 | gawk -F '***' '{print($2)}')
videoUrl=https://yewtu.be/watch/?v=$videoId