Beispiel #1
0
def loader():
    chunk = 120
    try:
        after = int(request.form["after"]) + 1
    except:
        after = 0

    setid = request.form["set"]

    if after == 0:
        header = eol.get_metadata(setid)
    else:
        header = None

    data = eol.show_photos(setid, chunk, after)

    if len(data) == 0:
        if request.form["infinite"] == "true":
            setid = eol.get_next_set(setid)
            if not setid:
                return render_template('loader.html')
            data = eol.show_photos(setid, chunk, 0)
            after = 0
            header = eol.get_metadata(setid)
        else:
            return render_template('loader.html')

    # Debug
    # print setid, after, len(data)

    images = []

    for i, d in enumerate(data):
        url = d['thumb']
        iid = after + i
        images.append({
            "id": iid,
            "url": url,
            "m": d['m'],
            "r": d['r'],
            "f": d['f']
        })

    # Simulate netowork delay
    #time.sleep(0.85)
    return render_template('loader.html',
                           header=header,
                           setid=setid,
                           images=images)
Beispiel #2
0
def showset(setid):
    setid = 'eol-'+str(setid)
    header = eol.get_metadata(setid)
    return render_template('update.html', sitename=GLOBALS["sitename"]
                                       , title="Recent ISS Photographs"
                                       , links=[{"title": "All Images", "url": "/"}, {"title": "About", "url": "/about.html"}]
                                       , setname=header
                                       , setid=setid)
Beispiel #3
0
def loader():
    chunk = 120
    try:
        after = int(request.form["after"]) +1
    except:
        after = 0

    setid = request.form["set"]

    if after == 0:
        header = eol.get_metadata(setid)
    else:
        header = None

    data = eol.show_photos(setid, chunk, after)

    if len(data) == 0:
        if request.form["infinite"] == "true":
            setid = eol.get_next_set(setid)
            if not setid:
                return render_template('loader.html')
            data = eol.show_photos(setid, chunk, 0)
            after = 0
            header = eol.get_metadata(setid)
        else:
            return render_template('loader.html')

    # Debug
    # print setid, after, len(data)

    images = []

    for i, d in enumerate(data):
        url = d['thumb']
        iid = after + i
        images.append({"id": iid, "url": url, "m": d['m'], "r": d['r'], "f":d['f']})

    # Simulate netowork delay
    #time.sleep(0.85)
    return render_template('loader.html', header=header
                                        , setid=setid
                                        , images=images)
Beispiel #4
0
def showset(setid):
    setid = 'eol-' + str(setid)
    header = eol.get_metadata(setid)
    return render_template('update.html',
                           sitename=GLOBALS["sitename"],
                           title="Recent ISS Photographs",
                           links=[{
                               "title": "All Images",
                               "url": "/"
                           }, {
                               "title": "About",
                               "url": "/about.html"
                           }],
                           setname=header,
                           setid=setid)