use one import folder to put files before moving them into place
This commit is contained in:
parent
86a9fafad2
commit
3df71b72b3
3 changed files with 3 additions and 3 deletions
|
@ -173,7 +173,7 @@ class UploadHandler(tornado.web.RequestHandler):
|
||||||
file = File.get(id)
|
file = File.get(id)
|
||||||
if not file:
|
if not file:
|
||||||
prefix_books = os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/')
|
prefix_books = os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/')
|
||||||
prefix_imported = os.path.join(prefix_books, 'Imported/')
|
prefix_imported = os.path.join(prefix_books, '.import/')
|
||||||
ox.makedirs(prefix_imported)
|
ox.makedirs(prefix_imported)
|
||||||
import_name = os.path.join(prefix_imported, filename)
|
import_name = os.path.join(prefix_imported, filename)
|
||||||
n = 1
|
n = 1
|
||||||
|
|
|
@ -448,7 +448,7 @@ class Item(db.Model):
|
||||||
logger.debug('INVALID CONTENT %s vs %s', self.id, content_id)
|
logger.debug('INVALID CONTENT %s vs %s', self.id, content_id)
|
||||||
return False
|
return False
|
||||||
if not f:
|
if not f:
|
||||||
path = 'Downloads/%s.%s' % (self.id, self.info['extension'])
|
path = '.import/%s.%s' % (self.id, self.info['extension'])
|
||||||
info = self.info.copy()
|
info = self.info.copy()
|
||||||
for key in ('mediastate', 'coverRatio', 'previewRatio'):
|
for key in ('mediastate', 'coverRatio', 'previewRatio'):
|
||||||
if key in info:
|
if key in info:
|
||||||
|
|
|
@ -112,7 +112,7 @@ def run_import(options=None):
|
||||||
if not prefix[-1] == os.sep:
|
if not prefix[-1] == os.sep:
|
||||||
prefix += os.sep
|
prefix += os.sep
|
||||||
prefix_books = os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books' + os.sep)
|
prefix_books = os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books' + os.sep)
|
||||||
prefix_imported = os.path.join(prefix_books, 'Imported' + os.sep)
|
prefix_imported = os.path.join(prefix_books, '.import' + os.sep)
|
||||||
if prefix_books.startswith(prefix) or prefix.startswith(prefix_books):
|
if prefix_books.startswith(prefix) or prefix.startswith(prefix_books):
|
||||||
error = 'invalid path'
|
error = 'invalid path'
|
||||||
elif not os.path.exists(prefix):
|
elif not os.path.exists(prefix):
|
||||||
|
|
Loading…
Reference in a new issue