diff --git a/bazarr.py b/bazarr.py index 0f5152b4b..0ff570c50 100644 --- a/bazarr.py +++ b/bazarr.py @@ -295,10 +295,6 @@ def check_update(): @route(base_url + 'system') def system(): - logs = [] - for line in reversed(open(os.path.join(os.path.dirname(__file__), 'data/log/bazarr.log')).readlines()): - logs.append(line.rstrip()) - def get_time_from_interval(interval): interval_clean = interval.split('[') interval_clean = interval_clean[1][:-1] @@ -384,8 +380,26 @@ def system(): task_list.append([job.name, get_time_from_interval(str(job.trigger)), pretty.date(job.next_run_time.replace(tzinfo=None)), job.id]) elif job.trigger.__str__().startswith('cron'): task_list.append([job.name, get_time_from_cron(job.trigger.fields), pretty.date(job.next_run_time.replace(tzinfo=None)), job.id]) + + with open(os.path.join(os.path.dirname(__file__), 'data/log/bazarr.log')) as f: + for i, l in enumerate(f, 1): + pass + row_count = i + max_page = (row_count / 50) + 1 - return template('system', logs=logs, base_url=base_url, task_list=task_list, bazarr_version=bazarr_version) + return template('system', base_url=base_url, task_list=task_list, row_count=row_count, max_page=max_page, bazarr_version=bazarr_version) + +@route(base_url + 'logs/') +def get_logs(page): + page_size = 50 + begin = (page * page_size) - page_size + end = (page * page_size) - 1 + logs_complete = [] + for line in reversed(open(os.path.join(os.path.dirname(__file__), 'data/log/bazarr.log')).readlines()): + logs_complete.append(line.rstrip()) + logs = logs_complete[begin:end] + + return template('logs', logs=logs, base_url=base_url) @route(base_url + 'execute/') def execute_task(taskid): diff --git a/views/history.tpl b/views/history.tpl index db555a142..a2386ffb2 100644 --- a/views/history.tpl +++ b/views/history.tpl @@ -40,6 +40,8 @@ .fast.backward, .backward, .forward, .fast.forward { cursor: pointer; } + .fast.backward, .backward, .forward, .fast.forward { pointer-events: auto; } + .fast.backward.disabled, .backward.disabled, .forward.disabled, .fast.forward.disabled { pointer-events: none; } diff --git a/views/logs.tpl b/views/logs.tpl new file mode 100644 index 000000000..5851530e3 --- /dev/null +++ b/views/logs.tpl @@ -0,0 +1,84 @@ + + + + + + + + + + + +
+ + + + + + + + + + %import time + %import datetime + %import pretty + %for log in logs: + %line = [] + %line = log.split('|') + + + + + + %end + +
MessageTime
{{line[2]}}{{pretty.date(int(time.mktime(datetime.datetime.strptime(line[0], "%d/%m/%Y %H:%M:%S").timetuple())))}}
+
+ + + + + + \ No newline at end of file diff --git a/views/system.tpl b/views/system.tpl index 7f35d7d3e..0c46e10ab 100644 --- a/views/system.tpl +++ b/views/system.tpl @@ -37,6 +37,11 @@ margin-bottom: 3em; padding: 1em; } + .fast.backward, .backward, .forward, .fast.forward { + cursor: pointer; + } + .fast.backward, .backward, .forward, .fast.forward { pointer-events: auto; } + .fast.backward.disabled, .backward.disabled, .forward.disabled, .fast.forward.disabled { pointer-events: none; } @@ -107,86 +112,76 @@
- - - - - - - - - - %import time - %import datetime - %import pretty - %for log in logs: - %line = [] - %line = log.split('|') - - - - - - %end - -
MessageTime
{{line[2]}}{{pretty.date(int(time.mktime(datetime.datetime.strptime(line[0], "%d/%m/%Y %H:%M:%S").timetuple())))}}
+
+ +
+
+
+
+ + + / {{max_page}} + + +
+
Total records: {{row_count}}
+
+
Bazarr version: {{bazarr_version}}
- -