Skip to content

Instantly share code, notes, and snippets.

Created February 11, 2013 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brokendish/4753988 to your computer and use it in GitHub Desktop.
Save brokendish/4753988 to your computer and use it in GitHub Desktop.
Picasaウエブアルバムから指定されたアルバム内の全写真の詳細情報(Exif)を取得してHTMLとして出力する。 Picasaのユーザー名、パスワード、アルバム名を引数として特定のアルバムを対象とする。 出力したHTMLファイルは自分でクリックして起動する。 実行:python ユーザ名 パスワード 'アルバム名'>aaa.html
# -*- coding: utf-8 -*-
import gdata.geo
import getpass
import sys
import datetime
#実行:python ユーザ名 パスワード 'アルバム名'>aaa.html
albumname = sys.argv[3]
gd_client = = email
gd_client.password = password
gd_client.source = 'exampleCo-exampleApp-1'
albumid = ""
albums = gd_client.GetUserFeed(user=username)
for album in albums.entry:
if album.title.text == albumname:
albumid = album.gphoto_id.text
photos = gd_client.GetFeed(
'/data/feed/api/user/%s/albumid/%s?kind=photo' % (
username, albumid))
print '<html xmlns="" lang="ja">'
print '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'
print '<body bgcolor="#585858" text="#E6D2B1"></body>'
print '<style type="text/css">'
print 'td, th { border: 1px #857464 solid; }'
print 'table { border: 1px #555555 solid; }'
print '.aa{ background-color: #39303A; }'
print '</style>'
print '<h2>Picasa WebAlbum -- %s</h2>' % (sys.argv[3])
for photo in photos.entry:
print '<table>'
print '<tr><td><a href="%s"><img src="%s"/></a></td>' % (photo.content.src,[2].url)
print '<td><table>'
print '<tr><td>%s\n</td></tr>' % (photo.summary.text)
if photo.exif.make and photo.exif.model:
camera = '%s %s' % (photo.exif.make.text, photo.exif.model.text)
exposure = '%s' % (photo.exif.exposure.text)
flash = '%s' % (photo.exif.flash.text)
focallength = '%s' % (photo.exif.focallength.text)
fstop = '%s' % (photo.exif.fstop.text)
iso = '%s' % (photo.exif.iso.text)
make = '%s' % (photo.exif.make.text)
model = '%s' % (photo.exif.model.text)
time = '%s' %
camera = 'unknown'
print '<tr><td class="aa">camera:<td>%s\n</td></td></tr>' % (camera)
print '<tr><td class="aa">メーカ(make):<td>%s\n</td></td></tr>' % (make)
print '<tr><td class="aa">モデル(model):<td>%s\n</td></td></tr>' % (model)
print '<tr><td class="aa">ISO:<td>%s\n</td></td></tr>' % (iso)
print '<tr><td class="aa">絞り(fstop):<td>%s\n</td></td></tr>' % (fstop)
print '<tr><td class="aa">露出(exposure):<td>%s\n</td></td></tr>' % (exposure)
print '<tr><td class="aa">レンズ焦点距離(focallength):<td>%s\n</td></td></tr>' % (focallength)
print '<tr><td class="aa">フラッシュ(flash):<td>%s\n</td></td></tr>' % (flash)
print '<tr><td class="aa">日時(time):<td>%s\n</td></td></tr>' % (time)
print '</table></td>'
print '</tr>'
print '</table>'
print '<br>'
print '<h2>-------------------Other Album----------------------</h2>'
albums = gd_client.GetUserFeed(user=username)
print '<table>'
for album in albums.entry:
print '<tr><td class="aa">title:</td><td>%s</td><td class="aa">number of photos:</td><td>%s</td><td class="aa"> id:</td><td>%s</td></tr>' % (album.title.text,
album.numphotos.text, album.gphoto_id.text)
print '</table>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment