コード例 #1
0
ファイル: views.py プロジェクト: advatar/thevault
def archive(archive_id, item=None):
    if item is None:
        return abort(404)
    archive = get_archive('facebook_app', archive_id)

    data = get_archive_file("facebook_app", archive.filename)

    reverse = True
    sort_key = "id"

    if item == "albums":
        albums = [album for k, album in data['albums'].iteritems() if len(album['photos']) > 0]
        data['albums'] = albums
        sort_key = "created_time"
    elif item == "friends":
        sort_key = "name"
        reverse = False
    elif item == "statuses":
        sort_key = "updated_time"
    elif item == "events":
        sort_key = "start_time"
    elif item == "photos":
        sort_key = "created_time"

    try:
        requested_data = sorted(data[str(item)], key=itemgetter(sort_key), reverse=reverse)
    except KeyError, e:
        requested_data = {}
コード例 #2
0
ファイル: views.py プロジェクト: advatar/thevault
def archive_albums(archive_id):
    archive = get_archive('picasaweb_app', archive_id)
    data = get_archive_file('picasaweb_app', archive.filename)

    #logger.debug('%r', data['albums'])
    profile = get_settings('picasaweb_app')
    page, per_page = get_pagination_params(request, default_per_page=28)

    albums = Paginator(data['albums'], page=page, per_page=per_page)

    return render_template('picasaweb_app/albums.html',
            albums=albums,
            archive_id=archive.id,
            profile=profile['profile'])
コード例 #3
0
ファイル: views.py プロジェクト: advatar/thevault
def archive_photo(archive_id, photo_id):
    archive = get_archive('facebook_app', archive_id)
    data = get_archive_file('facebook_app', archive.filename)

    page, per_page = get_pagination_params(request, default_per_page=1)

    preference = get_settings('facebook_app')

    photos = sorted(data['photos'], key=itemgetter('created_time'), reverse=True)
    photos = PhotoPaginator(photos, photo_id)

    return render_template('facebook_app/photo.html',
            archive_id=archive_id,
            photos=photos,
            profile=preference['profile'])
コード例 #4
0
ファイル: views.py プロジェクト: advatar/thevault
def archive(archive_id):
    archive = get_archive('google_contacts_app', archive_id)
    atom_data = get_archive_file("google_contacts_app", archive.filename)

    data = gdata.contacts.ContactsFeedFromString(atom_data.ToString())

    profile = get_settings("google_contacts_app")
    page, per_page = get_pagination_params(request)

    contacts = Paginator(data.entry, page=page, per_page=per_page)

    return render_template("google_contacts_app/archive.html",
            contacts=contacts,
            archive_id=archive_id,
            profile=profile['profile'])
コード例 #5
0
ファイル: views.py プロジェクト: advatar/thevault
def archive_album(archive_id, album_id):
    archive = get_archive('facebook_app', archive_id)
    data = get_archive_file("facebook_app", archive.filename)

    page, per_page = get_pagination_params(request, default_per_page=28)
    photos = sorted(data['albums'][album_id]['photos'].values(), key=itemgetter('created_time'), reverse=True)
    photos = Paginator(photos, page, per_page)

    preference = get_settings('facebook_app')

    return render_template("facebook_app/album_photos.html",
            archive_id=archive_id,
            album_id=album_id,
            album=data['albums'][album_id],
            photos=photos,
            profile=preference['profile'])
コード例 #6
0
ファイル: views.py プロジェクト: advatar/thevault
def archive_album(archive_id, album_id):
    archive = get_archive('picasaweb_app', archive_id)
    data = get_archive_file('picasaweb_app', archive.filename)

    profile = get_settings('picasaweb_app')
    page, per_page = get_pagination_params(request, default_per_page=28)
    photos = sorted(data['albums'][album_id]['photos'].values(), key=itemgetter('published'), reverse=True)

    photos = Paginator(photos, page, per_page)

    return render_template('picasaweb_app/album.html',
            archive_id=archive_id,
            album_id=album_id,
            album=data['albums'][album_id],
            photos=photos,
            profile=profile['profile'])