2018-08-16 10:01:49 +08:00
|
|
|
from get_argv import config_dir
|
|
|
|
|
2017-10-20 20:59:21 +08:00
|
|
|
import os
|
2017-09-17 21:02:16 +08:00
|
|
|
import sqlite3
|
|
|
|
import time
|
2017-09-16 08:49:46 +08:00
|
|
|
|
2017-09-17 21:02:16 +08:00
|
|
|
def history_log(action, sonarrSeriesId, sonarrEpisodeId, description):
|
|
|
|
# Open database connection
|
2018-08-16 10:01:49 +08:00
|
|
|
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
|
2017-09-17 21:02:16 +08:00
|
|
|
c = db.cursor()
|
2017-09-16 08:49:46 +08:00
|
|
|
|
2017-09-17 21:02:16 +08:00
|
|
|
# Get Sonarr API URL from database config table
|
|
|
|
history = c.execute('''INSERT INTO table_history(action, sonarrSeriesId, sonarrEpisodeId, timestamp, description) VALUES (?, ?, ?, ?, ?)''', (action, sonarrSeriesId, sonarrEpisodeId, time.time(), description))
|
2017-09-16 08:49:46 +08:00
|
|
|
|
2017-09-17 21:02:16 +08:00
|
|
|
# Commit changes to DB
|
|
|
|
db.commit()
|
|
|
|
|
|
|
|
# Close database connection
|
|
|
|
db.close()
|
2018-04-24 22:48:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
def history_log_movie(action, radarrId, description):
|
|
|
|
# Open database connection
|
2018-08-16 10:01:49 +08:00
|
|
|
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
|
2018-04-24 22:48:52 +08:00
|
|
|
c = db.cursor()
|
|
|
|
|
|
|
|
history = c.execute('''INSERT INTO table_history_movie(action, radarrId, timestamp, description) VALUES (?, ?, ?, ?)''', (action, radarrId, time.time(), description))
|
|
|
|
|
|
|
|
# Commit changes to DB
|
|
|
|
db.commit()
|
|
|
|
|
|
|
|
# Close database connection
|
|
|
|
db.close()
|