Merge remote-tracking branch 'origin/development' into halali

This commit is contained in:
Louis Vézina 2019-02-25 19:56:03 -05:00
commit 5f2a98776f
6 changed files with 106 additions and 26 deletions

View File

@ -361,8 +361,11 @@
});
$('#search_missing_subtitles').on('click', function(){
$('#loader_text').text("Searching for missing subtitles...");
window.location = '{{base_url}}search_missing_subtitles/{{no}}';
$(this).addClass('disabled');
$(this).find('i:first').addClass('loading');
$.ajax({
url: '{{base_url}}search_missing_subtitles/{{no}}'
})
});
$('.remove_subtitles').on('click', function(){
@ -418,7 +421,7 @@
});
});
$('a:not(.manual_search), .menu .item, button:not(#config, .cancel)').on('click', function(){
$('a:not(.manual_search), .menu .item, button:not(#config, .cancel, #search_missing_subtitles)').on('click', function(){
$('#loader').addClass('active');
});

View File

@ -19,6 +19,8 @@
.searchicon {
color: white !important;
}
div.disabled { pointer-events: none; }
button.disabled { pointer-events: none; }
</style>
</head>
<body>
@ -222,13 +224,13 @@
</script>
<script type="text/javascript">
var url = location.protocol +"//" + window.location.host + "{{base_url}}notifications";
var notification;
var url_notifications = location.protocol +"//" + window.location.host + "{{base_url}}notifications";
var notificationTimeout;
var timeout;
var killer;
function doAjax() {
function doNotificationsAjax() {
$.ajax({
url: url,
url: url_notifications,
success: function (data) {
if (data !== "") {
data = JSON.parse(data);
@ -275,17 +277,79 @@
},
complete: function (data) {
// Schedule the next
if (data != "") {
notification = setTimeout(doAjax, 100);
if (data !== "") {
notificationTimeout = setTimeout(doNotificationsAjax, 100);
} else {
notification = setTimeout(doAjax, 1000);
notificationTimeout = setTimeout(doNotificationsAjax, 1000);
}
}
});
}
notification = setTimeout(doAjax, 1000);
notificationTimeout = setTimeout(doNotificationsAjax, 1000);
$(window).bind('beforeunload', function(){
clearTimeout(notification);
clearTimeout(notificationTimeout);
});
</script>
<script type="text/javascript">
var url_tasks = location.protocol +"//" + window.location.host + "{{base_url}}running_tasks";
var tasksTimeout;
function doTasksAjax() {
$.ajax({
url: url_tasks,
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);
});
</script>

View File

@ -94,7 +94,7 @@
<img class="left floated ui image" style="max-height:250px;" src="{{base_url}}image_proxy_movies{{details[2]}}">
<div class="ui right floated basic icon buttons">
<button id="scan_disk" class="ui button" data-tooltip="Scan disk for subtitles" data-inverted=""><i class="ui inverted large compact refresh icon"></i></button>
<button id="search_missing_subtitles" class="ui button" data-tooltip="Download missing subtitles" data-inverted=""><i class="ui inverted huge compact search icon"></i></button>
<button id="search_missing_subtitles_movie" class="ui button" data-tooltip="Download missing subtitles" data-inverted=""><i class="ui inverted huge compact search icon"></i></button>
<%
subs_languages = ast.literal_eval(str(details[7]))
subs_languages_list = []
@ -314,9 +314,12 @@
window.location = '{{base_url}}scan_disk_movie/{{no}}';
});
$('#search_missing_subtitles').on('click', function(){
$('#loader_text').text("Searching for missing subtitles...");
window.location = '{{base_url}}search_missing_subtitles_movie/{{no}}';
$('#search_missing_subtitles_movie').on('click', function(){
$(this).addClass('disabled');
$(this).find('i:first').addClass('loading');
$.ajax({
url: '{{base_url}}search_missing_subtitles_movie/{{no}}'
})
});
$('.remove_subtitles').on('click', function(){
@ -371,7 +374,7 @@
});
});
$('a, .menu .item, button:not(#config, .cancel, .manual_search)').on('click', function(){
$('a, .menu .item, button:not(#config, .cancel, .manual_search, #search_missing_subtitles_movie)').on('click', function(){
$('#loader').addClass('active');
});

View File

@ -62,7 +62,7 @@
</div>
<div class="ui bottom attached tab segment active" data-tab="tasks">
<div class="content">
<table class="ui very basic selectable table">
<table class="ui very basic selectable table" id="tasks">
<thead>
<tr>
<th>Name</th>
@ -73,7 +73,7 @@
</thead>
<tbody>
%for task in task_list:
<tr>
<tr id="{{task[3]}}">
<td>{{task[0]}}</td>
<td>{{task[1]}}</td>
<td>{{task[2]}}</td>
@ -346,7 +346,11 @@
});
$('.execute').on('click', function(){
window.location = '{{base_url}}execute/' + $(this).data("taskid");
$(this).addClass('disabled');
$(this).find('i:first').addClass('loading');
$.ajax({
url: '{{base_url}}execute/' + $(this).data("taskid")
})
});
$('a:not(.tabs), button:not(.cancel, #download_log), #restart').on('click', function(){

View File

@ -139,7 +139,7 @@
<script>
$('a, button').on('click', function(){
$('a, button:not(#wanted_search_missing_subtitles_movies)').on('click', function(){
$('#loader').addClass('active');
});
@ -157,8 +157,11 @@
});
$('#wanted_search_missing_subtitles_movies').on('click', function(){
$('#loader_text').text("Searching for missing subtitles...");
window.location = '{{base_url}}wanted_search_missing_subtitles';
$(this).addClass('disabled');
$(this).find('i:first').addClass('loading');
$.ajax({
url: '{{base_url}}wanted_search_missing_subtitles'
})
});
$('.get_subtitle').on('click', function(){

View File

@ -146,7 +146,7 @@
<script>
$('a, button').on('click', function(){
$('a, button:not(#wanted_search_missing_subtitles)').on('click', function(){
$('#loader').addClass('active');
});
@ -164,8 +164,11 @@
});
$('#wanted_search_missing_subtitles').on('click', function(){
$('#loader_text').text("Searching for missing subtitles...");
window.location = '{{base_url}}wanted_search_missing_subtitles';
$(this).addClass('disabled');
$(this).find('i:first').addClass('loading');
$.ajax({
url: '{{base_url}}wanted_search_missing_subtitles'
})
});
$('.get_subtitle').on('click', function(){