Exemplo n.º 1
0
    def index():
        list = db.getListOfFiles(cfg._destinationFolder, add_path=False)
        if request.method == 'GET':
            return load_pics(list, title='List of Pictures')

        else:
            payload = request.get_data().decode("utf-8")
            # only shows debug if in demo mode
            if cfg._test:
                flash(payload, 'debug')

            if request.form.get('left'):
                rotate(payload, list, 'left')
                title = 'ROTATED Pictures'

            elif request.form.get('right'):
                rotate(payload, list, 'right')
                title = 'ROTATED Pictures'

            elif request.form.get('180'):
                rotate(payload, list, '180')
                title = 'UPSIDE-DOWN Pictures'

            elif request.form.get('favorite'):
                faves = db.common(payload, list)
                flash('FAVORITED {} pics'.format(len(faves)), 'warning')
                db.append_multiple_lines('data/whitelist.txt', faves)
                title = 'FAVORITE Pictures'

            elif request.form.get('delete'):
                delete(payload, list)
                black = db.common(payload, list)
                # Check for common with whitelist
                fave_removed = db.remove_common_from_file(
                    'data/whitelist.txt', black)
                # only shows debug if in demo mode
                if cfg._test:
                    flash('Removed {} Fave pics'.format(len(fave_removed)),
                          'debug')

                flash('BLACKLISTED {} pics'.format(len(black)), 'info')
                db.append_multiple_lines('data/blacklist.txt', black)
                title = 'Remaining Pictures'

            elif request.form.get('copy_job'):
                db.copy_job()
                flash('Copy Job completed.', 'warning')
                title = 'New Set of Pictures'

            else:
                # This should never be triggered
                flash('No option selected, try again.', 'error')
                title = 'List of Pictures'

            list = db.getListOfFiles(cfg._destinationFolder, add_path=False)
            return load_pics(list, title=title)
Exemplo n.º 2
0
 def copy_job():
     db.copy_job()
     flash('Copy Job completed.', 'warning')
     title = 'New Set of Pictures'
     list = db.getListOfFiles(cfg._destinationFolder, add_path=False)
     return load_pics(list, title=title)