Last active
June 15, 2018 20:23
-
-
Save rewida17/73d57d95a40e11e55f8041f01de68e8f to your computer and use it in GitHub Desktop.
simple "wrapper" around https://git.ao2.it/conversations_http_downloader.git/blob/HEAD:/README JABBER
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 | |
#ENJOY | |
DL(){ | |
conversations_http_downloader.py "$a" | |
} | |
#We are in /tmp? | |
if ! [[ "$PWD" == '/tmp' ]] | |
then | |
echo 'Go to /tmp' | |
cd /tmp || exit | |
fi | |
#Mayby we will use this like aesgcm "aesgcm://" ? and test mayby we have this file ;) | |
if [[ $# -eq 1 ]] && [[ ! -e "$(awk -F"#" '{print $1}' <<< "$@" | awk -F "/" '{print $7}')" ]] | |
then | |
#get name of file and store it in "$REPLY" | |
read -r <<< "$(awk -F"#" '{print $1}' <<< "$@" | awk -F "/" '{print $7}')" | |
conversations_http_downloader.py "$@" | |
feh "$REPLY" | |
rm "$REPLY" | |
elif [[ $# -eq 1 ]] && [[ -e "$(awk -F"#" '{print $1}' <<< "$@" | awk -F "/" '{print $7}')" ]] | |
then | |
feh "$REPLY" | |
rm -rf "$REPLY" && echo "rm $REPLY" | |
else | |
"http://host.tld/path/to/file.jpg#theivandkey" | |
#RUN IN LOOP read link, download, open remove and again ;) | |
while true | |
do | |
echo 'Please write aesgcm://URL | |
read -r a | |
read -r <<< "$(awk -F"#" '{print $1}' <<< "$a" | awk -F "/" '{print $7}')" | |
if [ -e "$REPLY" ] | |
then | |
feh "$REPLY" | |
rm -rf "$REPLY" && echo "Removing $REPLY" | |
else #DOWNLOAD $a, open it and remove after this | |
DL "$a" | |
OP "$REPLY" | |
rm -rf "$REPLY" && echo "Removing $REPLY" | |
fi #2nd IF | |
done #WHILE | |
fi #IF inside WHILE LOOP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment