1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 01:27:07 +00:00

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(){ $('#search_missing_subtitles').on('click', function(){
$('#loader_text').text("Searching for missing subtitles..."); $(this).addClass('disabled');
window.location = '{{base_url}}search_missing_subtitles/{{no}}'; $(this).find('i:first').addClass('loading');
$.ajax({
url: '{{base_url}}search_missing_subtitles/{{no}}'
})
}); });
$('.remove_subtitles').on('click', function(){ $('.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'); $('#loader').addClass('active');
}); });

View file

@ -19,6 +19,8 @@
.searchicon { .searchicon {
color: white !important; color: white !important;
} }
div.disabled { pointer-events: none; }
button.disabled { pointer-events: none; }
</style> </style>
</head> </head>
<body> <body>
@ -222,13 +224,13 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
var url = location.protocol +"//" + window.location.host + "{{base_url}}notifications"; var url_notifications = location.protocol +"//" + window.location.host + "{{base_url}}notifications";
var notification; var notificationTimeout;
var timeout; var timeout;
var killer; var killer;
function doAjax() { function doNotificationsAjax() {
$.ajax({ $.ajax({
url: url, url: url_notifications,
success: function (data) { success: function (data) {
if (data !== "") { if (data !== "") {
data = JSON.parse(data); data = JSON.parse(data);
@ -275,17 +277,79 @@
}, },
complete: function (data) { complete: function (data) {
// Schedule the next // Schedule the next
if (data != "") { if (data !== "") {
notification = setTimeout(doAjax, 100); notificationTimeout = setTimeout(doNotificationsAjax, 100);
} else { } else {
notification = setTimeout(doAjax, 1000); notificationTimeout = setTimeout(doNotificationsAjax, 1000);
} }
} }
}); });
} }
notification = setTimeout(doAjax, 1000); notificationTimeout = setTimeout(doNotificationsAjax, 1000);
$(window).bind('beforeunload', function(){ $(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> </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]}}"> <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"> <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="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 = ast.literal_eval(str(details[7]))
subs_languages_list = [] subs_languages_list = []
@ -314,9 +314,12 @@
window.location = '{{base_url}}scan_disk_movie/{{no}}'; window.location = '{{base_url}}scan_disk_movie/{{no}}';
}); });
$('#search_missing_subtitles').on('click', function(){ $('#search_missing_subtitles_movie').on('click', function(){
$('#loader_text').text("Searching for missing subtitles..."); $(this).addClass('disabled');
window.location = '{{base_url}}search_missing_subtitles_movie/{{no}}'; $(this).find('i:first').addClass('loading');
$.ajax({
url: '{{base_url}}search_missing_subtitles_movie/{{no}}'
})
}); });
$('.remove_subtitles').on('click', function(){ $('.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'); $('#loader').addClass('active');
}); });

View file

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

View file

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

View file

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