Continuing development.

pull/543/head
Louis Vézina 5 years ago
parent bed02977c2
commit d75c278a48

@ -1,7 +1,6 @@
# coding=utf-8 # coding=utf-8
import os import os
import sqlite3
import time import time
import platform import platform
import sys import sys
@ -9,6 +8,7 @@ import logging
from whichcraft import which from whichcraft import which
from get_args import args from get_args import args
from database import TableHistory, TableHistoryMovie
from subliminal import region as subliminal_cache_region from subliminal import region as subliminal_cache_region
import datetime import datetime
@ -17,36 +17,35 @@ import glob
def history_log(action, sonarrSeriesId, sonarrEpisodeId, description, video_path=None, language=None, provider=None, def history_log(action, sonarrSeriesId, sonarrEpisodeId, description, video_path=None, language=None, provider=None,
score=None, forced=False): score=None, forced=False):
# Open database connection TableHistory.insert(
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30) {
c = db.cursor() TableHistory.action: action,
TableHistory.sonarr_series_id: sonarrSeriesId,
history = c.execute( TableHistory.sonarr_episode_id: sonarrEpisodeId,
'''INSERT INTO table_history(action, sonarrSeriesId, sonarrEpisodeId, timestamp, description, video_path, language, provider, score) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)''', TableHistory.timestamp: time.time(),
(action, sonarrSeriesId, sonarrEpisodeId, time.time(), description, video_path, language, provider, score)) TableHistory.description: description,
TableHistory.video_path: video_path,
# Commit changes to DB TableHistory.language: language,
db.commit() TableHistory.provider: provider,
TableHistory.score: score
# Close database connection }
db.close() ).execute()
def history_log_movie(action, radarrId, description, video_path=None, language=None, provider=None, score=None, def history_log_movie(action, radarrId, description, video_path=None, language=None, provider=None, score=None,
forced=False): forced=False):
# Open database connection TableHistoryMovie.insert(
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30) {
c = db.cursor() TableHistoryMovie.action: action,
TableHistoryMovie.radarr_id: radarrId,
history = c.execute( TableHistoryMovie.timestamp: time.time(),
'''INSERT INTO table_history_movie(action, radarrId, timestamp, description, video_path, language, provider, score) VALUES (?, ?, ?, ?, ?, ?, ?, ?)''', TableHistoryMovie.description: description,
(action, radarrId, time.time(), description, video_path, language, provider, score)) TableHistoryMovie.video_path: video_path,
TableHistoryMovie.language: language,
# Commit changes to DB TableHistoryMovie.provider: provider,
db.commit() TableHistoryMovie.score: score
}
# Close database connection ).execute()
db.close()
def get_binary(name): def get_binary(name):

Loading…
Cancel
Save