1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-24 16:52:06 +00:00

Add a releases tab in system to keep track of changes.

This commit is contained in:
morpheus65535 2018-08-26 20:51:29 -04:00
parent 4b7fefe3a9
commit 1c1aec5a06
2 changed files with 45 additions and 4 deletions

View file

@ -1238,7 +1238,24 @@ def system():
page_size = int(get_general_settings()[21])
max_page = int(math.ceil(row_count / (page_size + 0.0)))
return template('system', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url, task_list=task_list, row_count=row_count, max_page=max_page, page_size=page_size)
releases = []
url_releases = 'https://api.github.com/repos/morpheus65535/Bazarr/releases'
try:
r = requests.get(url_releases, timeout=15)
r.raise_for_status()
except requests.exceptions.HTTPError as errh:
logging.exception("Error trying to get releases from Github. Http error.")
except requests.exceptions.ConnectionError as errc:
logging.exception("Error trying to get releases from Github. Connection Error.")
except requests.exceptions.Timeout as errt:
logging.exception("Error trying to get releases from Github. Timeout Error.")
except requests.exceptions.RequestException as err:
logging.exception("Error trying to get releases from Github.")
else:
for release in r.json():
releases.append([release['name'],release['body']])
return template('system', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url, task_list=task_list, row_count=row_count, max_page=max_page, page_size=page_size, releases=releases)
@route(base_url + 'logs/<page:int>')
@custom_auth_basic(check_credentials)

View file

@ -49,7 +49,7 @@
<div class="ui top attached tabular menu">
<a class="tabs item active" data-tab="tasks">Tasks</a>
<a class="tabs item" data-tab="logs">Logs</a>
<a class="tabs item" data-tab="about">About</a>
<a class="tabs item" data-tab="releases">Releases</a>
</div>
<div class="ui bottom attached tab segment active" data-tab="tasks">
<div class="content">
@ -111,8 +111,32 @@
%end
</div>
</div>
<div class="ui bottom attached tab segment" data-tab="about">
Bazarr version: {{bazarr_version}}
<div class="ui bottom attached tab segment" data-tab="releases">
%for release in releases:
<h2 class="ui header">
%if release[0][1:] == bazarr_version:
{{release[0]}} <div class="ui green label">Current version</div>
%else:
{{release[0]}}
%end
</h2>
<div class="ui list">
%release_lines = release[1].split('\r\n')
%for i, release_line in enumerate(release_lines):
%if i == 0:
<div class="item">
<div><h3>{{release_line}}</h3></div>
<div class="list">
%else:
<div class="item">{{release_line}}</div>
%end
%end
</div>
</div>
%end
</div>
%end
</div>
</div>
% include('footer.tpl')