mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-26 09:37:25 +00:00
Continuing development.
This commit is contained in:
parent
bed02977c2
commit
d75c278a48
1 changed files with 26 additions and 27 deletions
|
@ -1,7 +1,6 @@
|
|||
# coding=utf-8
|
||||
|
||||
import os
|
||||
import sqlite3
|
||||
import time
|
||||
import platform
|
||||
import sys
|
||||
|
@ -9,6 +8,7 @@ import logging
|
|||
|
||||
from whichcraft import which
|
||||
from get_args import args
|
||||
from database import TableHistory, TableHistoryMovie
|
||||
|
||||
from subliminal import region as subliminal_cache_region
|
||||
import datetime
|
||||
|
@ -17,36 +17,35 @@ import glob
|
|||
|
||||
def history_log(action, sonarrSeriesId, sonarrEpisodeId, description, video_path=None, language=None, provider=None,
|
||||
score=None, forced=False):
|
||||
# Open database connection
|
||||
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = db.cursor()
|
||||
|
||||
history = c.execute(
|
||||
'''INSERT INTO table_history(action, sonarrSeriesId, sonarrEpisodeId, timestamp, description, video_path, language, provider, score) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(action, sonarrSeriesId, sonarrEpisodeId, time.time(), description, video_path, language, provider, score))
|
||||
|
||||
# Commit changes to DB
|
||||
db.commit()
|
||||
|
||||
# Close database connection
|
||||
db.close()
|
||||
TableHistory.insert(
|
||||
{
|
||||
TableHistory.action: action,
|
||||
TableHistory.sonarr_series_id: sonarrSeriesId,
|
||||
TableHistory.sonarr_episode_id: sonarrEpisodeId,
|
||||
TableHistory.timestamp: time.time(),
|
||||
TableHistory.description: description,
|
||||
TableHistory.video_path: video_path,
|
||||
TableHistory.language: language,
|
||||
TableHistory.provider: provider,
|
||||
TableHistory.score: score
|
||||
}
|
||||
).execute()
|
||||
|
||||
|
||||
def history_log_movie(action, radarrId, description, video_path=None, language=None, provider=None, score=None,
|
||||
forced=False):
|
||||
# Open database connection
|
||||
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = db.cursor()
|
||||
|
||||
history = c.execute(
|
||||
'''INSERT INTO table_history_movie(action, radarrId, timestamp, description, video_path, language, provider, score) VALUES (?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(action, radarrId, time.time(), description, video_path, language, provider, score))
|
||||
|
||||
# Commit changes to DB
|
||||
db.commit()
|
||||
|
||||
# Close database connection
|
||||
db.close()
|
||||
TableHistoryMovie.insert(
|
||||
{
|
||||
TableHistoryMovie.action: action,
|
||||
TableHistoryMovie.radarr_id: radarrId,
|
||||
TableHistoryMovie.timestamp: time.time(),
|
||||
TableHistoryMovie.description: description,
|
||||
TableHistoryMovie.video_path: video_path,
|
||||
TableHistoryMovie.language: language,
|
||||
TableHistoryMovie.provider: provider,
|
||||
TableHistoryMovie.score: score
|
||||
}
|
||||
).execute()
|
||||
|
||||
|
||||
def get_binary(name):
|
||||
|
|
Loading…
Reference in a new issue