/ Published in: Bash

Expand |
Embed | Plain Text
#!/bin/bash #returns source image location and thumbnail location #Usage: picasa.sh /path/to/pic [Pic Name Shown In Album] my_pic="$1" [ -z "$2" ] && pic_title=`basename $"my_pic"` || pic_title="$2" pic_type=`file -b --mime-type "$my_pic"` #Your google account and password username= password= auth_key=$( curl -s https://www.google.com/accounts/ClientLogin -d Email="$username"@gmail.com -d Passwd="$password" -d accountType=GOOGLE -d source=Google-cURL-Example -d service=lh2 | awk -F\= '/^Auth=/{print $2}' ) album_xml=$( curl -s --header "Authorization: GoogleLogin auth=$auth_key" "http://picasaweb.google.com/data/feed/api/user/default" | sed 's/.*<link rel='"'"'self'"'"' type='"'"'application\/atom+xml'"'"' href='"'"'\([^'"'"']*\).*/\1/' | sed 's/entry/feed/' ) curl -s --request POST --data-binary "@$my_pic" --header "Slug: $pic_title" --header "Content-Type: $pic_type" --header "Authorization: GoogleLogin auth=$auth_key" "$album_xml" | sed 's/.*media:content url='"'"'\([^'"'"']*\).*media:thumbnail url='"'"'\([^'"'"']*\).*/\1\n\2/'
You need to login to post a comment.