Merge branch 'development' into python3

pull/684/head
Louis Vézina 5 years ago
commit 4626d3f93c

@ -370,12 +370,18 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa
not_matched = scores - matches not_matched = scores - matches
s.score = score s.score = score
releases = ['n/a']
if hasattr(s, 'release_info'):
if s.release_info is not None:
releases = s.release_info.split(',')
subtitles_list.append( subtitles_list.append(
dict(score=round((score / max_score * 100), 2), dict(score=round((score / max_score * 100), 2),
language=str(s.language), hearing_impaired=str(s.hearing_impaired), language=str(s.language), hearing_impaired=str(s.hearing_impaired),
provider=s.provider_name, provider=s.provider_name,
subtitle=codecs.encode(pickle.dumps(s.make_picklable()), "base64").decode(), subtitle=codecs.encode(pickle.dumps(s.make_picklable()), "base64").decode(),
url=s.page_link, matches=list(matches), dont_matches=list(not_matched))) url=s.page_link, matches=list(matches), dont_matches=list(not_matched),
release_info=releases))
final_subtitles = sorted(subtitles_list, key=lambda x: x['score'], reverse=True) final_subtitles = sorted(subtitles_list, key=lambda x: x['score'], reverse=True)
logging.debug('BAZARR ' + str(len(final_subtitles)) + " Subtitles have been found for this file: " + path) logging.debug('BAZARR ' + str(len(final_subtitles)) + " Subtitles have been found for this file: " + path)

@ -101,12 +101,11 @@ def get_sonarr_version():
use_sonarr = settings.general.getboolean('use_sonarr') use_sonarr = settings.general.getboolean('use_sonarr')
apikey_sonarr = settings.sonarr.apikey apikey_sonarr = settings.sonarr.apikey
sv = url_sonarr + "/api/system/status?apikey=" + apikey_sonarr sv = url_sonarr + "/api/system/status?apikey=" + apikey_sonarr
sonarr_version = ''
if use_sonarr: if use_sonarr:
try: try:
sonarr_version = requests.get(sv, timeout=15, verify=False).json()['version'] sonarr_version = requests.get(sv, timeout=30, verify=False).json()['version']
except: except Exception as e:
sonarr_version = '' logging.DEBUG('BAZARR cannot get Sonarr version')
return sonarr_version return sonarr_version
@ -115,11 +114,10 @@ def get_radarr_version():
use_radarr = settings.general.getboolean('use_radarr') use_radarr = settings.general.getboolean('use_radarr')
apikey_radarr = settings.radarr.apikey apikey_radarr = settings.radarr.apikey
rv = url_radarr + "/api/system/status?apikey=" + apikey_radarr rv = url_radarr + "/api/system/status?apikey=" + apikey_radarr
radarr_version = ''
if use_radarr: if use_radarr:
try: try:
radarr_version = requests.get(rv, timeout=15, verify=False).json()['version'] radarr_version = requests.get(rv, timeout=30, verify=False).json()['version']
except: except Exception as e:
radarr_version = '' logging.DEBUG('BAZARR cannot get Radarr version')
return radarr_version return radarr_version

@ -383,16 +383,19 @@
<i class="close icon"></i> <i class="close icon"></i>
<div class="header"> <div class="header">
<span id="series_title_span"></span> - <span id="season"></span>x<span id="episode"></span> - <span id="episode_title"></span> <span id="series_title_span"></span> - <span id="season"></span>x<span id="episode"></span> - <span id="episode_title"></span>
<br><div class="ui tiny inverted label" style="background-color: #35c5f4;"><span id="episode_path_span"></span></div>
<br><div class="ui tiny inverted label" style="background-color: orange;"><span id="episode_scenename_span"></span></div>
</div> </div>
<div class="scrolling content"> <div class="scrolling content">
<table id="search_result" class="display" style="width:100%"> <table id="search_result" class="display" style="width:100%">
<thead> <thead>
<tr> <tr>
<th style="text-align: left;">Score:</th> <th style="text-align: left;">Score:</th>
<th style="text-align: left;">Language:</th> <th style="text-align: left;">Lang.:</th>
<th style="text-align: left;">Hearing-Impaired:</th> <th style="text-align: left;">HI:</th>
<th style="text-align: left;">Provider:</th> <th style="text-align: left;">Provider:</th>
<th style="text-align: left;">Based On:</th> <th style="text-align: left;">Matching:</th>
<th style="text-align: left;">Filename:</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -566,6 +569,8 @@
$("#season").html($(this).data("season")); $("#season").html($(this).data("season"));
$("#episode").html($(this).data("episode")); $("#episode").html($(this).data("episode"));
$("#episode_title").html($(this).data("episode_title")); $("#episode_title").html($(this).data("episode_title"));
$("#episode_path_span").html($(this).attr("data-episodePath"));
$("#episode_scenename_span").html($(this).attr("data-sceneName"));
episodePath = $(this).attr("data-episodePath"); episodePath = $(this).attr("data-episodePath");
sceneName = $(this).attr("data-sceneName"); sceneName = $(this).attr("data-sceneName");
@ -609,6 +614,7 @@
}, },
drawCallback: function(settings) { drawCallback: function(settings) {
$('.inline.dropdown').dropdown(); $('.inline.dropdown').dropdown();
$('.ui.accordion').accordion();
}, },
columns: [ columns: [
{ data: 'score', { data: 'score',
@ -653,6 +659,18 @@
return text; return text;
} }
}, },
{ data: null,
render: function ( data, type, row ) {
const array_release_info = data.release_info;
let i;
let text = '<div class="ui fluid accordion"><div class="title"><i class="dropdown icon"></i>...</div><div class="content">';
for (i = 0; i < array_release_info.length; i++) {
text += '<div class="ui tiny label" style="margin-bottom: 2px;">' + array_release_info[i] + '</div>';
}
text += '</div></div>';
return text;
}
},
{ data: null, { data: null,
render: function ( data, type, row ) { render: function ( data, type, row ) {
return '<a href="#" class="ui tiny label" onclick="manual_get(this, episodePath, sceneName, hi, sonarrSeriesId, sonarrEpisodeId)" data-subtitle="'+data.subtitle+'" data-provider="'+data.provider+'" data-language="'+data.language+'"><i class="ui download icon" style="margin-right:0px" ></i></a>'; return '<a href="#" class="ui tiny label" onclick="manual_get(this, episodePath, sceneName, hi, sonarrSeriesId, sonarrEpisodeId)" data-subtitle="'+data.subtitle+'" data-provider="'+data.provider+'" data-language="'+data.language+'"><i class="ui download icon" style="margin-right:0px" ></i></a>';

@ -262,19 +262,15 @@
; ;
if (window.location.href.indexOf("episodes") > -1) { if (window.location.href.indexOf("episodes") > -1) {
$('.menu_segment').css('background', '#000000'); $('.menu_segment').css('background', 'rgba(0, 0, 0, 0.8)');
$('.menu_segment').css('opacity', '0.9');
$('.menu_segment').css('border-color', '#000000'); $('.menu_segment').css('border-color', '#000000');
$('#divmenu').css('background', '#000000'); $('#divmenu').css('background', 'rgba(0, 0, 0, 0.8)');
$('#divmenu').css('opacity', '0.8');
$('#divmenu').css('box-shadow', '0 0 5px 5px #000000'); $('#divmenu').css('box-shadow', '0 0 5px 5px #000000');
} }
else if (window.location.href.indexOf("movie/") > -1) { else if (window.location.href.indexOf("movie/") > -1) {
$('.menu_segment').css('background', '#000000'); $('.menu_segment').css('background', 'rgba(0, 0, 0, 0.9)');
$('.menu_segment').css('opacity', '0.9');
$('.menu_segment').css('border-color', '#000000'); $('.menu_segment').css('border-color', '#000000');
$('#divmenu').css('background', '#000000'); $('#divmenu').css('background', 'rgba(0, 0, 0, 0.8)');
$('#divmenu').css('opacity', '0.8');
$('#divmenu').css('box-shadow', '0 0 5px 5px #000000'); $('#divmenu').css('box-shadow', '0 0 5px 5px #000000');
} }
else { else {

@ -79,6 +79,7 @@
</head> </head>
<body> <body>
%import ast %import ast
%from os import path
%from get_languages import * %from get_languages import *
%from config import settings %from config import settings
%from helper import path_replace_movie %from helper import path_replace_movie
@ -180,7 +181,11 @@
end end
%> %>
<tr> <tr>
<td>{{path_replace_movie(subtitles_file[1]) if subtitles_file[1] is not None else 'Video File Subtitles Track'}}</td> %if subtitles_file[1] is not None:
<td><span data-tooltip="Path is: {{path_replace_movie(subtitles_file[1])}}" data-inverted='' data-position="top left">{{path.basename(path_replace_movie(subtitles_file[1]))}}</span></td>
%else:
<td>Video File Subtitles Track</td>
%end
<td><div class="ui tiny inverted label" style='background-color: #777777;'>{{language_from_alpha2(subtitles_file[0].split(':')[0])}}{{' forced' if forced else ''}}</div></td> <td><div class="ui tiny inverted label" style='background-color: #777777;'>{{language_from_alpha2(subtitles_file[0].split(':')[0])}}{{' forced' if forced else ''}}</div></td>
<td> <td>
%if subtitles_file[1] is not None: %if subtitles_file[1] is not None:
@ -335,16 +340,19 @@
<i class="close icon"></i> <i class="close icon"></i>
<div class="header"> <div class="header">
<span id="movie_title_span"></span> <span id="movie_title_span"></span>
<br><div class="ui tiny inverted label" style="background-color: #35c5f4;"><span id="movie_path_span"></span></div>
<br><div class="ui tiny inverted label" style="background-color: orange;"><span id="movie_scenename_span"></span></div>
</div> </div>
<div class="scrolling content"> <div class="scrolling content">
<table id="search_result" class="display" style="width:100%"> <table id="search_result" class="display" style="width:100%">
<thead> <thead>
<tr> <tr>
<th style="text-align: left;">Score:</th> <th style="text-align: left;">Score:</th>
<th style="text-align: left;">Language:</th> <th style="text-align: left;">Lang.:</th>
<th style="text-align: left;">Hearing-Impaired:</th> <th style="text-align: left;">HI:</th>
<th style="text-align: left;">Provider:</th> <th style="text-align: left;">Provider:</th>
<th style="text-align: left;">Based On:</th> <th style="text-align: left;">Matching:</th>
<th style="text-align: left;">Subtitles filename:</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -513,6 +521,8 @@
$('.manual_search').on('click', function(){ $('.manual_search').on('click', function(){
$("#movie_title_span").html($(this).data("movie_title")); $("#movie_title_span").html($(this).data("movie_title"));
$("#movie_path_span").html($(this).attr("data-moviePath"));
$("#movie_scenename_span").html($(this).attr("data-sceneName"));
moviePath = $(this).attr("data-moviePath"); moviePath = $(this).attr("data-moviePath");
sceneName = $(this).attr("data-sceneName"); sceneName = $(this).attr("data-sceneName");
@ -554,6 +564,7 @@
}, },
drawCallback: function(settings) { drawCallback: function(settings) {
$('.inline.dropdown').dropdown(); $('.inline.dropdown').dropdown();
$('.ui.accordion').accordion();
}, },
columns: [ columns: [
{ data: 'score', { data: 'score',
@ -600,6 +611,18 @@
return text; return text;
} }
}, },
{ data: null,
render: function ( data, type, row ) {
const array_release_info = data.release_info;
let i;
let text = '<div class="ui fluid accordion"><div class="title"><i class="dropdown icon"></i>...</div><div class="content">';
for (i = 0; i < array_release_info.length; i++) {
text += '<div class="ui tiny label" style="margin-bottom: 2px;">' + array_release_info[i] + '</div>';
}
text += '</div></div>';
return text;
}
},
{ data: null, { data: null,
render: function ( data, type, row ) { render: function ( data, type, row ) {
return '<a href="#" class="ui tiny label" onclick="manual_get(this, moviePath, sceneName, hi, radarrId)" data-subtitle="'+data.subtitle+'" data-provider="'+data.provider+'" data-language="'+data.language+'"><i class="ui download icon" style="margin-right:0px" ></i></a>'; return '<a href="#" class="ui tiny label" onclick="manual_get(this, moviePath, sceneName, hi, radarrId)" data-subtitle="'+data.subtitle+'" data-provider="'+data.provider+'" data-language="'+data.language+'"><i class="ui download icon" style="margin-right:0px" ></i></a>';

Loading…
Cancel
Save