Implement series search

pull/26/head
morpheus65535 7 years ago
parent a4cbf4e5f9
commit 6331206cc1

@ -1,6 +1,6 @@
bazarr_version = '0.2.1'
bazarr_version = '0.2.2'
from bottle import route, run, template, static_file, request, redirect
from bottle import route, run, template, static_file, request, redirect, response
import bottle
bottle.debug(True)
bottle.TEMPLATES.clear()
@ -9,6 +9,7 @@ import os
bottle.TEMPLATE_PATH.insert(0,os.path.join(os.path.dirname(__file__), 'views/'))
import sqlite3
import json
import itertools
import operator
import requests
@ -135,9 +136,25 @@ def series():
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
languages = c.fetchall()
c.close()
output = template('series', rows=data, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url)
output = template('series', bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url)
return output
@route(base_url + 'series_json/<query>', method='GET')
def series_json(query):
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
c = db.cursor()
c.execute("SELECT title, sonarrSeriesId FROM table_shows WHERE title LIKE ? ORDER BY title", ('%'+query+'%',))
data = c.fetchall()
series_list = []
for serie in data:
series_list.append(dict([('name', serie[0]), ('url', base_url + 'episodes/' + str(serie[1]))]))
response.content_type = 'application/json'
return dict(items=series_list)
@route(base_url + 'edit_series/<no:int>', method='POST')
def edit_series(no):
ref = request.environ['HTTP_REFERER']
@ -187,7 +204,7 @@ def episodes(no):
for key,season in itertools.groupby(episodes,operator.itemgetter(2)):
seasons_list.append(list(season))
return template('episodes', no=no, details=series_details, seasons=seasons_list, url_sonarr_short=url_sonarr_short, base_url=base_url, tvdbid=tvdbid)
return template('episodes', bazarr_version=bazarr_version, no=no, details=series_details, seasons=seasons_list, url_sonarr_short=url_sonarr_short, base_url=base_url, tvdbid=tvdbid)
@route(base_url + 'scan_disk/<no:int>', method='GET')
def scan_disk(no):
@ -223,7 +240,7 @@ def history():
data = c.fetchall()
c.close()
data = reversed(sorted(data, key=operator.itemgetter(4)))
return template('history', rows=data, row_count=row_count, page=page, max_page=max_page, base_url=base_url)
return template('history', bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, base_url=base_url)
@route(base_url + 'wanted')
def wanted():
@ -243,7 +260,7 @@ def wanted():
c.execute("SELECT table_shows.title, table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, table_episodes.missing_subtitles, table_episodes.sonarrSeriesId, path_substitution(table_episodes.path), table_shows.hearing_impaired, table_episodes.sonarrEpisodeId FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.missing_subtitles != '[]' ORDER BY table_episodes._rowid_ DESC LIMIT 15 OFFSET ?", (offset,))
data = c.fetchall()
c.close()
return template('wanted', rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url)
return template('wanted', bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url)
@route(base_url + 'wanted_search_missing_subtitles')
def wanted_search_missing_subtitles_list():
@ -266,7 +283,7 @@ def settings():
c.execute("SELECT * FROM table_settings_sonarr")
settings_sonarr = c.fetchone()
c.close()
return template('settings', settings_general=settings_general, settings_languages=settings_languages, settings_providers=settings_providers, settings_sonarr=settings_sonarr, base_url=base_url)
return template('settings', bazarr_version=bazarr_version, settings_general=settings_general, settings_languages=settings_languages, settings_providers=settings_providers, settings_sonarr=settings_sonarr, base_url=base_url)
@route(base_url + 'save_settings', method='POST')
def save_settings():
@ -433,7 +450,7 @@ def system():
row_count = i
max_page = (row_count / 50) + 1
return template('system', base_url=base_url, task_list=task_list, row_count=row_count, max_page=max_page, bazarr_version=bazarr_version)
return template('system', bazarr_version=bazarr_version, base_url=base_url, task_list=task_list, row_count=row_count, max_page=max_page)
@route(base_url + 'logs/<page:int>')
def get_logs(page):

@ -25,14 +25,6 @@
background-size: cover;
background-position:center center;
}
#divmenu {
background-color: #272727;
opacity: 0.9;
padding-top: 2em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 128px;
}
#divdetails {
background-color: #000000;
opacity: 0.9;
@ -80,33 +72,7 @@
<div id='loader' class="ui page dimmer">
<div class="ui indeterminate text loader">Loading...</div>
</div>
<div id="divmenu" class="ui container">
<div style="background-color:#272727;" class="ui inverted borderless labeled icon huge menu five item">
<a href="{{base_url}}"><img style="margin-right:32px;" class="logo" src="{{base_url}}static/logo128.png"></a>
<div style="height:80px;" class="ui container">
<a class="item" href="{{base_url}}">
<i class="play icon"></i>
Series
</a>
<a class="item" href="{{base_url}}history">
<i class="wait icon"></i>
History
</a>
<a class="item" href="{{base_url}}wanted">
<i class="warning sign icon"></i>
Wanted
</a>
<a class="item" href="{{base_url}}settings">
<i class="settings icon"></i>
Settings
</a>
<a class="item" href="{{base_url}}system">
<i class="laptop icon"></i>
System
</a>
</div>
</div>
</div>
% include('menu.tpl')
<div style='padding-left: 2em; padding-right: 2em;' class='ui container'>
<div id="divdetails" class="ui container">
@ -201,8 +167,10 @@
</div>
</div>
</div>
%end
%end
</div>
% include('footer.tpl')
</body>
</html>

@ -0,0 +1,11 @@
<html>
<header>
<!DOCTYPE html>
</header>
<body>
<div style='margin-bottom:2em; color:Gray;' class="ui center aligned container">
Bazarr Ver. {{bazarr_version}}
</div>
</body>
</html>

@ -21,14 +21,6 @@
body {
background-color: #272727;
}
#divmenu {
background-color: #272727;
opacity: 0.9;
padding-top: 2em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 128px;
}
#fondblanc {
background-color: #ffffff;
border-radius: 0px;
@ -48,33 +40,7 @@
<div id='loader' class="ui page dimmer">
<div class="ui indeterminate text loader">Loading...</div>
</div>
<div id="divmenu" class="ui container">
<div style="background-color:#272727;" class="ui inverted borderless labeled icon huge menu five item">
<a href="{{base_url}}"><img style="margin-right:32px;" class="logo" src="{{base_url}}static/logo128.png"></a>
<div style="height:80px;" class="ui container">
<a class="item" href="{{base_url}}">
<i class="play icon"></i>
Series
</a>
<a class="item" href="{{base_url}}history">
<i class="wait icon"></i>
History
</a>
<a class="item" href="{{base_url}}wanted">
<i class="warning sign icon"></i>
Wanted
</a>
<a class="item" href="{{base_url}}settings">
<i class="settings icon"></i>
Settings
</a>
<a class="item" href="{{base_url}}system">
<i class="laptop icon"></i>
System
</a>
</div>
</div>
</div>
% include('menu.tpl')
<div id="fondblanc" class="ui container">
<table id="tablehistory" class="ui very basic selectable table">
@ -150,6 +116,7 @@
</div>
</div>
</div>
% include('footer.tpl')
</body>
</html>

@ -0,0 +1,105 @@
<html>
<head>
<!DOCTYPE html>
<style>
#divmenu {
background-color: #272727;
opacity: 0.9;
padding-top: 2em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 128px;
}
.icon {
color: LightGray;
}
.prompt {
background-color: #333333 !important;
color: white !important;
border-radius: 3px !important;
}
</style>
</head>
<body>
<div id="divmenu" class="ui container">
<div class="ui grid">
<div class="middle aligned row">
<div class="three wide column">
<a href="{{base_url}}"><img class="logo" src="{{base_url}}static/logo128.png"></a>
</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="row">
<div class="sixteen wide column">
<div style="background-color:#272727;" class="ui inverted borderless labeled icon massive menu five item">
<div class="ui container">
<a class="item" href="{{base_url}}">
<i class="play icon"></i>
Series
</a>
<a class="item" href="{{base_url}}history">
<i class="wait icon"></i>
History
</a>
<a class="item" href="{{base_url}}wanted">
<i class="warning sign icon"></i>
Wanted
</a>
<a class="item" href="{{base_url}}settings">
<i class="settings icon"></i>
Settings
</a>
<a class="item" href="{{base_url}}system">
<i class="laptop icon"></i>
System
</a>
</div>
</div>
</div>
</div>
<div style='padding-top:0rem;' class="row">
<div class="three wide column"></div>
<div class="ten wide column">
<div class="ui search">
<div class="ui left icon fluid input">
<input class="prompt" type="text" placeholder="Search the series in your library">
<i class="search icon"></i>
</div>
</div>
</div>
<div class="three wide column"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
$('.ui.search')
.search({
apiSettings: {
url: '{{base_url}}series_json/{query}',
onResponse: function(results) {
var response = {
results : []
};
$.each(results.items, function(index, item) {
response.results.push({
title : item.name,
url : item.url
});
});
return response;
}
},
minCharacters : 2
})
;
</script>

@ -5,7 +5,7 @@
<script src="{{base_url}}static/semantic/semantic.min.js"></script>
<script src="{{base_url}}static/jquery/tablesort.js"></script>
<link rel="stylesheet" href="{{base_url}}static/semantic/semantic.min.css">
<link rel="apple-touch-icon" sizes="120x120" href="{{base_url}}static/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{base_url}}static/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{base_url}}static/favicon-16x16.png">
@ -14,21 +14,13 @@
<link rel="shortcut icon" href="{{base_url}}static/favicon.ico">
<meta name="msapplication-config" content="{{base_url}}static/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<title>Bazarr</title>
<style>
body {
background-color: #272727;
}
#divmenu {
background-color: #272727;
opacity: 0.9;
padding-top: 2em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 128px;
}
#fondblanc {
background-color: #ffffff;
border-radius: 0px;
@ -44,7 +36,7 @@
min-height: 250px;
}
.fast.backward, .backward, .forward, .fast.forward {
cursor: pointer;
cursor: pointer;
}
.fast.backward, .backward, .forward, .fast.forward { pointer-events: auto; }
.fast.backward.disabled, .backward.disabled, .forward.disabled, .fast.forward.disabled { pointer-events: none; }
@ -52,36 +44,10 @@
</head>
<body>
<div id='loader' class="ui page dimmer">
<div class="ui indeterminate text loader">Loading...</div>
</div>
<div id="divmenu" class="ui container">
<div style="background-color:#272727;" class="ui inverted borderless labeled icon huge menu five item">
<a href="{{base_url}}"><img style="margin-right:32px;" class="logo" src="{{base_url}}static/logo128.png"></a>
<div style="height:80px;" class="ui container">
<a class="item" href="{{base_url}}">
<i class="play icon"></i>
Series
</a>
<a class="item" href="{{base_url}}history">
<i class="wait icon"></i>
History
</a>
<a class="item" href="{{base_url}}wanted">
<i class="warning sign icon"></i>
Wanted
</a>
<a class="item" href="{{base_url}}settings">
<i class="settings icon"></i>
Settings
</a>
<a class="item" href="{{base_url}}system">
<i class="laptop icon"></i>
System
</a>
</div>
</div>
<div class="ui indeterminate text loader">Loading...</div>
</div>
% include('menu.tpl')
<div id="fondblanc" class="ui container">
<table id="tableseries" class="ui very basic selectable sortable table">
<thead>
@ -132,31 +98,31 @@
</table>
<div class="ui grid">
<div class="three column row">
<div class="column"></div>
<div class="center aligned column">
<i class="\\
%if page == "1":
disabled\\
%end
fast backward icon"></i>
<i class="\\
%if page == "1":
disabled\\
%end
backward icon"></i>
{{page}} / {{max_page}}
<i class="\\
%if int(page) == int(max_page):
disabled\\
%end
forward icon"></i>
<i class="\\
%if int(page) == int(max_page):
disabled\\
%end
fast forward icon"></i>
</div>
<div class="right floated right aligned column">Total records: {{missing_count}}</div>
<div class="column"></div>
<div class="center aligned column">
<i class="\\
%if page == "1":
disabled\\
%end
fast backward icon"></i>
<i class="\\
%if page == "1":
disabled\\
%end
backward icon"></i>
{{page}} / {{max_page}}
<i class="\\
%if int(page) == int(max_page):
disabled\\
%end
forward icon"></i>
<i class="\\
%if int(page) == int(max_page):
disabled\\
%end
fast forward icon"></i>
</div>
<div class="right floated right aligned column">Total records: {{missing_count}}</div>
</div>
</div>
</div>
@ -201,9 +167,9 @@
</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>
<input name="hearing_impaired" id="series_hearing-impaired" type="checkbox">
<label></label>
</div>
</div>
</div>
</div>
@ -216,14 +182,16 @@
<button type="submit" name="save" value="save" form="series_form" class="ui blue approve button">Save</button>
</div>
</div>
% include('footer.tpl')
</body>
</html>
<script>
if (sessionStorage.scrolly) {
$(window).scrollTop(sessionStorage.scrolly);
sessionStorage.clear();
$(window).scrollTop(sessionStorage.scrolly);
sessionStorage.clear();
}
$('table').tablesort();
@ -247,7 +215,7 @@
$('.modal')
.modal({
autofocus: false
autofocus: false
})
;
@ -258,22 +226,21 @@
$("#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');
})
$('#series_languages').dropdown();
</script>

@ -21,14 +21,6 @@
body {
background-color: #272727;
}
#divmenu {
background-color: #272727;
opacity: 0.9;
padding-top: 2em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 128px;
}
#fondblanc {
background-color: #ffffff;
border-radius: 0px;
@ -43,33 +35,7 @@
<div id='loader' class="ui page dimmer">
<div class="ui indeterminate text loader">Loading...</div>
</div>
<div id="divmenu" class="ui container">
<div style="background-color:#272727;" class="ui inverted borderless labeled icon huge menu five item">
<a href="{{base_url}}"><img style="margin-right:32px;" class="logo" src="{{base_url}}static/logo128.png"></a>
<div style="height:80px;" class="ui container">
<a class="item" href="{{base_url}}">
<i class="play icon"></i>
Series
</a>
<a class="item" href="{{base_url}}history">
<i class="wait icon"></i>
History
</a>
<a class="item" href="{{base_url}}wanted">
<i class="warning sign icon"></i>
Wanted
</a>
<a class="item" href="{{base_url}}settings">
<i class="settings icon"></i>
Settings
</a>
<a class="item" href="{{base_url}}system">
<i class="laptop icon"></i>
System
</a>
</div>
</div>
</div>
% include('menu.tpl')
<div id="fondblanc" class="ui container">
<form name="settings_form" id="settings_form" action="{{base_url}}save_settings" method="post" class="ui form">
@ -523,6 +489,7 @@
</div>
</div>
</form>
% include('footer.tpl')
</body>
</html>

@ -21,14 +21,6 @@
body {
background-color: #272727;
}
#divmenu {
background-color: #272727;
opacity: 0.9;
padding-top: 2em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 128px;
}
#fondblanc {
background-color: #ffffff;
border-radius: 0px;
@ -51,33 +43,7 @@
<div id='loader' class="ui page dimmer">
<div class="ui indeterminate text loader">Loading...</div>
</div>
<div id="divmenu" class="ui container">
<div style="background-color:#272727;" class="ui inverted borderless labeled icon huge menu five item">
<a href="{{base_url}}"><img style="margin-right:32px;" class="logo" src="{{base_url}}static/logo128.png"></a>
<div style="height:80px;" class="ui container">
<a class="item" href="{{base_url}}">
<i class="play icon"></i>
Series
</a>
<a class="item" href="{{base_url}}history">
<i class="wait icon"></i>
History
</a>
<a class="item" href="{{base_url}}wanted">
<i class="warning sign icon"></i>
Wanted
</a>
<a class="item" href="{{base_url}}settings">
<i class="settings icon"></i>
Settings
</a>
<a class="item" href="{{base_url}}system">
<i class="laptop icon"></i>
System
</a>
</div>
</div>
</div>
% include('menu.tpl')
<div id="fondblanc" class="ui container">
<div class="ui top attached tabular menu">
@ -141,6 +107,7 @@
Bazarr version: {{bazarr_version}}
</div>
</div>
% include('footer.tpl')
</body>
</html>

@ -21,14 +21,6 @@
body {
background-color: #272727;
}
#divmenu {
background-color: #272727;
opacity: 0.9;
padding-top: 2em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 128px;
}
#fondblanc {
background-color: #ffffff;
border-radius: 0px;
@ -53,33 +45,7 @@
<div id='loader' class="ui page dimmer">
<div class="ui indeterminate text loader">Loading...</div>
</div>
<div id="divmenu" class="ui container">
<div style="background-color:#272727;" class="ui inverted borderless labeled icon huge menu five item">
<a href="{{base_url}}"><img style="margin-right:32px;" class="logo" src="{{base_url}}static/logo128.png"></a>
<div style="height:80px;" class="ui container">
<a class="item" href="{{base_url}}">
<i class="play icon"></i>
Series
</a>
<a class="item" href="{{base_url}}history">
<i class="wait icon"></i>
History
</a>
<a class="item" href="{{base_url}}wanted">
<i class="warning sign icon"></i>
Wanted
</a>
<a class="item" href="{{base_url}}settings">
<i class="settings icon"></i>
Settings
</a>
<a class="item" href="{{base_url}}system">
<i class="laptop icon"></i>
System
</a>
</div>
</div>
</div>
% include('menu.tpl')
<div id="fondblanc" class="ui container">
<div class="ui right floated basic buttons">
@ -150,6 +116,7 @@
</div>
</div>
</div>
% include('footer.tpl')
</body>
</html>

Loading…
Cancel
Save