2023-08-27 18:52:59 +02:00
|
|
|
from create_db import Card, get_session, get_engine
|
2022-05-19 23:56:32 +02:00
|
|
|
from config import CONFIG
|
|
|
|
|
2022-06-03 19:12:14 +02:00
|
|
|
import nextcloud_client
|
2022-05-19 23:56:32 +02:00
|
|
|
|
2022-06-14 14:47:12 +02:00
|
|
|
dbsession = get_session()
|
2022-06-03 19:12:14 +02:00
|
|
|
nc = nextcloud_client.Client('https://obzorje.kompot.si')
|
|
|
|
|
2022-06-13 14:30:28 +02:00
|
|
|
nc.login(CONFIG['NC_USER'],CONFIG['NC_PASSWORD'])
|
2022-06-03 19:12:14 +02:00
|
|
|
|
|
|
|
l = nc.list("/GIA CLOUD")
|
|
|
|
|
|
|
|
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
|
2022-06-13 14:30:28 +02:00
|
|
|
card = Card(title=name, interest_rate=-1.0, owner_id=1, item_location=public_link, last_review=None, share_id="0")
|
2023-08-27 18:52:59 +02:00
|
|
|
|
|
|
|
Session = get_session()
|
|
|
|
with Session() as dbsession:
|
|
|
|
dbsession.add(card)
|
|
|
|
dbsession.commit()
|
|
|
|
dbsession.close()
|
|
|
|
get_engine().dispose()
|