This file contains 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 | |
MY_PIC="$1" ## filename of the picture to upload ## | |
ALBUM_ID=6008849823888405298 # ID of picasaweb album | |
PIC_TITLE=`basename $MY_PIC` # filename w/o extension | |
PIC_TYPE=`file -b --mime-type "$MY_PIC"` | |
ACCESS_TOKEN=$(oauth2picasa.py) ## Acces token is managed with Python's script now | |
## Note that ALBUM_XML URL starts now from https:// now | |
ALBUM_XML="https://picasaweb.google.com/data/feed/api/user/$USER_ID/albumid/$ALBUM_ID" | |
URL=`curl -s --request POST --data-binary "@$MY_PIC" \ | |
--header "GData-Version: 2" --header "Slug: $PIC_TITLE" \ | |
--header "Content-Type: $PIC_TYPE" -H "Authorization: Bearer $ACCESS_TOKEN" $ALBUM_XML | \ | |
sed 's/.*media:content url='"'"'\([^'"'"']*\).*media:thumbnail url='"'"'\([^'"'"']*\).*/\1/'` | |
echo $URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment