Browse Source

Switched "library.tree" to use "media_children" index

pull/3824/head
Dean Gardiner 11 years ago
parent
commit
f2b0d3f80b
  1. 12
      couchpotato/core/media/_base/library/main.py

12
couchpotato/core/media/_base/library/main.py

@ -80,18 +80,12 @@ class Library(LibraryBase):
result = media
db = get_db()
# TODO this probably should be using an index?
items = [
item['doc']
for item in db.all('media', with_doc = True)
if item['doc'].get('parent_id') == media['_id']
]
items = db.get_many('media_children', media['_id'], with_doc = True)
keys = []
for item in items:
key = item['type'] + 's'
key = item['doc']['type'] + 's'
if key not in result:
result[key] = {}
@ -99,7 +93,7 @@ class Library(LibraryBase):
if key not in keys:
keys.append(key)
result[key][item['_id']] = fireEvent('library.tree', item, single = True)
result[key][item['_id']] = fireEvent('library.tree', item['doc'], single = True)
for key in keys:
result[key] = result[key].values()

Loading…
Cancel
Save