kurobyte

Upload to Twitpic

Dec 27th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.95 KB | None | 0 0
  1. #!/bin/bash
  2. #Upload to twitpic                  v1.2.12
  3. #By kurobyte <[email protected]>
  4. #   http://kuroscript.wordpress.com/
  5. #
  6. # Dependences
  7. # sendemail, zenity, libnotify
  8. #
  9. # Configure
  10. #
  11. # 1- you need to link your twitter account to twitpic and
  12. #    get your twitpicEmail in here "http://twitpic.com/account/settings"
  13. # 2- yourEmail, you need to add your email and password to give a eay
  14. #    to send the image to the twitpic
  15. # 3- userMail the name of your account, if you have a google account
  16. #    you don't need to ad all the email
  17. #    ex: "test" no google "[email protected]"
  18. # 4- Configure your smtp server depending your address.
  19. #   gmail -     smtp.gmail.com:587
  20. #   hotmail -   smtp.live.com:587
  21. #   yahoo -     smtp.mail.yahoo.com:995
  22. #
  23. #others "http://www.emailaddressmanager.com/tips/mail-settings.html"
  24. #
  25. # 5- Enjoy and comment ;)
  26. #
  27. twitpicEmail="[email protected]"
  28. yourEmail="[email protected]"
  29. yourEmailPasswd='[TOPO SECRET]'
  30. userMail="XXXXX"
  31. mailServer="smtp.gmail.com:587"
  32.  
  33. #####END OF CONFIG
  34. #
  35. # Execute
  36. #
  37.  
  38. sendFile="$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
  39. filename=$(basename "$sendFile")
  40. extension="${filename##*.}"
  41.  
  42. if [ $extension == png ] || [ $extension == jpg ] || [ $extension == gif ]
  43. then
  44. {  
  45.     twitMessage=`zenity --entry \
  46.             --title="Image Caption" \
  47.             --text="Insert the captión of the image (This will be tweeted):" \
  48.             --entry-text ""`
  49.  
  50.  
  51.     sendemail -f $yourEmail -t $twitpicEmail -u "$twitMessage" -m "Sended by Upload To twitpic, nautilus plug-in developed by Kurobyte." -s $mailServer -o tls=yes -a "`echo $sendFile`" -xu $userMail -xp "$yourEmailPasswd"
  52.     if [ $? == 0 ];
  53.     then
  54.     {
  55.         notify-send --hint=int:transient:1 --icon="$sendFile" "Image Tweeted" "Tweet: \"$twitMessage\""
  56.     }
  57.     else
  58.     {
  59.         notify-send --hint=int:transient:1 --icon="" "Problem Tweeting Image" "Something is wrong"
  60.     }
  61.     fi
  62. }
  63. else
  64. {
  65.     notify-send --hint=int:transient:1 --icon="" "Invalid image format" "Valids: .png, .jpg, .gif"
  66. }
  67. fi
Advertisement
Add Comment
Please, Sign In to add comment