diff --git a/plexpy/datatables.py b/plexpy/datatables.py index 47d02503..c0261dab 100644 --- a/plexpy/datatables.py +++ b/plexpy/datatables.py @@ -142,6 +142,9 @@ class DataTables(object): for w_ in w[1]: if w_ == None: c_where += w[0] + ' IS NULL OR ' + elif str(w_).startswith('LIKE '): + c_where += w[0] + ' LIKE ? OR ' + args.append(w_[5:]) else: c_where += w[0] + ' = ? OR ' args.append(w_) @@ -149,6 +152,9 @@ class DataTables(object): else: if w[1] == None: c_where += w[0] + ' IS NULL AND ' + elif str(w[1]).startswith('LIKE '): + c_where += w[0] + ' LIKE ? AND ' + args.append(w[1][5:]) else: c_where += w[0] + ' = ? AND ' args.append(w[1]) diff --git a/plexpy/webserve.py b/plexpy/webserve.py index d4b98302..0023eeeb 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -1720,8 +1720,8 @@ class WebInterface(object): year = kwargs.get('year', '') custom_where.append(['session_history_metadata.year', year]) if 'guid' in kwargs: - guid = kwargs.get('guid', '').split('?')[0] + '%' # SQLite LIKE wildcard - custom_where.append(['session_history_metadata.guid', guid]) + guid = kwargs.get('guid', '').split('?')[0] + custom_where.append(['session_history_metadata.guid', 'LIKE ' + guid + '%']) # SQLite LIKE wildcard data_factory = datafactory.DataFactory() history = data_factory.get_datatables_history(kwargs=kwargs, custom_where=custom_where, grouping=grouping)