Can you test and verify
This commit is contained in:
Hellowlol 2016-05-18 20:55:20 +02:00
parent 33458c1bdb
commit a660a1c44b

View file

@ -1987,24 +1987,14 @@ class WebInterface(object):
def getLog(self, start=0, length=100, **kwargs):
start = int(start)
length = int(length)
search_value = ""
search_regex = ""
order_column = 0
order_dir = "desc"
if 'order[0][dir]' in kwargs:
order_dir = kwargs.get('order[0][dir]', "desc")
if 'order[0][column]' in kwargs:
order_column = kwargs.get('order[0][column]', "0")
if 'search[value]' in kwargs:
search_value = kwargs.get('search[value]', "")
if 'search[regex]' in kwargs:
search_regex = kwargs.get('search[regex]', "")
search_regex = kwargs.get('search[regex]', "") # Remove?
sortcolumn = 0
filt = []
filtered = []
fa = filt.append
with open(os.path.join(plexpy.CONFIG.LOG_DIR, logger.FILENAME)) as f:
for l in f.readlines():
@ -2017,22 +2007,24 @@ class WebInterface(object):
# Add traceback message to previous msg.
tl = (len(filt) - 1)
n = len(l) - len(l.lstrip(' '))
l = ' ' * (2*n) + l[n:]
l = ' ' * (2 * n) + l[n:]
filt[tl][2] += '<br>' + l
continue
filtered = []
if search_value == '':
filtered = filt
else:
filtered = [row for row in filt for column in row if search_value.lower() in column.lower()]
sortcolumn = 0
if order_column == '1':
sortcolumn = 2
elif order_column == '2':
sortcolumn = 1
filtered.sort(key=lambda x: x[sortcolumn], reverse=order_dir == "desc")
filtered.sort(key=lambda x: x[sortcolumn])
if order_dir == 'desc':
filtered = filtered[::-1]
rows = filtered[start:(start + length)]