bazarr/views/menu.tpl

201 lines
6.7 KiB
Python
Raw Normal View History

2017-12-22 00:49:39 +00:00
<html>
<head>
<!DOCTYPE html>
<style>
#divmenu {
2017-12-22 03:36:22 +00:00
background-color: #000000;
2017-12-22 00:49:39 +00:00
padding-top: 2em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 128px;
}
.prompt {
background-color: #333333 !important;
color: white !important;
border-radius: 3px !important;
}
2017-12-23 04:16:50 +00:00
.searchicon {
color: white !important;
}
2017-12-22 00:49:39 +00:00
</style>
</head>
<body>
% from get_argv import config_dir
% import os
% import sqlite3
% from get_settings import get_general_settings
%if get_general_settings()[24] is True:
% monitored_only_query_string = ' AND monitored = "True"'
%else:
% monitored_only_query_string = ""
%end
% conn = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
% c = conn.cursor()
% wanted_series = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string).fetchone()
% wanted_movies = c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string).fetchone()
<div id="divmenu" class="ui container">
2017-12-22 00:49:39 +00:00
<div class="ui grid">
<div class="middle aligned row">
<div class="three wide column">
<a href="{{base_url}}"><img class="logo" src="{{base_url}}static/logo128.png"></a>
</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="row">
<div class="sixteen wide column">
2018-04-19 23:45:10 +00:00
<div class="ui inverted borderless labeled icon massive menu six item">
2017-12-22 00:49:39 +00:00
<div class="ui container">
% if get_general_settings()[12] is True:
<a class="item" href="{{base_url}}series">
2017-12-22 00:49:39 +00:00
<i class="play icon"></i>
Series
</a>
% end
% if get_general_settings()[13] is True:
2018-04-19 23:45:10 +00:00
<a class="item" href="{{base_url}}movies">
<i class="film icon"></i>
Movies
</a>
% end
2017-12-22 00:49:39 +00:00
<a class="item" href="{{base_url}}history">
<i class="wait icon"></i>
History
</a>
<a class="item" href="{{base_url}}wanted">
<i class="warning sign icon">
% if get_general_settings()[12] is True:
2018-05-02 10:25:42 +00:00
<div class="floating ui tiny yellow label" style="left:90% !important;top:0.5em !important;">
{{wanted_series[0]}}
</div>
% end
% if get_general_settings()[13] is True:
2018-05-02 10:25:42 +00:00
<div class="floating ui tiny green label" style="left:90% !important;top:3em !important;">
{{wanted_movies[0]}}
</div>
% end
</i>
2017-12-22 00:49:39 +00:00
Wanted
</a>
<a class="item" href="{{base_url}}settings">
<i class="settings icon"></i>
Settings
</a>
<a class="item" href="{{base_url}}system">
<i class="laptop icon"></i>
System
</a>
</div>
</div>
</div>
</div>
<div style='padding-top:0rem;' class="row">
<div class="three wide column"></div>
<div class="ten wide column">
<div class="ui search">
<div class="ui left icon fluid input">
<input class="prompt" type="text" placeholder="Search in your library">
2017-12-23 04:16:50 +00:00
<i class="searchicon search icon"></i>
2017-12-22 00:49:39 +00:00
</div>
</div>
</div>
<div class="three wide column"></div>
</div>
</div>
</div>
</div>
</div>
2018-09-27 15:50:48 +00:00
% restart_required = c.execute("SELECT configured, updated FROM system").fetchone()
% c.close()
2018-09-27 15:50:48 +00:00
% if restart_required[1] == '1' and restart_required[0] == '1':
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply last update and changes to general settings. Click <a href=# id="restart_link">here</a> to restart.</div></div></div>
2018-09-27 15:50:48 +00:00
% elif restart_required[1] == '1':
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply last update. Click <a href=# id="restart_link">here</a> to restart.</div></div></div>
2018-09-27 15:50:48 +00:00
% elif restart_required[0] == '1':
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply changes to general settings. Click <a href=# id="restart_link">here</a> to restart.</div></div></div>
2018-09-27 15:50:48 +00:00
% end
</div>
2017-12-22 00:49:39 +00:00
</body>
</html>
<script>
$('.ui.search')
.search({
apiSettings: {
2018-04-24 14:48:52 +00:00
url: '{{base_url}}search_json/{query}',
2017-12-22 00:49:39 +00:00
onResponse: function(results) {
var response = {
results : []
};
$.each(results.items, function(index, item) {
response.results.push({
title : item.name,
url : item.url
});
});
return response;
}
},
minCharacters : 2
})
;
2017-12-22 03:36:22 +00:00
if (window.location.href.indexOf("episodes") > -1) {
$('.menu').css('background', '#000000');
2018-09-28 14:40:36 +00:00
$('.menu').css('opacity', '0.8');
2017-12-22 03:36:22 +00:00
$('#divmenu').css('background', '#000000');
2018-09-28 14:40:36 +00:00
$('#divmenu').css('opacity', '0.8');
$('#divmenu').css('box-shadow', '0px 0px 5px 5px #000000');
}
else if (window.location.href.indexOf("movie/") > -1) {
$('.menu').css('background', '#000000');
$('.menu').css('opacity', '0.8');
$('#divmenu').css('background', '#000000');
$('#divmenu').css('opacity', '0.8');
$('#divmenu').css('box-shadow', '0px 0px 5px 5px #000000');
2017-12-22 03:36:22 +00:00
}
else {
$('.menu').css('background', '#272727');
$('#divmenu').css('background', '#272727');
}
$('#restart_link').click(function(){
$('#loader_text').text("Bazarr is restarting, please wait...");
$.ajax({
url: "{{base_url}}restart",
async: true
})
.done(function(){
setTimeout(function(){ setInterval(ping, 2000); },8000);
});
})
2018-10-16 14:58:25 +00:00
% from get_settings import get_general_settings
% ip = get_general_settings()[0]
% port = get_general_settings()[1]
% base_url = get_general_settings()[2] + "/"
if ("{{ip}}" == "0.0.0.0") {
public_ip = window.location.hostname;
} else {
public_ip = "{{ip}}";
}
function ping() {
$.ajax({
2018-10-16 14:58:25 +00:00
url: 'http://' + public_ip + ':{{port}}{{base_url}}',
success: function(result) {
2018-10-16 14:58:25 +00:00
window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}';
}
});
}
2017-12-22 00:49:39 +00:00
</script>