2019-04-20 21:15:00 +00:00
<!DOCTYPE html>
2018-12-09 20:23:51 +00:00
< html lang = "en" >
2017-12-22 00:49:39 +00:00
< head >
2019-04-20 21:15:00 +00:00
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" / >
< meta name = "mobile-web-app-capable" content = "yes" / >
< meta name = "apple-mobile-web-app-capable" content = "yes" / >
2018-12-13 02:50:05 +00:00
< link href = "{{base_url}}static/noty/noty.css" rel = "stylesheet" >
< script src = "{{base_url}}static/noty/noty.min.js" type = "text/javascript" > < / script >
2017-12-22 00:49:39 +00:00
< style >
#divmenu {
2019-04-17 03:05:34 +00:00
padding-top: 1em;
}
.menu_segment {
padding: 0em !important;
border: none !important;
margin: 0em !important;
background: none !important;
2017-12-22 00:49:39 +00:00
}
2019-04-20 21:15:00 +00:00
#icon_menu {
background: transparent !important;
border: solid;
border-width: 1px;
border-color: white;
}
2017-12-22 00:49:39 +00:00
.prompt {
background-color: #333333 !important;
color: white !important;
border-radius: 3px !important;
}
2017-12-23 04:16:50 +00:00
.searchicon {
2017-12-23 03:40:14 +00:00
color: white !important;
}
2019-04-19 19:49:45 +00:00
.ui.progress .bar>.progress {
right: auto;
left: .5em;
color: black !important;
}
.ui.disabled.progress.notification_progress {
opacity: unset !important;
}
2019-02-25 04:05:58 +00:00
div.disabled { pointer-events: none; }
button.disabled { pointer-events: none; }
2019-04-17 03:05:34 +00:00
@media only screen and (max-width: 1024px) {
.logo {
2019-04-20 21:15:00 +00:00
width: 36px;
2019-04-17 03:05:34 +00:00
height: auto;
}
}
2017-12-22 00:49:39 +00:00
< / style >
< / head >
< body >
2018-11-29 19:09:34 +00:00
% from get_args import args
2019-03-21 15:32:58 +00:00
% from get_providers import update_throttled_provider
% update_throttled_provider()
2018-08-16 02:01:49 +00:00
2019-03-21 15:32:58 +00:00
% import ast
% import datetime
2017-12-23 03:56:04 +00:00
% import os
2019-10-26 18:52:22 +00:00
% from database import database
2019-08-08 10:33:00 +00:00
% import operator
2018-12-15 00:36:28 +00:00
% from config import settings
2019-09-18 15:30:46 +00:00
% from functools import reduce
2017-12-23 03:40:14 +00:00
2019-10-26 18:52:22 +00:00
%if settings.sonarr.getboolean('only_monitored'):
% monitored_only_query_string_sonarr = ' AND monitored = "True"'
%else:
% monitored_only_query_string_sonarr = ""
2019-01-06 17:15:43 +00:00
%end
2019-10-26 18:52:22 +00:00
%if settings.radarr.getboolean('only_monitored'):
% monitored_only_query_string_radarr = ' AND monitored = "True"'
%else:
% monitored_only_query_string_radarr = ""
2018-08-09 03:43:13 +00:00
%end
2019-10-28 00:45:15 +00:00
% wanted_series = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr, only_one=True)['count']
% wanted_movies = database.execute("SELECT COUNT(*) as count FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr, only_one=True)['count']
2019-03-21 15:32:58 +00:00
% from get_providers import list_throttled_providers
% throttled_providers_count = len(eval(str(settings.general.throtteled_providers)))
2017-12-23 03:40:14 +00:00
< div id = "divmenu" class = "ui container" >
2019-04-20 21:15:00 +00:00
< div class = "ui grid" >
2019-04-17 03:05:34 +00:00
< div class = "three wide column" >
2019-04-20 21:15:00 +00:00
< div class = "ui compact segment menu_segment" >
2017-12-22 00:49:39 +00:00
< a href = "{{base_url}}" > < img class = "logo" src = "{{base_url}}static/logo128.png" > < / a >
< / div >
2019-04-17 03:05:34 +00:00
< / div >
< div class = "ten wide right aligned compact column" >
< div id = "button_menu" class = "ui center aligned segment menu_segment" hidden = "hidden" >
< div class = "ui inverted compact borderless labeled icon massive menu menu_segment" >
% if settings.general.getboolean('use_sonarr'):
< a class = "item" href = "{{base_url}}series" >
< i class = "play icon" > < / i >
Series
< / a >
% end
% if settings.general.getboolean('use_radarr'):
< a class = "item" href = "{{base_url}}movies" >
< i class = "film icon" > < / i >
Movies
< / a >
% end
< 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" >
2019-08-08 10:33:00 +00:00
% if settings.general.getboolean('use_sonarr') and wanted_series > 0:
2019-12-02 22:14:19 +00:00
< div id = "wanted_series" class = "floating ui tiny yellow label" style = "left:90% !important;top:0.5em !important;" >
2019-08-08 10:33:00 +00:00
{{wanted_series}}
2019-04-17 03:05:34 +00:00
< / div >
% end
2019-08-08 10:33:00 +00:00
% if settings.general.getboolean('use_radarr') and wanted_movies > 0:
2019-12-02 22:14:19 +00:00
< div id = "wanted_movies" class = "floating ui tiny green label" style = "left:90% !important;top:3em !important;" >
2019-08-08 10:33:00 +00:00
{{wanted_movies}}
2019-04-17 03:05:34 +00:00
< / div >
% end
< / i >
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" >
% if throttled_providers_count:
< div class = "floating ui tiny yellow label" style = "left:90% !important;top:0.5em !important;" >
{{throttled_providers_count}}
< / div >
% end
< / i >
System
< / a >
< a id = "donate" class = "item" href = "https://beerpay.io/morpheus65535/bazarr" >
< i class = "red heart icon" > < / i >
Donate
< / a >
< / div >
< / div >
< div class = "ui center aligned segment menu_segment" >
2017-12-22 00:49:39 +00:00
< div class = "ui grid" >
2019-04-20 21:15:00 +00:00
< div id = "search_column" class = "centered column" >
2019-04-17 03:05:34 +00:00
< div class = "ui fluid search" >
< div class = "ui left icon fluid input" >
< input class = "prompt" type = "text" placeholder = "Search in your library" >
< i class = "searchicon search icon" > < / i >
2017-12-22 00:49:39 +00:00
< / div >
< / div >
< / div >
2019-04-17 03:05:34 +00:00
< / div >
< / div >
< / div >
< div class = "three wide right aligned column" >
< div id = "dropdown_menu" class = "ui segment menu_segment" hidden = "hidden" >
2019-04-20 21:15:00 +00:00
< div id = "icon_menu" class = "ui compact tiny icon menu" >
2019-04-17 03:05:34 +00:00
< div id = "dropdown_menu_button" class = "ui floating right dropdown item" >
2019-04-20 21:15:00 +00:00
< i class = "inverted bars icon" > < / i >
2019-04-17 03:05:34 +00:00
< div class = "ui menu" >
% if settings.general.getboolean('use_sonarr'):
< a class = "item" href = "{{base_url}}series" >
< i class = "play icon" > < / i >
Series
< / a >
% end
% if settings.general.getboolean('use_radarr'):
< a class = "item" href = "{{base_url}}movies" >
< i class = "film icon" > < / i >
Movies
< / a >
% end
< 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" > < / i >
< span style = "margin-right: 1em;" > Wanted< / span >
2019-08-08 10:33:00 +00:00
% if settings.general.getboolean('use_sonarr') and wanted_series > 0:
2019-04-17 03:05:34 +00:00
< div class = "ui tiny yellow label" >
2019-08-08 10:33:00 +00:00
{{wanted_series}}
2017-12-22 00:49:39 +00:00
< / div >
2019-04-17 03:05:34 +00:00
% end
2019-08-08 10:33:00 +00:00
% if settings.general.getboolean('use_radarr') and wanted_movies > 0:
2019-04-17 03:05:34 +00:00
< div class = "ui tiny green label" >
2019-08-08 10:33:00 +00:00
{{wanted_movies}}
2019-04-17 03:05:34 +00:00
< / div >
% end
< / 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" >
% if throttled_providers_count:
< div class = "floating ui tiny yellow label" style = "left:90% !important;top:0.5em !important;" >
{{throttled_providers_count}}
< / div >
% end
< / i >
System
< / a >
< a id = "donate" class = "item" href = "https://beerpay.io/morpheus65535/bazarr" >
< i class = "red heart icon" > < / i >
Donate
< / a >
2017-12-22 00:49:39 +00:00
< / div >
< / div >
< / div >
2019-04-17 03:05:34 +00:00
< / div >
< / div >
< / div >
2017-12-23 03:40:14 +00:00
2019-10-26 18:52:22 +00:00
% restart_required = database.execute("SELECT configured, updated FROM system")
2019-08-08 10:33:00 +00:00
% for item in restart_required:
% restart_required = item
% break
% end
2017-12-23 03:40:14 +00:00
2019-10-26 18:52:22 +00:00
% if restart_required['updated'] == '1' and restart_required['configured'] == '1':
2019-09-17 15:33:59 +00:00
< div class = 'ui center aligned grid' > < div class = 'fifteen wide column' > < div class = "ui red message" > Bazarr Needs To Be Restarted To Apply The Last Update & Changes To General Settings. Click < a href = # id = "restart_link" > Here< / a > To Restart.< / div > < / div > < / div >
2019-10-26 18:52:22 +00:00
% elif restart_required['updated'] == '1':
2019-09-17 15:33:59 +00:00
< div class = 'ui center aligned grid' > < div class = 'fifteen wide column' > < div class = "ui red message" > Bazarr Needs To Be Restarted To Apply Changes To The Last Update. Click < a href = # id = "restart_link" > Here< / a > To Restart.< / div > < / div > < / div >
2019-10-26 18:52:22 +00:00
% elif restart_required['configured'] == '1':
2019-09-17 15:33:59 +00:00
< div class = 'ui center aligned grid' > < div class = 'fifteen wide column' > < div class = "ui red message" > Bazarr Needs 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
2019-11-08 04:44:17 +00:00
% from six import PY2
% import datetime
% if PY2:
2019-11-21 11:59:44 +00:00
< div class = 'ui left aligned grid' >
< div class = 'fluid column' >
< div class = "ui yellow icon message" >
< i class = "python icon" > < / i >
< div class = "content" >
< div class = "header" > Python deprecation warning< / div >
Bazarr is now compatible with Python 3.6 and newer. You should upgrade Python as we'll drop support for Python 2.7.x by the end of 2019.
< div class = "ui bulleted list" >
% if os.name == 'posix':
< div class = "item" > If you are running under Docker, don't worry, we'll take care of this for you. Just pull the new image.< / div >
% end
% if os.name == 'nt':
< div class = "item" > If you have installed using the Windows Installer, we'll provide a new installer soon.< / div >
% end
< div class = "item" > If you are running from source, it's up to you to install Python 3 and use it to run Bazarr.< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
2019-11-08 04:44:17 +00:00
% end
2019-02-15 23:21:31 +00:00
< / div >
2017-12-22 00:49:39 +00:00
< / body >
< / html >
< script >
2019-04-17 03:05:34 +00:00
$('.ui.dropdown').dropdown();
2017-12-22 00:49:39 +00:00
$('.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) {
2018-12-09 20:23:51 +00:00
const response = {
2017-12-22 00:49:39 +00:00
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) {
2019-09-28 17:52:47 +00:00
$('.menu_segment').css('background', 'rgba(0, 0, 0, 0.8)');
2019-04-17 03:05:34 +00:00
$('.menu_segment').css('border-color', '#000000');
2019-09-28 17:52:47 +00:00
$('#divmenu').css('background', 'rgba(0, 0, 0, 0.8)');
2018-12-09 20:23:51 +00:00
$('#divmenu').css('box-shadow', '0 0 5px 5px #000000');
2018-09-28 14:40:36 +00:00
}
else if (window.location.href.indexOf("movie/") > -1) {
2019-09-28 17:52:47 +00:00
$('.menu_segment').css('background', 'rgba(0, 0, 0, 0.9)');
2019-04-17 03:05:34 +00:00
$('.menu_segment').css('border-color', '#000000');
2019-09-28 17:52:47 +00:00
$('#divmenu').css('background', 'rgba(0, 0, 0, 0.8)');
2018-12-09 20:23:51 +00:00
$('#divmenu').css('box-shadow', '0 0 5px 5px #000000');
2017-12-22 03:36:22 +00:00
}
else {
2019-04-17 03:05:34 +00:00
$('.menu_segment').css('background', '#272727');
$('.menu_segment').css('border-color', '#272727');
2017-12-22 03:36:22 +00:00
$('#divmenu').css('background', '#272727');
}
2018-10-14 13:32:16 +00:00
2018-12-09 20:23:51 +00:00
$('#restart_link').on('click', function(){
2019-09-17 15:33:59 +00:00
$('#loader_text').text("Bazarr is restarting. Please Wait...");
2018-10-14 13:32:16 +00:00
$.ajax({
2019-12-02 22:14:19 +00:00
url: {{url_for('restart')}},
2019-11-12 01:53:46 +00:00
async: true,
error: (function(){
setTimeout(function(){ setInterval(ping, 2000); },8000);
})
2018-10-14 13:32:16 +00:00
})
2018-12-09 20:23:51 +00:00
});
2018-10-14 13:32:16 +00:00
function ping() {
$.ajax({
2019-12-02 22:14:19 +00:00
url: {{url_for('redirect_root')}},
2018-10-14 13:32:16 +00:00
success: function(result) {
2019-12-02 22:14:19 +00:00
window.location.href= {{url_for('redirect_root')}};
2018-10-14 13:32:16 +00:00
}
});
}
2019-04-17 03:05:34 +00:00
$( window ).on('resize', function () {
if($(window).width() < 1024 ) {
$('#button_menu').hide();
$('#dropdown_menu').show();
2019-04-20 21:15:00 +00:00
$('#search_column').removeClass('ten wide');
2019-04-17 03:05:34 +00:00
} else {
$('#dropdown_menu').hide();
$('#button_menu').show();
2019-04-20 21:15:00 +00:00
$('#search_column').addClass('ten wide');
2019-04-17 03:05:34 +00:00
}
}).resize();
2018-11-30 02:24:48 +00:00
2019-02-25 04:05:58 +00:00
var url_notifications = location.protocol +"//" + window.location.host + "{{base_url}}notifications";
var notificationTimeout;
2019-02-21 04:30:25 +00:00
var timeout;
var killer;
2019-04-23 01:08:26 +00:00
var item = {};
var length = {};
2019-02-25 04:05:58 +00:00
function doNotificationsAjax() {
2019-02-21 04:30:25 +00:00
$.ajax({
2019-12-02 22:14:19 +00:00
url: {{url_for('notifications')}},
2019-02-21 04:30:25 +00:00
success: function (data) {
if (data !== "") {
data = JSON.parse(data);
var msg = data[0];
var type = data[1];
var duration = data[2];
var button = data[3];
2019-02-24 03:58:13 +00:00
var queue = data[4];
2019-04-04 19:04:06 +00:00
var item = data[5];
var length = data[6];
if (length === 0) {
var message = msg;
} else {
2019-04-23 01:08:26 +00:00
var message = msg + '< p > < div class = "ui disabled progress notification_progress" data-value = ' + item + ' data-total = ' + length + ' style = "margin-bottom: -0.25em" > < div class = "bar" > < div class = "progress" > < / div > < / div > < / div > '
2019-04-04 19:04:06 +00:00
}
2019-02-21 04:30:25 +00:00
2019-04-04 13:29:08 +00:00
if (duration === 'temporary') {
timeout = 3000;
killer = queue;
} else if (duration === 'long') {
timeout = 15000;
killer = queue;
} else {
2019-02-21 04:30:25 +00:00
timeout = false;
killer = false;
}
if (button === 'refresh') {
button = [ Noty.button('Refresh', 'ui tiny primary button', function () { window.location.reload() }) ];
} else if (button === 'restart') {
// to be completed
2019-09-17 15:33:59 +00:00
button = [ Noty.button('Restart', 'ui tiny primary button', function () { alert('Restart Not Implemented Yet!') }) ];
2019-02-21 04:30:25 +00:00
} else {
button = [];
}
2019-01-01 04:46:33 +00:00
2019-02-21 04:30:25 +00:00
new Noty({
2019-04-04 19:04:06 +00:00
text: message,
2019-02-21 04:30:25 +00:00
progressBar: false,
animation: {
open: null,
close: null
},
type: type,
layout: 'bottomRight',
theme: 'semanticui',
2019-02-24 03:58:13 +00:00
queue: queue,
2019-02-21 04:30:25 +00:00
timeout: timeout,
killer: killer,
buttons: button,
2019-04-23 01:08:26 +00:00
force: false
2019-02-21 04:30:25 +00:00
}).show();
2019-04-04 19:04:06 +00:00
$('.notification_progress').progress({
duration : 0,
autoSuccess: false,
2019-04-19 19:49:45 +00:00
label: 'ratio',
text: {
ratio: '{value} / {total}'
}
2019-04-04 19:04:06 +00:00
});
2019-02-21 04:30:25 +00:00
}
},
complete: function (data) {
// Schedule the next
2019-08-15 12:05:58 +00:00
if (data.responseText !== "") {
2019-02-25 04:05:58 +00:00
notificationTimeout = setTimeout(doNotificationsAjax, 100);
2019-02-21 04:30:25 +00:00
} else {
2019-08-15 12:05:58 +00:00
notificationTimeout = setTimeout(doNotificationsAjax, 5000);
2019-02-21 04:30:25 +00:00
}
2019-08-15 12:05:58 +00:00
},
error: function () {
notificationTimeout = setTimeout(doNotificationsAjax, 5000);
}
2019-02-21 04:30:25 +00:00
});
}
2019-02-25 04:05:58 +00:00
notificationTimeout = setTimeout(doNotificationsAjax, 1000);
2019-02-21 04:30:25 +00:00
2019-02-25 04:05:58 +00:00
var tasksTimeout;
function doTasksAjax() {
$.ajax({
2019-12-02 22:14:19 +00:00
url: {{url_for('running_tasks_list')}},
2019-02-25 04:05:58 +00:00
dataType: 'json',
success: function (data) {
$('#tasks > tbody > tr').each(function() {
if ($.inArray($(this).attr('id'), data['tasks']) > -1) {
$(this).find('td:last').find('div:first').addClass('disabled');
$(this).find('td:last').find('div:first').find('i:first').addClass('loading');
} else {
$(this).find('td:last').find('div:first').removeClass('disabled');
$(this).find('td:last').find('div:first').find('i:first').removeClass('loading');
}
});
if ($.inArray('wanted_search_missing_subtitles', data['tasks']) > -1) {
$('#wanted_search_missing_subtitles').addClass('disabled');
$('#wanted_search_missing_subtitles_movies').addClass('disabled');
$('#wanted_search_missing_subtitles').find('i:first').addClass('loading');
$('#wanted_search_missing_subtitles_movies').find('i:first').addClass('loading');
} else {
$('#wanted_search_missing_subtitles').removeClass('disabled');
$('#wanted_search_missing_subtitles_movies').removeClass('disabled');
$('#wanted_search_missing_subtitles').find('i:first').removeClass('loading');
$('#wanted_search_missing_subtitles_movies').find('i:first').removeClass('loading');
}
%if 'no' in locals():
if ($.inArray('search_missing_subtitles_{{no}}', data['tasks']) > -1) {
$('#search_missing_subtitles').addClass('disabled');
$('#search_missing_subtitles').find('i:first').addClass('loading');
} else {
$('#search_missing_subtitles').removeClass('disabled');
$('#search_missing_subtitles').find('i:first').removeClass('loading');
}
if ($.inArray('search_missing_subtitles_movie_{{no}}', data['tasks']) > -1) {
$('#search_missing_subtitles_movie').addClass('disabled');
$('#search_missing_subtitles_movie').find('i:first').addClass('loading');
} else {
$('#search_missing_subtitles_movie').removeClass('disabled');
$('#search_missing_subtitles_movie').find('i:first').removeClass('loading');
}
%end
},
complete: function (data) {
// Schedule the next
tasksTimeout = setTimeout(doTasksAjax, 5000);
}
});
}
tasksTimeout = setTimeout(doTasksAjax, 500);
$(window).bind('beforeunload', function(){
clearTimeout(tasksTimeout);
2019-12-02 22:14:19 +00:00
clearTimeout(notificationTimeout);
2019-02-21 04:30:25 +00:00
});
2019-09-17 15:33:59 +00:00
< / script >