mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-05 20:51:15 -07:00
Fix retrieving history for collections/playlists with over 1000 items
This commit is contained in:
parent
e735294e1c
commit
cc88cffc1f
2 changed files with 14 additions and 11 deletions
|
@ -144,14 +144,17 @@ def build_custom_where(custom_where=[]):
|
|||
and_or = ' OR ' if w[0].endswith('OR') else ' AND '
|
||||
w[0] = w[0].rstrip(' OR')
|
||||
|
||||
if isinstance(w[1], (list, tuple)) and len(w[1]):
|
||||
if w[0].endswith(' IN') and isinstance(w[1], (list, tuple)) and len(w[1]):
|
||||
c_where += w[0] + '(' + ','.join(['?'] * len(w[1])) + ')' + and_or
|
||||
args += w[1]
|
||||
elif isinstance(w[1], (list, tuple)) and len(w[1]):
|
||||
c_where += '('
|
||||
for w_ in w[1]:
|
||||
if w_ is None:
|
||||
c_where += w[0] + ' IS NULL'
|
||||
elif str(w_).startswith('LIKE '):
|
||||
c_where += w[0] + ' LIKE ?'
|
||||
args.append(w_[5:])
|
||||
elif w[0].endswith(' LIKE'):
|
||||
c_where += w[0] + ' ?'
|
||||
args.append(w_)
|
||||
elif w[0].endswith('<') or w[0].endswith('>'):
|
||||
c_where += w[0] + '= ?'
|
||||
args.append(w_)
|
||||
|
@ -163,9 +166,9 @@ def build_custom_where(custom_where=[]):
|
|||
else:
|
||||
if w[1] is None:
|
||||
c_where += w[0] + ' IS NULL'
|
||||
elif str(w[1]).startswith('LIKE '):
|
||||
c_where += w[0] + ' LIKE ?'
|
||||
args.append(w[1][5:])
|
||||
elif w[0].endswith(' LIKE'):
|
||||
c_where += w[0] + ' ?'
|
||||
args.append(w[1])
|
||||
elif w[0].endswith('<') or w[0].endswith('>'):
|
||||
c_where += w[0] + '= ?'
|
||||
args.append(w[1])
|
||||
|
|
|
@ -1978,9 +1978,9 @@ class WebInterface(object):
|
|||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_item_children(rating_key=kwargs.pop('rating_key'), media_type=kwargs.pop('media_type'))
|
||||
rating_keys = [child['rating_key'] for child in result['children_list']]
|
||||
custom_where.append(['session_history_metadata.rating_key OR', rating_keys])
|
||||
custom_where.append(['session_history_metadata.parent_rating_key OR', rating_keys])
|
||||
custom_where.append(['session_history_metadata.grandparent_rating_key OR', rating_keys])
|
||||
custom_where.append(['session_history_metadata.rating_key IN OR', rating_keys])
|
||||
custom_where.append(['session_history_metadata.parent_rating_key IN OR', rating_keys])
|
||||
custom_where.append(['session_history_metadata.grandparent_rating_key IN OR', rating_keys])
|
||||
else:
|
||||
rating_key = helpers.split_strip(kwargs.pop('rating_key', ''))
|
||||
if rating_key:
|
||||
|
@ -2024,7 +2024,7 @@ class WebInterface(object):
|
|||
if 'guid' in kwargs:
|
||||
guid = helpers.split_strip(kwargs.pop('guid', '').split('?')[0])
|
||||
if guid:
|
||||
custom_where.append(['session_history_metadata.guid', ['LIKE ' + g + '%' for g in guid]])
|
||||
custom_where.append(['session_history_metadata.guid LIKE', [f"{g}%" for g in guid]])
|
||||
|
||||
data_factory = datafactory.DataFactory()
|
||||
history = data_factory.get_datatables_history(kwargs=kwargs, custom_where=custom_where,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue