summaryrefslogtreecommitdiffhomepage
path: root/bazarr.py
diff options
context:
space:
mode:
authorHalali <[email protected]>2018-09-26 14:31:47 +0200
committerHalali <[email protected]>2018-09-26 14:31:47 +0200
commitbfdc6200b7794d225ff6610ef6a262e5966ba012 (patch)
tree8fe79726e9f63368a9fcdea2d6c17ec9b8980252 /bazarr.py
parentfd7cd0a92caf1e77c0d5e73038ac40c919fb25b1 (diff)
downloadbazarr-bfdc6200b7794d225ff6610ef6a262e5966ba012.tar.gz
bazarr-bfdc6200b7794d225ff6610ef6a262e5966ba012.zip
minor search engine changes
Diffstat (limited to 'bazarr.py')
-rw-r--r--bazarr.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/bazarr.py b/bazarr.py
index 7131a976d..b6b7b4996 100644
--- a/bazarr.py
+++ b/bazarr.py
@@ -313,26 +313,29 @@ def serieseditor():
output = template('serieseditor', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=single_language)
return output
+
@route(base_url + 'search_json/<query>', method='GET')
@custom_auth_basic(check_credentials)
def search_json(query):
authorize()
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
c = db.cursor()
-
- c.execute("SELECT title, sonarrSeriesId FROM table_shows WHERE title LIKE ? ORDER BY title", ('%'+query+'%',))
- series = c.fetchall()
-
- c.execute("SELECT title, radarrId FROM table_movies WHERE title LIKE ? ORDER BY title", ('%' + query + '%',))
- movies = c.fetchall()
-
+
search_list = []
- for serie in series:
- search_list.append(dict([('name', serie[0]), ('url', base_url + 'episodes/' + str(serie[1]))]))
-
- for movie in movies:
- search_list.append(dict([('name', movie[0]), ('url', base_url + 'movie/' + str(movie[1]))]))
-
+ if get_general_settings()[12] is True:
+ c.execute("SELECT title, sonarrSeriesId FROM table_shows WHERE title LIKE ? ORDER BY title",
+ ('%' + query + '%',))
+ series = c.fetchall()
+ for serie in series:
+ search_list.append(dict([('name', serie[0]), ('url', base_url + 'episodes/' + str(serie[1]))]))
+
+ if get_general_settings()[13] is True:
+ c.execute("SELECT title, radarrId FROM table_movies WHERE title LIKE ? ORDER BY title", ('%' + query + '%',))
+ movies = c.fetchall()
+ for movie in movies:
+ search_list.append(dict([('name', movie[0]), ('url', base_url + 'movie/' + str(movie[1]))]))
+ c.close()
+
response.content_type = 'application/json'
return dict(items=search_list)