|
|
@ -5,16 +5,29 @@ from create_db import Card |
|
|
|
from get_files import get_file_list |
|
|
|
from config import CONFIG |
|
|
|
|
|
|
|
import nextcloud_client |
|
|
|
|
|
|
|
engine = create_engine(CONFIG['DB_CONNECTION']) |
|
|
|
dbsessionmaker = sessionmaker(bind=engine) |
|
|
|
dbsession = dbsessionmaker() |
|
|
|
|
|
|
|
|
|
|
|
stuff = get_file_list() |
|
|
|
for item in stuff: |
|
|
|
if item[-4:] == ".pdf": |
|
|
|
card = Card(title=item, interest_rate=-1.0, owner_id=1) |
|
|
|
nc = nextcloud_client.Client('https://obzorje.kompot.si') |
|
|
|
|
|
|
|
nc.login('gia', 'gia0000!') |
|
|
|
|
|
|
|
|
|
|
|
l = nc.list("/GIA CLOUD") |
|
|
|
|
|
|
|
|
|
|
|
#stuff = get_file_list() |
|
|
|
for item in l: |
|
|
|
if item.get_name()[-4:] == ".pdf": |
|
|
|
name = item.get_name() |
|
|
|
|
|
|
|
public_share = nc.share_file_with_link("/GIA CLOUD/"+name) |
|
|
|
public_link = public_share.get_link()+"/download/"+name |
|
|
|
card = Card(title=name, interest_rate=-1.0, owner_id=1, item_location=public_link) |
|
|
|
dbsession.add(card) |
|
|
|
dbsession.commit() |
|
|
|
|
|
|
|