1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-24 08:43:01 +00:00
This commit is contained in:
Louis Vézina 2020-05-08 11:37:40 -04:00
parent c1c7ba5dc3
commit 961fae8aed
3 changed files with 26 additions and 6 deletions

View file

@ -8,6 +8,7 @@ import time
from get_args import args
from config import settings
from websocket_handler import event_stream
from subliminal_patch.exceptions import TooManyRequests, APIThrottled, ParseResponseError
from subliminal.exceptions import DownloadLimitExceeded, ServiceUnavailable
from subliminal import region as subliminal_cache_region
@ -235,6 +236,8 @@ def update_throttled_provider():
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
settings.write(handle)
event_stream.write(type='badges')
def list_throttled_providers():
update_throttled_provider()

View file

@ -237,6 +237,7 @@ def list_missing_subtitles(no=None, epno=None):
event_stream.write(type='episode', action='update', series=missing_subtitles_item[2],
episode=missing_subtitles_item[1])
event_stream.write(type='badges')
def list_missing_subtitles_movies(no=None):
@ -296,6 +297,7 @@ def list_missing_subtitles_movies(no=None):
(missing_subtitles_item[0], missing_subtitles_item[1]))
event_stream.write(type='movie', action='update', movie=missing_subtitles_item[1])
event_stream.write(type='badges')
def series_full_scan_subtitles():

View file

@ -194,10 +194,12 @@
class="hide-menu"> Wanted</span></a>
<ul aria-expanded="false" class="collapse">
{% if settings.general.getboolean('use_sonarr') %}
<li><a href="{{ url_for('wantedseries') }}"> Series</a></li>
<li>
<a href="{{ url_for('wantedseries') }}"> Series <span id="wanted_series_badge"></span></a>
</li>
{% endif %}
{% if settings.general.getboolean('use_radarr') %}
<li><a href="{{ url_for('wantedmovies') }}"> Movies</a></li>
<li><a href="{{ url_for('wantedmovies') }}"> Movies <span id="wanted_movies_badge"></span></a></li>
{% endif %}
</ul>
</li>
@ -221,7 +223,7 @@
<ul aria-expanded="false" class="collapse">
<li><a href="{{ url_for('systemtasks') }}"> Tasks</a></li>
<li><a href="{{ url_for('systemlogs') }}"> Logs</a></li>
<li><a href="{{ url_for('systemproviders') }}"> Providers</a></li>
<li><a href="{{ url_for('systemproviders') }}"> Providers <span id="throttled_providers_count"></span></a></li>
<li><a href="{{ url_for('systemstatus') }}"> Status</a></li>
<li><a href="{{ url_for('systemreleases') }}"> Releases</a></li>
</ul>
@ -328,19 +330,32 @@
$('#reconnect_overlay').show();
});
events.on('event', function (event) {
var event_json_badges = JSON.parse(event);
if (event_json_badges.type === 'badges') {
BadgesAjax();
}
});
function BadgesAjax() {
$.ajax({
url: "{{url_for('api.badges')}}",
async: true,
success: function (data) {
if (data['throttled_providers']) {
$('#throttled_providers_count').append('<div class="floating ui tiny yellow label" style="left:90% !important;top:0.5em !important;">' + data['throttled_providers'] + '</div>');
$('#throttled_providers_count').html('<span class="badge badge-secondary">' + data['throttled_providers'] + '</span>');
} else {
$('#throttled_providers_count').html('');
}
if (data['missing_episodes']) {
$('#wanted').append('<div class="floating ui tiny yellow label" style="left:90% !important;top:0.5em !important;">' + data['missing_episodes'] + '</div>');
$('#wanted_series_badge').html('<span class="badge badge-secondary">' + data['missing_episodes'] + '</span>');
} else {
$('#wanted_series_badge').html('');
}
if (data['missing_movies']) {
$('#wanted').append('<div id="wanted_movies" class="floating ui tiny green label" style="left:90% !important;top:3em !important;">' + data['missing_movies'] + '</div>');
$('#wanted_movies_badge').html('<span class="badge badge-secondary">' + data['missing_movies'] + '</span>');
} else {
$('#wanted_movies_badge').html('');
}
},