logging format
This commit is contained in:
parent
49fa35ae95
commit
26f2a40601
2 changed files with 11 additions and 13 deletions
|
@ -374,7 +374,7 @@ class Item(db.Model):
|
||||||
break
|
break
|
||||||
|
|
||||||
def update_cover(self):
|
def update_cover(self):
|
||||||
logger.debug('update cover %s', self.id)
|
logger.debug('%s update cover', self.id)
|
||||||
key = 'cover:%s'%self.id
|
key = 'cover:%s'%self.id
|
||||||
cover = None
|
cover = None
|
||||||
if 'cover' in self.meta and self.meta['cover']:
|
if 'cover' in self.meta and self.meta['cover']:
|
||||||
|
@ -394,9 +394,8 @@ class Item(db.Model):
|
||||||
self.info['coverRatio'] = self.info['previewRatio']
|
self.info['coverRatio'] = self.info['previewRatio']
|
||||||
elif 'coverRatio' in self.info:
|
elif 'coverRatio' in self.info:
|
||||||
del self.info['coverRatio']
|
del self.info['coverRatio']
|
||||||
logger.debug('clear cover:%s:', self.id)
|
|
||||||
icons.clear('cover:%s:' % self.id)
|
icons.clear('cover:%s:' % self.id)
|
||||||
logger.debug('update_cover done')
|
logger.debug('%s update_cover done', self.id)
|
||||||
|
|
||||||
def get_preview(self):
|
def get_preview(self):
|
||||||
key = 'preview:%s'%self.id
|
key = 'preview:%s'%self.id
|
||||||
|
@ -407,7 +406,7 @@ class Item(db.Model):
|
||||||
icons[key] = preview
|
icons[key] = preview
|
||||||
|
|
||||||
def update_preview(self):
|
def update_preview(self):
|
||||||
logger.debug('update_preview %s', self.id)
|
logger.debug('%s update_preview', self.id)
|
||||||
key = 'preview:%s'%self.id
|
key = 'preview:%s'%self.id
|
||||||
preview = self.extract_preview()
|
preview = self.extract_preview()
|
||||||
if preview:
|
if preview:
|
||||||
|
@ -424,9 +423,8 @@ class Item(db.Model):
|
||||||
self.info['previewRatio'] = self.info['coverRatio']
|
self.info['previewRatio'] = self.info['coverRatio']
|
||||||
elif 'previewRatio' in self.info:
|
elif 'previewRatio' in self.info:
|
||||||
del self.info['previewRatio']
|
del self.info['previewRatio']
|
||||||
logger.debug('clear preview:%s:', self.id)
|
|
||||||
icons.clear('preview:%s:' % self.id)
|
icons.clear('preview:%s:' % self.id)
|
||||||
logger.debug('update_preview done %s', self.id)
|
logger.debug('%s update_preview done', self.id)
|
||||||
|
|
||||||
def update_icons(self):
|
def update_icons(self):
|
||||||
self.update_cover()
|
self.update_cover()
|
||||||
|
|
|
@ -52,23 +52,23 @@ def remove_missing():
|
||||||
def add_file(id, f, prefix, from_=None):
|
def add_file(id, f, prefix, from_=None):
|
||||||
user = state.user()
|
user = state.user()
|
||||||
path = f[len(prefix):]
|
path = f[len(prefix):]
|
||||||
logger.debug('extract metadata %s %s', id, path)
|
logger.debug('%s extract metadata %s', id, path)
|
||||||
data = media.metadata(f, from_)
|
data = media.metadata(f, from_)
|
||||||
logger.debug('create file %s %s', id, path)
|
logger.debug('%s create file %s', id, path)
|
||||||
file = File.get_or_create(id, data, path)
|
file = File.get_or_create(id, data, path)
|
||||||
item = file.item
|
item = file.item
|
||||||
item.add_user(user)
|
item.add_user(user)
|
||||||
item.added = datetime.utcnow()
|
item.added = datetime.utcnow()
|
||||||
logger.debug('load metadata %s %s', id, path)
|
logger.debug('%s load metadata %s', id, path)
|
||||||
item.load_metadata()
|
item.load_metadata()
|
||||||
Changelog.record(user, 'additem', item.id, file.info)
|
Changelog.record(user, 'additem', item.id, file.info)
|
||||||
Changelog.record(user, 'edititem', item.id, item.meta)
|
Changelog.record(user, 'edititem', item.id, item.meta)
|
||||||
logger.debug('extract icons %s %s', id, path)
|
logger.debug('%s extract icons %s', id, path)
|
||||||
item.update_icons()
|
item.update_icons()
|
||||||
item.modified = datetime.utcnow()
|
item.modified = datetime.utcnow()
|
||||||
logger.debug('save item %s', id)
|
logger.debug('%s save item', id)
|
||||||
item.update()
|
item.update()
|
||||||
logger.debug('added file %s', id)
|
logger.debug('%s added', id)
|
||||||
return file
|
return file
|
||||||
|
|
||||||
def run_scan():
|
def run_scan():
|
||||||
|
@ -161,7 +161,7 @@ def run_import(options=None):
|
||||||
logger.debug('active import canceled')
|
logger.debug('active import canceled')
|
||||||
state.activity = {}
|
state.activity = {}
|
||||||
return
|
return
|
||||||
if count % 1000 == 0:
|
if count % 100 == 0:
|
||||||
state.activity = {
|
state.activity = {
|
||||||
'activity': 'import',
|
'activity': 'import',
|
||||||
'path': prefix,
|
'path': prefix,
|
||||||
|
|
Loading…
Reference in a new issue