1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-25 01:02:19 +00:00

Bug correction

This commit is contained in:
Louis Vézina 2017-11-16 09:53:12 -05:00
parent d9bff60884
commit cd3f2b0721
2 changed files with 12 additions and 7 deletions

View file

@ -142,7 +142,8 @@ def episodes(no):
c = conn.cursor() c = conn.cursor()
series_details = [] series_details = []
series_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired FROM table_shows WHERE sonarrSeriesId LIKE ?", (str(no),)).fetchone() series_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tvdbid FROM table_shows WHERE sonarrSeriesId LIKE ?", (str(no),)).fetchone()
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()
episodes = reversed(sorted(episodes, key=operator.itemgetter(2))) episodes = reversed(sorted(episodes, key=operator.itemgetter(2)))
@ -151,7 +152,7 @@ def episodes(no):
seasons_list.append(list(season)) seasons_list.append(list(season))
c.close() c.close()
return template('episodes', no=no, details=series_details, seasons=seasons_list, url_sonarr_short=url_sonarr_short, base_url=base_url) return template('episodes', 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') @route(base_url + 'scan_disk/<no:int>', method='GET')
def scan_disk(no): def scan_disk(no):
@ -325,6 +326,7 @@ def remove_subtitles():
subtitlesPath = request.forms.get('subtitlesPath') subtitlesPath = request.forms.get('subtitlesPath')
sonarrSeriesId = request.forms.get('sonarrSeriesId') sonarrSeriesId = request.forms.get('sonarrSeriesId')
sonarrEpisodeId = request.forms.get('sonarrEpisodeId') sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
tvdbid = request.forms.get('tvdbid')
try: try:
os.remove(subtitlesPath) os.remove(subtitlesPath)
@ -333,7 +335,7 @@ def remove_subtitles():
except OSError: except OSError:
pass pass
store_subtitles(episodePath) store_subtitles(episodePath)
list_missing_subtitles(sonarrSeriesId) list_missing_subtitles(tvdbid)
@route(base_url + 'get_subtitle', method='POST') @route(base_url + 'get_subtitle', method='POST')
def get_subtitle(): def get_subtitle():
@ -344,6 +346,7 @@ def get_subtitle():
hi = request.forms.get('hi') hi = request.forms.get('hi')
sonarrSeriesId = request.forms.get('sonarrSeriesId') sonarrSeriesId = request.forms.get('sonarrSeriesId')
sonarrEpisodeId = request.forms.get('sonarrEpisodeId') sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
tvdbid = request.forms.get('tvdbid')
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db')) db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
c = db.cursor() c = db.cursor()
@ -360,9 +363,9 @@ def get_subtitle():
if result is not None: if result is not None:
history_log(1, sonarrSeriesId, sonarrEpisodeId, result) history_log(1, sonarrSeriesId, sonarrEpisodeId, result)
store_subtitles(episodePath) store_subtitles(episodePath)
list_missing_subtitles(sonarrSeriesId) list_missing_subtitles(tvdbid)
redirect(ref) redirect(ref)
except OSError: except OSError:
redirect(ref + '?error=2') pass
run(host=ip, port=port, server='waitress') run(host=ip, port=port, server='waitress')

View file

@ -221,7 +221,8 @@
language: $(this).attr("data-language"), language: $(this).attr("data-language"),
subtitlesPath: $(this).attr("data-subtitlesPath"), subtitlesPath: $(this).attr("data-subtitlesPath"),
sonarrSeriesId: $(this).attr("data-sonarrSeriesId"), sonarrSeriesId: $(this).attr("data-sonarrSeriesId"),
sonarrEpisodeId: $(this).attr("data-sonarrEpisodeId") sonarrEpisodeId: $(this).attr("data-sonarrEpisodeId"),
tvdbid: {{tvdbid}}
}; };
$.ajax({ $.ajax({
url: "{{base_url}}remove_subtitles", url: "{{base_url}}remove_subtitles",
@ -238,7 +239,8 @@
language: $(this).attr("data-language"), language: $(this).attr("data-language"),
hi: $(this).attr("data-hi"), hi: $(this).attr("data-hi"),
sonarrSeriesId: $(this).attr("data-sonarrSeriesId"), sonarrSeriesId: $(this).attr("data-sonarrSeriesId"),
sonarrEpisodeId: $(this).attr("data-sonarrEpisodeId") sonarrEpisodeId: $(this).attr("data-sonarrEpisodeId"),
tvdbid: {{tvdbid}}
}; };
$.ajax({ $.ajax({
url: "{{base_url}}get_subtitle", url: "{{base_url}}get_subtitle",