update to API to include movies

pull/142/merge
morpheus65535 6 years ago
parent 850fb666b6
commit 26ac122548

@ -1677,7 +1677,7 @@ def configured():
conn.commit() conn.commit()
c.close() c.close()
@route(base_url + 'api/wanted') @route(base_url + 'api/series/wanted')
def api_wanted(): def api_wanted():
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30) db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
c = db.cursor() c = db.cursor()
@ -1685,7 +1685,7 @@ def api_wanted():
c.close() c.close()
return dict(subtitles=data) return dict(subtitles=data)
@route(base_url + 'api/history') @route(base_url + 'api/series/history')
def api_history(): def api_history():
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30) db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
c = db.cursor() c = db.cursor()
@ -1693,6 +1693,22 @@ def api_history():
c.close() c.close()
return dict(subtitles=data) return dict(subtitles=data)
@route(base_url + 'api/movies/wanted')
def api_wanted():
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
c = db.cursor()
data = c.execute("SELECT table_movies.title, table_movies.missing_subtitles FROM table_movies WHERE table_movies.missing_subtitles != '[]' ORDER BY table_movies._rowid_ DESC").fetchall()
c.close()
return dict(subtitles=data)
@route(base_url + 'api/movies/history')
def api_history():
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
c = db.cursor()
data = c.execute("SELECT table_movies.title, strftime('%Y-%m-%d', datetime(table_history_movie.timestamp, 'unixepoch')), table_history_movie.description FROM table_history_movie INNER JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId WHERE table_history_movie.action = '1' ORDER BY id DESC").fetchall()
c.close()
return dict(subtitles=data)
@route(base_url + 'test_url/<protocol>/<url:path>', method='GET') @route(base_url + 'test_url/<protocol>/<url:path>', method='GET')
@custom_auth_basic(check_credentials) @custom_auth_basic(check_credentials)
def test_url(protocol, url): def test_url(protocol, url):

Loading…
Cancel
Save