Skip to content

Instantly share code, notes, and snippets.

@rewida17
Last active June 15, 2018 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rewida17/73d57d95a40e11e55f8041f01de68e8f to your computer and use it in GitHub Desktop.
Save rewida17/73d57d95a40e11e55f8041f01de68e8f to your computer and use it in GitHub Desktop.
#!/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