update to API to include movies

This commit is contained in:
morpheus65535 2018-09-13 07:28:15 -04:00
parent 850fb666b6
commit 26ac122548
1 changed files with 18 additions and 2 deletions

View File

@ -1677,7 +1677,7 @@ def configured():
conn.commit()
c.close()
@route(base_url + 'api/wanted')
@route(base_url + 'api/series/wanted')
def api_wanted():
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
c = db.cursor()
@ -1685,7 +1685,7 @@ def api_wanted():
c.close()
return dict(subtitles=data)
@route(base_url + 'api/history')
@route(base_url + 'api/series/history')
def api_history():
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
c = db.cursor()
@ -1693,6 +1693,22 @@ def api_history():
c.close()
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')
@custom_auth_basic(check_credentials)
def test_url(protocol, url):