Created
April 12, 2022 12:07
-
-
Save geolaw/009a5014dbd11d244617c56ee04b5341 to your computer and use it in GitHub Desktop.
Watch xclip clipboard for http links, shove them into a sqlite database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -f | |
# capture URLS from the clipboard and push them into the urls sqlite db | |
while [ 1 ]; do | |
t=`xclip -o ` | |
echo "clip board is $t" | |
echo $t | grep http > /dev/null | |
if [ "$?" == "0" ]; then | |
# query the database to see if its already there | |
uid=$(sqlite3 ~/urls.db "select uid from urls where url='$t';") | |
if [ "$uid" == "" ]; then | |
sqlite3 ~/urls.db "insert into urls (url) values ('$t');" | |
notify-send "Added $t to download db" | |
fi | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment