Skip to content

Instantly share code, notes, and snippets.

@hrpunio
Created July 18, 2015 14:11
Show Gist options
  • Save hrpunio/31e35d0987c81029e3ce to your computer and use it in GitHub Desktop.
Save hrpunio/31e35d0987c81029e3ce to your computer and use it in GitHub Desktop.
Create album @ picasaweb
#!/bin/bash
ALBUM_TITLE="$1" # Album title
ALBUM_DESCR="$2" # Album description
Album_Keywords="$3" # Album keywords (comma separated)
ACCESS_TOKEN=$(oauth2picasa.py) ## Acces token is managed with Python's script now
MESSAGE="<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:gphoto='http://schemas.google.com/photos/2007'>
<title type='text'>$ALBUM_TITLE</title>
<summary type='text'>$ALBUM_DESCR</summary>
<media:group><media:keywords>$Album_Keywords</media:keywords></media:group>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#album'></category></entry>";
URL=`curl -s --request POST --data "$MESSAGE" \
--header "GData-Version: 2" --header "Content-Type: application/atom+xml" \
-H "Authorization: Bearer $ACCESS_TOKEN" "https://picasaweb.google.com/data/feed/api/user/default"`
echo $URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment