mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-24 16:52:06 +00:00
Improving series details panel
This commit is contained in:
parent
8d0ef690b2
commit
905c4b2798
3 changed files with 129 additions and 11 deletions
12
bazarr.py
12
bazarr.py
|
@ -1,4 +1,4 @@
|
||||||
bazarr_version = '0.2.3'
|
bazarr_version = '0.2.5'
|
||||||
|
|
||||||
from bottle import route, run, template, static_file, request, redirect, response
|
from bottle import route, run, template, static_file, request, redirect, response
|
||||||
import bottle
|
import bottle
|
||||||
|
@ -23,8 +23,8 @@ import urllib
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from init_db import *
|
from init_db import *
|
||||||
import update_db
|
from update_db import *
|
||||||
import update_modules
|
from update_modules import *
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from logging.handlers import TimedRotatingFileHandler
|
from logging.handlers import TimedRotatingFileHandler
|
||||||
|
@ -204,17 +204,19 @@ def episodes(no):
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
|
|
||||||
series_details = []
|
series_details = []
|
||||||
series_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tvdbid FROM table_shows WHERE sonarrSeriesId LIKE ?", (str(no),)).fetchone()
|
series_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tvdbid, audio_language, languages, path_substitution(path) FROM table_shows WHERE sonarrSeriesId LIKE ?", (str(no),)).fetchone()
|
||||||
tvdbid = series_details[5]
|
tvdbid = series_details[5]
|
||||||
|
|
||||||
episodes = c.execute("SELECT title, path_substitution(path), season, episode, subtitles, sonarrSeriesId, missing_subtitles, sonarrEpisodeId FROM table_episodes WHERE sonarrSeriesId LIKE ? ORDER BY episode ASC", (str(no),)).fetchall()
|
episodes = c.execute("SELECT title, path_substitution(path), season, episode, subtitles, sonarrSeriesId, missing_subtitles, sonarrEpisodeId FROM table_episodes WHERE sonarrSeriesId LIKE ? ORDER BY episode ASC", (str(no),)).fetchall()
|
||||||
|
number = len(episodes)
|
||||||
|
languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall()
|
||||||
c.close()
|
c.close()
|
||||||
episodes = reversed(sorted(episodes, key=operator.itemgetter(2)))
|
episodes = reversed(sorted(episodes, key=operator.itemgetter(2)))
|
||||||
seasons_list = []
|
seasons_list = []
|
||||||
for key,season in itertools.groupby(episodes,operator.itemgetter(2)):
|
for key,season in itertools.groupby(episodes,operator.itemgetter(2)):
|
||||||
seasons_list.append(list(season))
|
seasons_list.append(list(season))
|
||||||
|
|
||||||
return template('episodes', __file__=__file__, bazarr_version=bazarr_version, no=no, details=series_details, seasons=seasons_list, url_sonarr_short=url_sonarr_short, base_url=base_url, tvdbid=tvdbid)
|
return template('episodes', __file__=__file__, bazarr_version=bazarr_version, no=no, details=series_details, languages=languages, seasons=seasons_list, url_sonarr_short=url_sonarr_short, base_url=base_url, tvdbid=tvdbid, number=number)
|
||||||
|
|
||||||
@route(base_url + 'scan_disk/<no:int>', method='GET')
|
@route(base_url + 'scan_disk/<no:int>', method='GET')
|
||||||
def scan_disk(no):
|
def scan_disk(no):
|
||||||
|
|
|
@ -48,6 +48,18 @@
|
||||||
padding-right: 2em;
|
padding-right: 2em;
|
||||||
padding-bottom: 1em;
|
padding-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
.ui.basic.button:hover, .ui.basic.buttons .button:hover {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
.ui.basic.button:active, .ui.basic.buttons .button:active {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
.ui.basic.button:focus, .ui.basic.buttons .button:focus {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
.ui.basic.button:visited, .ui.basic.buttons .button:visited {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -77,17 +89,37 @@
|
||||||
<div style='padding-left: 2em; padding-right: 2em;' class='ui container'>
|
<div style='padding-left: 2em; padding-right: 2em;' class='ui container'>
|
||||||
<div id="divdetails" class="ui container">
|
<div id="divdetails" class="ui container">
|
||||||
<img class="left floated ui image" src="{{base_url}}image_proxy{{details[2]}}">
|
<img class="left floated ui image" src="{{base_url}}image_proxy{{details[2]}}">
|
||||||
<div class="ui right floated inverted basic buttons">
|
<div class="ui right floated basic icon buttons">
|
||||||
<button id="scan_disk" class="ui button"><i class="refresh icon"></i>Scan disk for subtitles</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"><i class="download icon"></i>Download missing subtitles</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>
|
||||||
|
<%
|
||||||
|
subs_languages = ast.literal_eval(str(details[7]))
|
||||||
|
subs_languages_list = []
|
||||||
|
if subs_languages is not None:
|
||||||
|
for subs_language in subs_languages:
|
||||||
|
subs_languages_list.append(subs_language)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<button id="config" class="ui button" data-tooltip="Edit series" data-inverted="" data-tvdbid="{{details[5]}}" data-title="{{details[0]}}" data-poster="{{details[2]}}" data-audio="{{details[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{details[4]}}"><i class="ui inverted large compact configure icon"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<h2>{{details[0]}}</h2>
|
<h2>{{details[0]}}</h2>
|
||||||
<p>{{details[1]}}</p>
|
<p>{{details[1]}}</p>
|
||||||
|
<p style='margin-top: 3em;'>
|
||||||
|
<div class="ui tiny inverted label" style='background-color: #777777;'>{{details[6]}}</div>
|
||||||
|
<div class="ui tiny inverted label" style='background-color: #35c5f4;'>{{details[8]}}</div>
|
||||||
|
<div class="ui tiny inverted label" style='background-color: #35c5f4;'>{{number}} files</div>
|
||||||
|
</p>
|
||||||
|
<p style='margin-top: 2em;'>
|
||||||
|
%for language in subs_languages_list:
|
||||||
|
<div class="ui tiny inverted label" style='background-color: #35c5f4;'>{{language}}</div>
|
||||||
|
%end
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
%if len(seasons) == 0:
|
%if len(seasons) == 0:
|
||||||
<div id="fondblanc" class="ui container">
|
<div id="fondblanc" class="ui container">
|
||||||
<h3 class="ui header">No episode file available for this series or Bazarr is still synchronizing with Sonarr. Please come back later.</h3>
|
<h3 class="ui header">No episode files available for this series or Bazarr is still synchronizing with Sonarr. Please come back later.</h3>
|
||||||
</div>
|
</div>
|
||||||
%else:
|
%else:
|
||||||
%for season in seasons:
|
%for season in seasons:
|
||||||
|
@ -170,6 +202,63 @@
|
||||||
%end
|
%end
|
||||||
%end
|
%end
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="ui small modal">
|
||||||
|
<i class="close icon"></i>
|
||||||
|
<div class="header">
|
||||||
|
<div id="series_title"></div>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<form name="series_form" id="series_form" action="" method="post" class="ui form">
|
||||||
|
<div class="ui grid">
|
||||||
|
<div class="four wide column">
|
||||||
|
<img id="series_poster" class="ui image" src="">
|
||||||
|
</div>
|
||||||
|
<div class="twelve wide column">
|
||||||
|
<div class="ui grid">
|
||||||
|
<div class="middle aligned row">
|
||||||
|
<div class="right aligned five wide column">
|
||||||
|
<label>Audio language</label>
|
||||||
|
</div>
|
||||||
|
<div class="nine wide column">
|
||||||
|
<div id="series_audio_language"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="middle aligned row">
|
||||||
|
<div class="right aligned five wide column">
|
||||||
|
<label>Subtitles languages</label>
|
||||||
|
</div>
|
||||||
|
<div class="nine wide column">
|
||||||
|
<select name="languages" id="series_languages" multiple="" class="ui fluid selection dropdown">
|
||||||
|
<option value="">Languages</option>
|
||||||
|
%for language in languages:
|
||||||
|
<option value="{{language[0]}}">{{language[1]}}</option>
|
||||||
|
%end
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="middle aligned row">
|
||||||
|
<div class="right aligned five wide column">
|
||||||
|
<label>Hearing-impaired</label>
|
||||||
|
</div>
|
||||||
|
<div class="nine wide column">
|
||||||
|
<div id="series_hearing-impaired_div" class="ui toggle checkbox">
|
||||||
|
<input name="hearing_impaired" id="series_hearing-impaired" type="checkbox">
|
||||||
|
<label></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
<button class="ui cancel button" >Cancel</button>
|
||||||
|
<button type="submit" name="save" value="save" form="series_form" class="ui blue approve button">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
% include('footer.tpl')
|
% include('footer.tpl')
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -222,4 +311,31 @@
|
||||||
$(document).ajaxStop(function(){
|
$(document).ajaxStop(function(){
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.modal')
|
||||||
|
.modal({
|
||||||
|
autofocus: false
|
||||||
|
})
|
||||||
|
;
|
||||||
|
|
||||||
|
$('#config').click(function(){
|
||||||
|
$('#series_form').attr('action', '{{base_url}}edit_series/{{no}}');
|
||||||
|
|
||||||
|
$("#series_title").html($(this).data("title"));
|
||||||
|
$("#series_poster").attr("src", "{{base_url}}image_proxy" + $(this).data("poster"));
|
||||||
|
|
||||||
|
$("#series_audio_language").html($(this).data("audio"));
|
||||||
|
|
||||||
|
$('#series_languages').dropdown('clear');
|
||||||
|
var languages_array = eval($(this).data("languages"));
|
||||||
|
$('#series_languages').dropdown('set selected',languages_array);
|
||||||
|
|
||||||
|
if ($(this).data("hearing-impaired") == "True") {
|
||||||
|
$("#series_hearing-impaired_div").checkbox('check');
|
||||||
|
} else {
|
||||||
|
$("#series_hearing-impaired_div").checkbox('uncheck');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.small.modal').modal('show');
|
||||||
|
})
|
||||||
</script>
|
</script>
|
|
@ -88,7 +88,7 @@
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
<div class="config ui inverted basic compact icon" data-tooltip="Edit series" data-inverted="" data-tvdbid="{{row[0]}}" data-title="{{row[1]}}" data-poster="{{row[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{row[4]}}" data-audio="{{row[7]}}">
|
<div class="config ui inverted basic compact icon" data-tooltip="Edit series" data-inverted="" data-no="{{row[5]}}" data-title="{{row[1]}}" data-poster="{{row[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{row[4]}}" data-audio="{{row[7]}}">
|
||||||
<i class="ui black configure icon"></i>
|
<i class="ui black configure icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -222,7 +222,7 @@
|
||||||
$('.config').click(function(){
|
$('.config').click(function(){
|
||||||
sessionStorage.scrolly=$(window).scrollTop();
|
sessionStorage.scrolly=$(window).scrollTop();
|
||||||
|
|
||||||
$('#series_form').attr('action', '{{base_url}}edit_series/' + $(this).data("tvdbid"));
|
$('#series_form').attr('action', '{{base_url}}edit_series/' + $(this).data("no"));
|
||||||
|
|
||||||
$("#series_title").html($(this).data("title"));
|
$("#series_title").html($(this).data("title"));
|
||||||
$("#series_poster").attr("src", "{{base_url}}image_proxy" + $(this).data("poster"));
|
$("#series_poster").attr("src", "{{base_url}}image_proxy" + $(this).data("poster"));
|
||||||
|
|
Loading…
Reference in a new issue