Beispiel #1
0
def get_paginator(album, page, endpoint, template):
    show = Show(album)

    if len(show.data['files']) == 0:
        abort(404)

    files = show.data['files']

    if show.get_setting('reverse') == 'yes':
        files.reverse()

    p = Paginator(album, files, current_app.config['THUMBNAILS_PER_PAGE'], page, endpoint, template)
    return p
Beispiel #2
0
def get_paginator(album, page, endpoint, template):
    show = Show(album, current_app.config, session)

    if len(show.data['files']) == 0:
        abort(404)

    files = show.data['files']

    if show.get_setting('reverse') == 'yes':
        files.reverse()

    try:
        return Paginator(album, files, current_app.config['THUMBNAILS_PER_PAGE'], page, endpoint, template)
    except:
        abort(404)
Beispiel #3
0
def _paginated_overview(album, page, endpoint='admin.list', template='grid'):
    show = Show(album, current_app.config, session)
    files = os.listdir(os.path.join(current_app.config['ALBUMS_DIR'], album))

    ext = re.compile(".(jpg|png|gif|bmp)$", re.IGNORECASE)
    files = [f for f in files if ext.search(f)]

    if len(files) == 0:
        abort(404)

    files.sort()

    if show.get_setting('reverse') == 'yes':
        files.reverse()

    try:
        return Paginator(album, files, current_app.config['THUMBNAILS_PER_PAGE'], page, endpoint, template)
    except:
        abort(404)
Beispiel #4
0
def _paginated_overview(album, page, endpoint='admin.list', template='grid'):
    show = Show(album, current_app.config, session)
    files = os.listdir(os.path.join(current_app.config['ALBUMS_DIR'], album))

    ext = re.compile(".(jpg|png|gif|bmp)$", re.IGNORECASE)
    files = [f for f in files if ext.search(f)]

    #if len(files) == 0:
        #abort(404)

    files.sort()

    if show.get_setting('reverse') == 'yes':
        files.reverse()

    try:
        return Paginator(album, files, current_app.config['THUMBNAILS_PER_PAGE'], page, endpoint, template)
    except:
        abort(404)
Beispiel #5
0
def list_album(album, page, template='grid'):
    show = Show(album, current_app.config, session)
    ext = re.compile(".(jpg|png|gif|bmp)$", re.IGNORECASE)

    album_dir = os.path.join(current_app.config['ALBUMS_DIR'], album)
    all_files = [f for f in os.listdir(album_dir) if ext.search(f)]
    all_files.sort()

    if show.get_setting('reverse') == 'yes':
        all_files.reverse()

    paginator = _paginated_overview(album, page, 'admin.list_album', template)
    return render_themed(template + '.html',
                         album=album,
                         show=show,
                         files=paginator.entries,
                         paginator=paginator,
                         page=page,
                         all_files=all_files)
Beispiel #6
0
def list_album(album, page, template="grid"):
    show = Show(album, current_app.config, session)
    ext = re.compile(".(jpg|png|gif|bmp)$", re.IGNORECASE)

    album_dir = os.path.join(current_app.config["ALBUMS_DIR"], album)
    all_files = [f for f in os.listdir(album_dir) if ext.search(f)]
    all_files.sort()

    if show.get_setting("reverse") == "yes":
        all_files.reverse()

    paginator = _paginated_overview(album, page, "admin.list_album", template)
    return render_themed(
        template + ".html",
        album=album,
        show=show,
        files=paginator.entries,
        paginator=paginator,
        page=page,
        all_files=all_files,
    )