remove obsolete kontor.py #61
@@ -1,5 +1,7 @@
|
|||||||
from cement import Controller, ex
|
from cement import Controller, ex
|
||||||
|
|
||||||
|
from ..database import KontorDB
|
||||||
|
|
||||||
|
|
||||||
class Media(Controller):
|
class Media(Controller):
|
||||||
|
|
||||||
@@ -38,3 +40,26 @@ class Media(Controller):
|
|||||||
if self.app.pargs.dry_run:
|
if self.app.pargs.dry_run:
|
||||||
print('print command to shell')
|
print('print command to shell')
|
||||||
self.app.render(data, 'download.jinja2')
|
self.app.render(data, 'download.jinja2')
|
||||||
|
|
||||||
|
@ex(
|
||||||
|
help='add url to database',
|
||||||
|
arguments=[
|
||||||
|
(['-u', '--url'],
|
||||||
|
{'help': 'link to downloadable video',
|
||||||
|
'action': 'store',
|
||||||
|
'dest': 'link'})
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def add(self):
|
||||||
|
data = {
|
||||||
|
'link_url': None
|
||||||
|
}
|
||||||
|
if self.app.pargs.link is not None:
|
||||||
|
data['link_url'] = self.app.pargs.link
|
||||||
|
if self.app.pargs.dry_run:
|
||||||
|
print(f"add url {data['link_url']} to database")
|
||||||
|
kontor_db = KontorDB(self.app.session, self.app.log)
|
||||||
|
kontor_db.add_link(self.app.pargs.link, self.app.pargs.dry_run)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("no url was given.")
|
||||||
|
|||||||
@@ -214,3 +214,6 @@ class KontorDB:
|
|||||||
changed = True
|
changed = True
|
||||||
self.log.info(f"update {key} with {update_value}")
|
self.log.info(f"update {key} with {update_value}")
|
||||||
return changed
|
return changed
|
||||||
|
|
||||||
|
def add_link(self, link: str, dry_run: bool):
|
||||||
|
self.log.info(f"add link {link} to media_file")
|
||||||
|
|||||||
Reference in New Issue
Block a user