get preview in tasks
This commit is contained in:
parent
168b293514
commit
5c5c8ac39b
4 changed files with 26 additions and 16 deletions
21
oml/tasks.py
21
oml/tasks.py
|
|
@ -21,7 +21,7 @@ class Tasks(Thread):
|
|||
|
||||
def run(self):
|
||||
import item.scan
|
||||
from item.models import sync_metadata
|
||||
from item.models import sync_metadata, get_preview
|
||||
from user.models import export_list, update_user_peering
|
||||
while self.connected:
|
||||
m = self.q.get()
|
||||
|
|
@ -29,22 +29,22 @@ class Tasks(Thread):
|
|||
try:
|
||||
action, data = m
|
||||
logger.debug('%s start', action)
|
||||
if action == 'ping':
|
||||
trigger_event('pong', data)
|
||||
if action == 'export':
|
||||
export_list(data)
|
||||
elif action == 'getpreview':
|
||||
get_preview(data)
|
||||
elif action == 'import':
|
||||
item.scan.run_import(data)
|
||||
elif action == 'export':
|
||||
export_list(data)
|
||||
elif action == 'peering':
|
||||
update_user_peering(*data)
|
||||
elif action == 'ping':
|
||||
trigger_event('pong', data)
|
||||
elif action == 'scan':
|
||||
item.scan.run_scan()
|
||||
elif action == 'scanimport':
|
||||
item.scan.import_folder()
|
||||
elif action == 'peering':
|
||||
update_user_peering(*data)
|
||||
elif action == 'syncmetadata':
|
||||
if not data:
|
||||
data = []
|
||||
sync_metadata(*data)
|
||||
sync_metadata(data)
|
||||
else:
|
||||
trigger_event('error', {'error': 'unknown action'})
|
||||
logger.debug('%s done', action)
|
||||
|
|
@ -58,5 +58,6 @@ class Tasks(Thread):
|
|||
return Thread.join(self)
|
||||
|
||||
def queue(self, action, data=None):
|
||||
logger.debug('%s queued', action)
|
||||
self.q.put((action, data))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue