subclass VideoFile
This commit is contained in:
@@ -2,7 +2,7 @@ from pathlib import Path
|
||||
|
||||
from cement import Controller, ex
|
||||
from kontor_schema import KontorDB
|
||||
from kontor_video import VideoLink
|
||||
from kontor_video import VideoLink, MediaVideo
|
||||
|
||||
|
||||
class Media(Controller):
|
||||
@@ -20,7 +20,7 @@ class Media(Controller):
|
||||
updates = db.get_update_list()
|
||||
self.app.log.info(f"found {len(updates)} links for update")
|
||||
for file_id, url in updates.items():
|
||||
link = VideoLink(url)
|
||||
link = MediaVideo(url)
|
||||
title = link.get_title()
|
||||
if title is not None:
|
||||
db.update_entry('media_file', file_id, {'title': title, 'review': 0,})
|
||||
@@ -77,14 +77,12 @@ class Media(Controller):
|
||||
}
|
||||
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")
|
||||
else:
|
||||
db = self.app.kontor_db
|
||||
result = db.add_link(self.app.pargs.link)
|
||||
self.log.info(result)
|
||||
self.app.log.info(f"add url {data['link_url']} to database")
|
||||
db = self.app.kontor_db
|
||||
result = db.add_link(self.app.pargs.link)
|
||||
self.app.log.info(result)
|
||||
else:
|
||||
print("no url was given.")
|
||||
self.app.log.info("no url was given.")
|
||||
|
||||
@ex(
|
||||
help='check files if existing',
|
||||
|
||||
Reference in New Issue
Block a user