def image_view(ind=None, ind2=None): pager = Pager( db.engine.execute('select count(cameraid) from cameras').scalar()) data = Camera.query.filter_by(cameraid=ind).first() images = Image.query.filter_by(cameraid=ind).order_by( Image.curr_time.asc()).all() pager2 = Pager(len(images)) #new way #need to get filepath --> 19/19_20180625_132516.jpg main_path = "./static/images/" + str(ind).zfill(8) all_files = [ f for f in os.listdir(main_path) if isfile(join(main_path, f)) ] print("File list:") print(all_files[:5]) try: if ind2 >= pager2.count or ind >= pager.count: flash('Image did not exist') return render_template('dirview.html', index=ind, pager=pager) else: pager.current = ind pager2.current = ind2 filepath = str(ind).zfill(8) + "/" + all_files[ ind2] #getting the next image print("Indexs: " + str(ind) + " " + str(ind2)) print("Filepath: " + filepath) return render_template('imageview.html', index=ind2, pager=pager, pager2=pager2, data2=images[ind2], data=data, filepath=filepath) except IndexError as e: return render_template('404.html')
def image_view(ind=None): table = read_table(TABLE_FILE) pager = Pager(len(table)) if ind >= pager.count: return render_template("404.html"), 404 else: pager.current = ind return render_template('imageview.html', index=ind, pager=pager, data=table[ind])
def image_view(sess=None, ind=None): if sess not in SESSIONS.keys(): return render_template("404.html"), 404 table = read_table(SESSIONS[sess]) # print(len(table)) pager = Pager(len(table)) if ind >= pager.count: return render_template("404.html"), 404 else: pager.current = ind return render_template('imageview.html', index=ind, pager=pager, cluster=table[ind]['cluster'], sess=sess)
def map_view(map_ind): global groupPager global photoPager global table_group if map_ind >= groupPager.count: return render_template("404.html"), 404 else: time_group = filter_cluster(timestamps, map_ind, cluster_labels) table_group = sort_cluster( filter_cluster(table, map_ind, cluster_labels), time_group) # set photo pager to only page through images contained in group photoPager = Pager(len(table_group)) photoPager.current = 0 groupPager.current = map_ind group_locs = filter_cluster(locations, map_ind, cluster_labels) group_colors = filter_cluster(cluster_colors, map_ind, cluster_labels) folium_map = get_map(group_locs, save=True, colors=group_colors) return render_template('map_view.html', groupPager=groupPager, photoPager=photoPager)