micro optimization
This commit is contained in:
parent
8c23d73bd3
commit
ebc0f28799
1 changed files with 6 additions and 3 deletions
|
@ -134,7 +134,8 @@ class Item(db.Model):
|
|||
j['timesaccessed'] = self.timesaccessed
|
||||
j['accessed'] = self.accessed
|
||||
j['added'] = self.added
|
||||
if state.downloads and not state.shutdown:
|
||||
if (not keys or 'transferadded' in keys or 'transferprogress' in keys) \
|
||||
and state.downloads and not state.shutdown:
|
||||
t = state.downloads.transfers.get(self.id)
|
||||
if t:
|
||||
j['transferadded'] = t['added']
|
||||
|
@ -149,7 +150,9 @@ class Item(db.Model):
|
|||
j[key] = self.info[key]
|
||||
|
||||
if self.meta:
|
||||
j.update(self.meta)
|
||||
for key in self.meta:
|
||||
if not keys or key in keys:
|
||||
j[key] = self.meta[key]
|
||||
|
||||
for key in self.id_keys:
|
||||
if key not in self.meta and key in j:
|
||||
|
|
Loading…
Add table
Reference in a new issue