Example #1
0
def archives():
    page, per_page = get_pagination_params(request)
    profile = get_settings("google_contacts_app")

    if not profile:
        logger.debug("no profile found. google_contacts_app was not setup")
        return redirect(url_for('preferences'))

    archives = get_paginated_archives("google_contacts_app", page, per_page)

    return render_template("google_contacts_app/archives.html",
            archives=archives,
            profile=profile['profile'])
Example #2
0
def archives():
    page, per_page = get_pagination_params(request) 
    profile = get_settings("facebook_app")

    if not profile:
        logger.debug('no archive found. facebook_app is not set up')
        return redirect(url_for("preferences"))
    
    archives = get_paginated_archives("facebook_app", page, per_page)

    return render_template("facebook_app/archives.html",
            archives=archives,
            profile=profile['profile'])
Example #3
0
def archives():
    page, per_page = get_pagination_params(request)
    profile = get_settings('picasaweb_app')

    if not profile:
        logger.debug('no profile found. picasaweb was not setup')
        return redirect(url_for('preferences'))

    archives = get_paginated_archives('picasaweb_app', page, per_page)

    return render_template('picasaweb_app/archives.html',
            archives=archives,
            profile=profile['profile'])
Example #4
0
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'])
Example #5
0
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'])
Example #6
0
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'])
Example #7
0
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'])
Example #8
0
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'])
Example #9
0
        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 = {}

    profile = get_settings("facebook_app")
    page, per_page = get_pagination_params(request)
    if item == "albums":
        per_page = 28
    return render_template("facebook_app/%s.html" % item,
            **{str(item): Paginator(requested_data, page, per_page),
                "archive_id": archive_id,
                "profile": profile['profile']})


@module.route("/archives/<archive_id>/albums/<album_id>/photos")
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)