Example #1
0
def add_file(new_file_info):
    dbpath = osp.join(root_dir, config.wallet.dbpath)
    engine = create_engine('sqlite:///{dbpath}'.format(dbpath=dbpath),
                           echo=True)
    Session = sessionmaker(bind=engine)
    session = Session()
    session.add(new_file_info)
    session.commit()
Example #2
0
def get_file_list():
    """This returns a list of files.
    """
    dbpath = join_with_rc(config.wallet.dbpath)
    engine = create_engine('sqlite:///{dbpath}'.format(dbpath=dbpath),
                           echo=True)
    Session = sessionmaker(bind=engine)
    session = Session()
    return session.query(FileInfo).all()
Example #3
0
def publish_file_update(market_hash, selected_id):
    dbpath = osp.join(root_dir, config.wallet.dbpath)
    engine = create_engine('sqlite:///{dbpath}'.format(dbpath=dbpath),
                           echo=True)
    Session = sessionmaker(bind=engine)
    session = Session()
    session.query(FileInfo).filter(FileInfo.id == selected_id + 1). \
        update({FileInfo.market_hash: market_hash, FileInfo.is_published: True}, synchronize_session=False)
    session.commit()