Мой проект на выходные

Albertas Agejevas

Проблема

Вернулся с 5-го ДР соседского сына

Его мама просит поделиться!

Куда класть? Picasa?

Easy!

Упс...

$ apt-cache search picasa

$ apt-cache search picasa
libgdata1.4-cil - Google GData CLI client library
monodoc-gdata-manual - compiled XML documentation for GData
python-gdata - Google Data Python client library
syncropated - An application for syncing music player playlists with mass storage devices
kipi-plugins - image manipulation/handling plugins for KIPI aware programs
$ apt-cache search picasa
libgdata1.4-cil - Google GData CLI client library
monodoc-gdata-manual - compiled XML documentation for GData
python-gdata - Google Data Python client library
syncropated - An application for syncing music player playlists with mass storage devices
kipi-plugins - image manipulation/handling plugins for KIPI aware programs

Поищем...

О, спасибо.

Прошло 10 минут...

#!/usr/bin/env python
"""upicasa.py -- an upload script for PicasaWeb"""
import sys
import gdata.photos.service
import gdata.media
import gdata.geo

EMAIL = 'xxxx.xxxx@gmail.com'
PASSWORD = 'XXXXX'

def main():
    gd_client = gdata.photos.service.PhotosService()
    gd_client.email = EMAIL
    gd_client.password = PASSWORD
    gd_client.source = 'alga-upicasa-1'
    print "Authenticating..."
    gd_client.ProgrammaticLogin()

    ...
def main():
    gd_client = gdata.photos.service.PhotosService()
    gd_client.email = EMAIL
    gd_client.password = PASSWORD
    gd_client.source = 'alga-upicasa-1'
    print "Authenticating..."
    gd_client.ProgrammaticLogin()

    album_id = '123123123123132123'
    album_url = '/data/feed/api/user/%s/albumid/%s' % (
        EMAIL, album_id)
    for photo in sys.argv[1:]:
        print "uploading", photo
        photo = gd_client.InsertPhotoSimple(
            album_url, 'New Photo', 
            '', # title 
            photo, content_type='image/jpeg')
    album_id = '123123123123132123'
    album_url = '/data/feed/api/user/%s/albumid/%s' % (
        EMAIL, album_id)
    for photo in sys.argv[1:]:
        print "uploading", photo
        photo = gd_client.InsertPhotoSimple(
            album_url, 'New Photo', 
            '', # title 
            photo, content_type='image/jpeg')


if __name__ == '__main__':
    main()

Все радуются фотками

Стоп!

Прошла пара выходных...

Ура!

Open Sourced



Прошла пара дней...

Fan mail!

Hi Albertas,

I wanted to drop you a line to say I love upicasa, and it's working
great for me.  The only issue I had -- which I didn't think was worth
forking/pull-requesting on bitbucket -- was that in upicasa.py:

http://bitbucket.org/alga/upicasa/src/tip/upicasa.py#cl-60

I think both "EMAIL" and "PASSWORD" should be lowercase.

Thanks again for this handy piece of software!  We're using it to
actually upload images made from big computer simulations, and it's
super handy to be able to do this remotely without bringing the images
back, uploading them, etc etc etc.

Best,

Matt

Небольшой комментарий

Мы живем в XXI веке

SICP

SICP -- история

In 1980, computer engineering was based on starting with clearly-defined things (primitives or small programs) and using them to build larger things that ended up being clearly-defined. Composition of these fragments was the name of the game.

However, nowadays, a real engineer is given a big software library, with a 300-page manual that’s full of errors. He’s also given a robot, whose exact behavior is extremely hard to characterize (what happens when a wheel slips?). The engineer must learn to perform scientific experiments to find out how the software and hardware actually work, at least enough to accomplish the job at hand. Gerry pointed out that we may not like it this way (“because we’re old fogies”), but that’s the way it is, and M.I.T. has to take that into account.

-- http://danweinreb.org/blog/why-did-mit-switch-from-scheme-to-python

Всё

Albertas Agejevas <alga@pov.lt>