export
This commit is contained in:
parent
82d11e412f
commit
d54f524953
4 changed files with 109 additions and 7 deletions
|
|
@ -153,7 +153,6 @@ def remove(data):
|
|||
id
|
||||
}
|
||||
'''
|
||||
logger.debug('remove files %s', data)
|
||||
if 'ids' in data and data['ids']:
|
||||
for i in models.Item.query.filter(models.Item.id.in_(data['ids'])):
|
||||
i.remove_file()
|
||||
|
|
@ -229,7 +228,6 @@ def findMetadata(data):
|
|||
response = {
|
||||
'items': []
|
||||
}
|
||||
logger.debug('findMetadata %s', data)
|
||||
key = ','.join(sorted(data))
|
||||
if key == 'isbn':
|
||||
r = meta.lookup(key, data[key])
|
||||
|
|
@ -267,7 +265,6 @@ def getMetadata(data):
|
|||
}
|
||||
key can be one of the supported identifiers: isbn10, isbn13, oclc, olid,...
|
||||
'''
|
||||
logger.debug('getMetadata %s', data)
|
||||
if 'includeEdits' in data:
|
||||
include_edits = data.pop('includeEdits')
|
||||
else:
|
||||
|
|
@ -340,6 +337,24 @@ def scan(data):
|
|||
return {}
|
||||
actions.register(scan, cache=False)
|
||||
|
||||
def export(data):
|
||||
'''
|
||||
takes {
|
||||
path absolute path to import
|
||||
list listename (add new items to this list)
|
||||
mode add|replace
|
||||
}
|
||||
'''
|
||||
import user.models
|
||||
l = user.models.List.get(':' + data['list'])
|
||||
if l:
|
||||
data['list'] = ':' + data['list']
|
||||
state.tasks.queue('export', data)
|
||||
response = {'status': 'ok'}
|
||||
else:
|
||||
response = {'status': 'invalid list'}
|
||||
return response
|
||||
actions.register(export, cache=False)
|
||||
|
||||
def _import(data):
|
||||
'''
|
||||
|
|
@ -349,7 +364,6 @@ def _import(data):
|
|||
mode copy|move
|
||||
}
|
||||
'''
|
||||
logger.debug('api.import %s', data)
|
||||
state.tasks.queue('import', data)
|
||||
return {}
|
||||
actions.register(_import, 'import', cache=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue