~UPDATED 15-07-2010
Added ability to create album.
Photo's will be auto-rotated if EXIF information is available.
12-JUN-2010
reworked the mechanism to work with the new FBCMD.
Does not need a manual update of albumdata file (will be handled on it's own.)
If you run this on a directory, it will upload all *.jpg files in said directory.
30-MAY-09
Fixed stupid bug where the cancelling uploaded the picture anyway.Thank you Mr. Anonymous bug reporter.
It's been a while since I've posted an update, not that I suspect that anybody missed me or anything. Nonetheless I'm throwing out an obligatory apology and the explaination for it being "been busy"
anyway this is something I whipped up today that somebody might find useful. It's a nautilus script that uploads your photos to facebook. So you can just right-click on a photo and upload it there.It's fairly basic (offers multiple uploads,album-selection, no-tagging,no caption), and once again it's not completely idiot proof so I'm not taking responsibility if you muck something up.
currently this depends on the following
- libnotify (particularly notify-send)
- zenity
- imagemagick
- fbcmd (and hence php)
The script needs to go into ~/.gnome2/nautilus-scripts
Next you should setup an albumid file because it's faster if you maintain a local list). Do this by running
php fbcmd.php albums | tee ~/.fbaids
if you'd rather fetch album information from facebook everytime you can replace the line "aidlist=~/.fbaids" with "aidlist=\"$(php FBCMDPATH albums)\""
that should do it.
please note that I haven't implemented a check on weather the upload was successful or not. Also there is no filetype check so be careful.
#!/bin/bash
# AUTHOR: (c) Naail Abdul Rahman (http://kudanai.blogspot.com)
# VERSION: 1.0
# LICENSE: GPL (http://www.gnu.org/licenses/gpl.html)
# REQUIRES: libnotify, zenity, FBCMD (http://fbcmd.dtompkins.com),imagemagick
# NAME: Upload to Facebook
# DESCRIPTION: Simple nautilus script to invoke FBCMD upload functionality.
# Currently only supports pictures.Hope to adding notes as well.
# FBCMD is a command line interface to facebook by Dave Tompkins
fbcmdl=fbcmd #command to invoke fbcmd...usually just fbcmd
function notify() {
notify-send -i fbnotif UPLOADING "$@"
}
function makealbum() {
title=$(zenity --entry --title="Title?" --text="Enter Album Title (Required):")
if [ -z $title ]
then
getaid
fi
desc=$(zenity --entry --title="Description?" \
--text="Enter a description for the album (optional):\nLeave blank if you don't want to set a descroption")
location=$(zenity --entry --title="Location?" \
--text="Enter a location for the album (optional):\nLeave blank if you don't want to set a location")
privacyOpt=$(zenity --entry --title="Privacy?" \
--text="Who can see this album? (default:everyone)\n1.friends\n2.friends-of-friends\n3.networks\n4.everyone")
case $privacyOpt in
1) privacy="friends"
;;
2) privacy="friends-of-friends"
;;
3) privacy="networks"
;;
4) privacy="everyone"
;;
*) privacy="everyone"
;;
esac
notify "creating album $title"
$fbcmdl addalbum "${title}" "${desc}" "${location}" $privacy
}
function getaid() {
aid=$(zenity --entry --title="Album?" \
--text="Enter AlbumID or #\n\nenter:\n 0 for list\n l (low L) for latest\n a for new")
if [ -z $aid ];
then
echo "null value for aid - quiting"
notify "upload cancelled"
exit
else
case $aid in
0) echo "please wait, fetching album data"
$fbcmdl albums | zenity --text-info \
--title "album names and stuff" --width=600
getaid
;;
l) aid="latest"
;;
a) makealbum
echo "created album.."
aid="latest"
;;
esac
fi
}
getaid
notify "uploading photos"
for arg
do
if [ -f $arg ]
then
echo "adding regular file ${arg}"
convert -auto-orient -resize '604>' "$arg" /tmp/fbuplpictmpxx.jpg
$fbcmdl addpic /tmp/fbuplpictmpxx.jpg $aid
elif [ -d $arg ]
then
echo "uploading directory ${arg}"
$fbcmdl addpicd $arg $aid
fi
done
notify "upload finished"
exit