mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-22 14:13:40 -07:00
optimize array creation
This commit is contained in:
parent
9ce72f8df0
commit
f4c82abcf4
1 changed files with 5 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# This file is part of Tautulli.
|
# This file is part of Tautulli.
|
||||||
#
|
#
|
||||||
|
@ -1156,15 +1156,12 @@ class DataFactory(object):
|
||||||
|
|
||||||
group_by = 'session_history.reference_id' if grouping else 'session_history.id'
|
group_by = 'session_history.reference_id' if grouping else 'session_history.id'
|
||||||
|
|
||||||
rating_keys = []
|
|
||||||
if media_type == 'collection':
|
if media_type == 'collection':
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
pms_connect = pmsconnect.PmsConnect()
|
||||||
result = pms_connect.get_item_children(rating_key=rating_key, media_type=media_type)
|
result = pms_connect.get_item_children(rating_key=rating_key, media_type=media_type)
|
||||||
|
rating_keys = [child['rating_key'] for child in result['children_list']]
|
||||||
for child in result['children_list']:
|
|
||||||
rating_keys.append(child['rating_key'])
|
|
||||||
else:
|
else:
|
||||||
rating_keys.append(rating_key)
|
rating_keys = [rating_key]
|
||||||
|
|
||||||
rating_keys_arg = ','.join(['?'] * len(rating_keys))
|
rating_keys_arg = ','.join(['?'] * len(rating_keys))
|
||||||
|
|
||||||
|
@ -1243,15 +1240,12 @@ class DataFactory(object):
|
||||||
|
|
||||||
group_by = 'session_history.reference_id' if grouping else 'session_history.id'
|
group_by = 'session_history.reference_id' if grouping else 'session_history.id'
|
||||||
|
|
||||||
rating_keys = []
|
|
||||||
if media_type == 'collection':
|
if media_type == 'collection':
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
pms_connect = pmsconnect.PmsConnect()
|
||||||
result = pms_connect.get_item_children(rating_key=rating_key, media_type=media_type)
|
result = pms_connect.get_item_children(rating_key=rating_key, media_type=media_type)
|
||||||
|
rating_keys = [child['rating_key'] for child in result['children_list']]
|
||||||
for child in result['children_list']:
|
|
||||||
rating_keys.append(child['rating_key'])
|
|
||||||
else:
|
else:
|
||||||
rating_keys.append(rating_key)
|
rating_keys = [rating_key]
|
||||||
|
|
||||||
rating_keys_arg = ','.join(['?'] * len(rating_keys))
|
rating_keys_arg = ','.join(['?'] * len(rating_keys))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue