Compare commits
No commits in common. "07cdab8c2d91a50aa10725ad77f9815cab3154f5" and "637feaee55f757aa7877ae15681ff352b0f22dc2" have entirely different histories.
07cdab8c2d
...
637feaee55
6 changed files with 7 additions and 17 deletions
|
|
@ -168,7 +168,6 @@ def remove(data):
|
|||
'''
|
||||
if 'ids' in data and data['ids']:
|
||||
for i in models.Item.query.filter(models.Item.id.in_(data['ids'])):
|
||||
logger.info('remove item %s', i)
|
||||
i.remove_file()
|
||||
state.cache.clear('group:')
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -172,8 +172,7 @@ class UploadHandler(tornado.web.RequestHandler):
|
|||
id = get_id(data=upload.body)
|
||||
ids.append(id)
|
||||
file = File.get(id)
|
||||
if not file or not os.path.exists(file.fullpath()):
|
||||
logger.debug('add %s to library', id)
|
||||
if not file:
|
||||
prefix_books = os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books' + os.sep)
|
||||
prefix_imported = os.path.join(prefix_books, '.import' + os.sep)
|
||||
ox.makedirs(prefix_imported)
|
||||
|
|
@ -191,13 +190,7 @@ class UploadHandler(tornado.web.RequestHandler):
|
|||
file.move()
|
||||
else:
|
||||
user = state.user()
|
||||
item = file.item
|
||||
if user not in item.users:
|
||||
logger.debug('add %s to local user', id)
|
||||
item.add_user(user)
|
||||
add_record('additem', item.id, file.info)
|
||||
add_record('edititem', item.id, item.meta)
|
||||
item.update()
|
||||
file.item.add_user(user)
|
||||
if listname and ids:
|
||||
l = List.get(settings.USER_ID, listname)
|
||||
if l:
|
||||
|
|
|
|||
|
|
@ -800,7 +800,6 @@ class File(db.Model):
|
|||
if os.path.exists(path) and os.path.exists(current_path):
|
||||
os.unlink(path)
|
||||
return
|
||||
logger.debug('mv "%s" "%s"', self.path, new_path)
|
||||
self.path = new_path
|
||||
self.save()
|
||||
for folder in set(os.path.dirname(p) for p in [current_path, path]):
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import os
|
|||
import shutil
|
||||
import stat
|
||||
import time
|
||||
import unicodedata
|
||||
|
||||
import ox
|
||||
|
||||
|
|
@ -32,7 +31,6 @@ def remove_missing(books=None):
|
|||
prefix = get_prefix()
|
||||
if books is None:
|
||||
books = collect_books(prefix)
|
||||
books = [unicodedata.normalize('NFD', path) for path in books]
|
||||
with db.session():
|
||||
if os.path.exists(prefix):
|
||||
logger.debug('scan for removed files')
|
||||
|
|
@ -42,7 +40,6 @@ def remove_missing(books=None):
|
|||
if state.shutdown:
|
||||
return
|
||||
path = f.fullpath()
|
||||
path = unicodedata.normalize('NFD', path)
|
||||
db_paths.append(path)
|
||||
if f.item:
|
||||
items[path] = f.sha1
|
||||
|
|
@ -175,6 +172,7 @@ def run_scan():
|
|||
elif user not in file.item.users:
|
||||
item = file.item
|
||||
item.add_user(user)
|
||||
|
||||
logger.debug('add %s to local user', id)
|
||||
add_record('additem', item.id, file.info)
|
||||
add_record('edititem', item.id, item.meta)
|
||||
|
|
@ -196,10 +194,11 @@ def run_scan():
|
|||
library_items = set([str(i) for i in user.library.items])
|
||||
gone = library_items - ids
|
||||
if gone:
|
||||
logger.debug('cleaning up %s deleted records', len(gone))
|
||||
for id in gone:
|
||||
i = Item.get(id)
|
||||
path = i.get_path()
|
||||
if not path or not os.path.exists(path):
|
||||
if path and not os.path.exists(path):
|
||||
logger.debug('cleaning orphaned record %s %s', i, path)
|
||||
i.remove_file()
|
||||
missing = ids - library_items
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ class Peer(object):
|
|||
l.remove_items(lremove, commit=False)
|
||||
if ladd or lremove:
|
||||
logger.debug('update list %s', l.name)
|
||||
elif self.info['lists'][l.name]:
|
||||
else:
|
||||
l.add_items(self.info['lists'][l.name], commit=False)
|
||||
update_items = list(set(update_items) - set(self.info['lists'][l.name]))
|
||||
logger.debug('update list %s', l.name)
|
||||
|
|
|
|||
|
|
@ -1028,7 +1028,7 @@ oml.updateDebugMenu = function() {
|
|||
oml.user.ui.showDebugMenu ? menu.show() : menu.hide();
|
||||
};
|
||||
|
||||
oml.supportedExtensions = ['pdf', 'epub', 'kepub', 'cbr', 'cbz', 'txt'];
|
||||
oml.supportedExtensions = ['pdf', 'epub', 'kepub', 'cbr', 'cbz'];
|
||||
|
||||
oml.upload = function(fileslist, callback) {
|
||||
var files = [], ids = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue