Documentation ¶
Overview ¶
Package picago contains functions for downloading albums and photos from Picasa Web. Implemented from scratch following https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol?hl=en .
Index ¶
- Variables
- func Authorize(ID, secret string) error
- func DownloadPhoto(client *http.Client, url string) (io.ReadCloser, error)
- func NewAuthorizeHandler(transport *oauth.Transport, donech chan<- struct{}) http.HandlerFunc
- func NewClient(id, secret, code, tokenCacheFilename string) (*http.Client, error)
- func NewClientCache(id, secret, code string, cache oauth.Cache) (*http.Client, error)
- func NewTransport(id, secret string, cache oauth.Cache) (*oauth.Transport, error)
- type Album
- type Atom
- type Author
- type Entry
- type EntryContent
- type Exif
- type Link
- type Media
- type MediaContent
- type Photo
- type User
Constants ¶
This section is empty.
Variables ¶
var DebugDir = os.Getenv("PICAGO_DEBUG_DIR")
var ErrCodeNeeded = errors.New("Authorization code is needed")
Functions ¶
func Authorize ¶
Authorize authorizes using OAuth2 the ID and secret strings can be acquired from Google for the application https://developers.google.com/accounts/docs/OAuth2#basicsteps
func DownloadPhoto ¶
DownloadPhoto returns an io.ReadCloser for reading the photo bytes
func NewAuthorizeHandler ¶
func NewAuthorizeHandler(transport *oauth.Transport, donech chan<- struct{}) http.HandlerFunc
NewAuthorizeHandler returns a http.HandlerFunc which will set the Token of the given oauth.Transport and send a struct{} on the donech on success.
func NewClient ¶
NewClient returns an authorized http.Client usable for requests, caching tokens in the given file.
func NewClientCache ¶
For redirect_uri, see https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi .
NewClientCache returns an authorized http.Client with the given oauth.Cache implementation
Types ¶
type Album ¶
type Album struct { // ID is the stable identifier for an album. // e.g. "6041693388376552305" ID string // Name appears to be the Title, but with spaces removed. It // shows up in URLs but is not a stable // identifier. e.g. "BikingWithBlake" Name string // Title is the title of the album. // e.g. "Biking with Blake" Title string // Description is the Picasaweb "Description" field, and does // not appear available or shown in G+ Photos. It may be // contain newlines. Description string // Location is free-form location text. e.g. "San Bruno Mountain" Location string // URL is the main human-oriented (HTML) URL to the album. URL string // Published is the either the time the user actually created // and published the gallery or (in the case of Picasaweb at // least), the date that the user set on the gallery. It will // be at day granularity, but the hour will be adjusted based // on whatever timezone the user is it. For instance, setting // July 21, 2014 while in California results in a time of // 2014-07-21T07:00:00.000Z since that was the UTC time at // which it became July 21st in US/Pacific on that day. Published time.Time // Updated is the server time any property of the gallery was // changed. It appears to be at millisecond granularity. Updated time.Time AuthorName, AuthorURI string }
An Album is a collection of Picasaweb or Google+ photos.
type Atom ¶
type Atom struct { ID string `xml:"id"` Name string `xml:"name"` Updated time.Time `xml:"updated"` Title string `xml:"title"` Subtitle string `xml:"subtitle"` Icon string `xml:"icon"` Thumbnail string `xml:"http://schemas.google.com/photos/2007 thumbnail"` Author Author `xml:"author"` NumPhotos int `xml:"numphotos"` StartIndex int `xml:"startIndex"` TotalResults int `xml:"totalResults"` ItemsPerPage int `xml:"itemsPerPage"` Entries []Entry `xml:"entry"` }
type Entry ¶
type Entry struct { ETag string `xml:"etag,attr"` EntryID string `xml:"http://www.w3.org/2005/Atom id"` ID string `xml:"http://schemas.google.com/photos/2007 id"` Published time.Time `xml:"published"` Updated time.Time `xml:"updated"` Name string `xml:"http://schemas.google.com/photos/2007 name"` Title string `xml:"title"` Summary string `xml:"summary"` Links []Link `xml:"link"` Author Author `xml:"author"` Location string `xml:"http://schemas.google.com/photos/2007 location"` NumPhotos int `xml:"numphotos"` Content EntryContent `xml:"content"` Media *Media `xml:"group"` Exif *Exif `xml:"tags"` Point string `xml:"where>Point>pos"` }
type EntryContent ¶
type Media ¶
type Media struct { Title string `xml:"http://search.yahoo.com/mrss title"` Description string `xml:"description"` Keywords string `xml:"keywords"` Content []MediaContent `xml:"content"` Thumbnail []MediaContent `xml:"thumbnail"` }
type MediaContent ¶
type Photo ¶
type Photo struct { // ID is the stable identifier for the photo. ID string // Filename is the image's filename from the Atom title field. Filename string // Description is the caption of the photo. Description string Keywords []string Published, Updated time.Time // Latitude and Longitude optionally contain the GPS coordinates // of the photo. Latitude, Longitude float64 // Location is free-form text describing the location of the // photo. Location string // URL is the URL of the photo or video. URL string // PageURL is the URL to the page showing just this image. PageURL string // Type is the Content-Type. Type string // Position is the 1-based position within a gallery. // It is zero if unknown. Position int Exif *Exif }
A Photo is a photo (or video) in a Picasaweb (or G+) gallery.