snippets/bandcamping

32 lines
725 B
Plaintext
Raw Normal View History

2021-04-01 23:55:11 +02:00
#!/bin/bash
set -eu
tag="$1"
2021-04-02 21:19:44 +02:00
today=`date +"%Y%m%d"`
visitedDir="$HOME/.bandcamping/visited"
visited="$visitedDir/$today"
likedDir="$HOME/.bandcamping/liked"
liked="$likedDir/$today""_$tag"
mkdir -p "$visitedDir"
mkdir -p "$likedDir"
2021-04-01 23:55:11 +02:00
touch "$visited"
{ curl "https://bandcamp.com/tag/$tag?tab=all_releases&s=random" 2>/dev/null | grep -oP "https://[a-zA-Z0-9\-äöü]*?.bandcamp.com/album/.*?(?=&quot)" | while read album; do
2021-04-02 21:19:44 +02:00
if grep -rq "$album" "$visitedDir"; then
2021-04-01 23:55:11 +02:00
continue
2021-04-02 00:07:56 +02:00
fi
echo "$album"
2021-04-01 23:55:11 +02:00
surf "$album"
echo -n "Like? "
read -u 3 like
if [ "$like" == "y" ]; then
echo "$album" >> "$liked"
2021-04-02 00:07:56 +02:00
echo "added to $liked"
2021-04-01 23:55:11 +02:00
fi
echo "$album" >> "$visited"
done; } 3<&0