|
|
|
@ -20,9 +20,6 @@
|
|
|
|
|
{% endblock head_meta %}
|
|
|
|
|
|
|
|
|
|
{% block head_css %}
|
|
|
|
|
<link href="{{ url_for('static',filename='noty/noty.css') }}" rel="stylesheet">
|
|
|
|
|
<link href="{{ url_for('static',filename='semantic/semantic.min.css') }}" rel="stylesheet">
|
|
|
|
|
|
|
|
|
|
<link href="{{ url_for('static',filename='plugins/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
|
|
|
|
|
<!-- Custom CSS -->
|
|
|
|
|
<link href="{{ url_for('static',filename='css/style.css') }}" rel="stylesheet">
|
|
|
|
@ -206,32 +203,11 @@
|
|
|
|
|
<script src="{{ url_for('static',filename='plugins/sticky-kit-master/dist/sticky-kit.min.js') }}"></script>
|
|
|
|
|
<script src="{{ url_for('static',filename='plugins/sparkline/jquery.sparkline.min.js') }}"></script>
|
|
|
|
|
<!--Custom JavaScript -->
|
|
|
|
|
<script src="{{ url_for('static',filename='datatables/jquery.dataTables.min.js') }}"></script>
|
|
|
|
|
<script src="{{ url_for('static',filename='plugins/datatables.net-bs4/js/dataTables.bootstrap4.min.js') }}"></script>
|
|
|
|
|
<script src="{{ url_for('static',filename='js/custom.js') }}"></script>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
$('.ui.dropdown').dropdown();
|
|
|
|
|
|
|
|
|
|
$('.ui.search')
|
|
|
|
|
.search({
|
|
|
|
|
apiSettings: {
|
|
|
|
|
url: '{{base_url}}search_json/{query}',
|
|
|
|
|
onResponse: function (results) {
|
|
|
|
|
const response = {
|
|
|
|
|
results: []
|
|
|
|
|
};
|
|
|
|
|
$.each(results.items, function (index, item) {
|
|
|
|
|
response.results.push({
|
|
|
|
|
title: item.name,
|
|
|
|
|
url: item.url
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
minCharacters: 2
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function BadgesAjax() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{{url_for('api.badges')}}",
|
|
|
|
@ -258,212 +234,6 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BadgesAjax()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window.location.href.indexOf("episodes") > -1) {
|
|
|
|
|
$('.menu_segment').css('background', 'rgba(0, 0, 0, 0.8)');
|
|
|
|
|
$('.menu_segment').css('border-color', '#000000');
|
|
|
|
|
$('#divmenu').css('background', 'rgba(0, 0, 0, 0.8)');
|
|
|
|
|
$('#divmenu').css('box-shadow', '0 0 5px 5px #000000');
|
|
|
|
|
} else if (window.location.href.indexOf("movie/") > -1) {
|
|
|
|
|
$('.menu_segment').css('background', 'rgba(0, 0, 0, 0.9)');
|
|
|
|
|
$('.menu_segment').css('border-color', '#000000');
|
|
|
|
|
$('#divmenu').css('background', 'rgba(0, 0, 0, 0.8)');
|
|
|
|
|
$('#divmenu').css('box-shadow', '0 0 5px 5px #000000');
|
|
|
|
|
} else {
|
|
|
|
|
$('.menu_segment').css('background', '#272727');
|
|
|
|
|
$('.menu_segment').css('border-color', '#272727');
|
|
|
|
|
$('#divmenu').css('background', '#272727');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#restart_link').on('click', function () {
|
|
|
|
|
$('#loader_text').text("Bazarr is restarting. Please Wait...");
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: {{url_for('restart')}},
|
|
|
|
|
async: true,
|
|
|
|
|
error: (function () {
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
setInterval(ping, 2000);
|
|
|
|
|
}, 8000);
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function ping() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{{url_for('redirect_root')}}",
|
|
|
|
|
success: function (result) {
|
|
|
|
|
window.location.href = "{{url_for('redirect_root')}}";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(window).on('resize', function () {
|
|
|
|
|
if ($(window).width() < 1024) {
|
|
|
|
|
$('#button_menu').hide();
|
|
|
|
|
$('#dropdown_menu').show();
|
|
|
|
|
$('#search_column').removeClass('ten wide');
|
|
|
|
|
} else {
|
|
|
|
|
$('#dropdown_menu').hide();
|
|
|
|
|
$('#button_menu').show();
|
|
|
|
|
$('#search_column').addClass('ten wide');
|
|
|
|
|
}
|
|
|
|
|
}).resize();
|
|
|
|
|
|
|
|
|
|
var url_notifications = location.protocol + "//" + window.location.host + "{{base_url}}notifications";
|
|
|
|
|
var notificationTimeout;
|
|
|
|
|
var timeout;
|
|
|
|
|
var killer;
|
|
|
|
|
var item = {};
|
|
|
|
|
var length = {};
|
|
|
|
|
|
|
|
|
|
function doNotificationsAjax() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{{url_for('notifications')}}",
|
|
|
|
|
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];
|
|
|
|
|
var queue = data[4];
|
|
|
|
|
var item = data[5];
|
|
|
|
|
var length = data[6];
|
|
|
|
|
|
|
|
|
|
if (length === 0) {
|
|
|
|
|
var message = msg;
|
|
|
|
|
} else {
|
|
|
|
|
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>'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (duration === 'temporary') {
|
|
|
|
|
timeout = 3000;
|
|
|
|
|
killer = queue;
|
|
|
|
|
} else if (duration === 'long') {
|
|
|
|
|
timeout = 15000;
|
|
|
|
|
killer = queue;
|
|
|
|
|
} else {
|
|
|
|
|
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
|
|
|
|
|
button = [Noty.button('Restart', 'ui tiny primary button', function () {
|
|
|
|
|
alert('Restart Not Implemented Yet!')
|
|
|
|
|
})];
|
|
|
|
|
} else {
|
|
|
|
|
button = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new Noty({
|
|
|
|
|
text: message,
|
|
|
|
|
progressBar: false,
|
|
|
|
|
animation: {
|
|
|
|
|
open: null,
|
|
|
|
|
close: null
|
|
|
|
|
},
|
|
|
|
|
type: type,
|
|
|
|
|
layout: 'bottomRight',
|
|
|
|
|
theme: 'semanticui',
|
|
|
|
|
queue: queue,
|
|
|
|
|
timeout: timeout,
|
|
|
|
|
killer: killer,
|
|
|
|
|
buttons: button,
|
|
|
|
|
force: false
|
|
|
|
|
}).show();
|
|
|
|
|
|
|
|
|
|
$('.notification_progress').progress({
|
|
|
|
|
duration: 0,
|
|
|
|
|
autoSuccess: false,
|
|
|
|
|
label: 'ratio',
|
|
|
|
|
text: {
|
|
|
|
|
ratio: '{value} / {total}'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
complete: function (data) {
|
|
|
|
|
// Schedule the next
|
|
|
|
|
if (data.responseText !== "") {
|
|
|
|
|
notificationTimeout = setTimeout(doNotificationsAjax, 100);
|
|
|
|
|
} else {
|
|
|
|
|
notificationTimeout = setTimeout(doNotificationsAjax, 5000);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error: function () {
|
|
|
|
|
notificationTimeout = setTimeout(doNotificationsAjax, 5000);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// notificationTimeout = setTimeout(doNotificationsAjax, 1000);
|
|
|
|
|
|
|
|
|
|
var tasksTimeout;
|
|
|
|
|
|
|
|
|
|
function doTasksAjax() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{{url_for('running_tasks_list')}}",
|
|
|
|
|
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');
|
|
|
|
|
}
|
|
|
|
|
{% endif %}
|
|
|
|
|
},
|
|
|
|
|
complete: function (data) {
|
|
|
|
|
// Schedule the next
|
|
|
|
|
tasksTimeout = setTimeout(doTasksAjax, 5000);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// tasksTimeout = setTimeout(doTasksAjax, 500);
|
|
|
|
|
|
|
|
|
|
$(window).bind('beforeunload', function () {
|
|
|
|
|
clearTimeout(tasksTimeout);
|
|
|
|
|
clearTimeout(notificationTimeout);
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|