2017-09-17 13:02:16 +00:00
|
|
|
import sqlite3
|
|
|
|
import time
|
2017-09-16 00:49:46 +00:00
|
|
|
|
2017-09-17 13:02:16 +00:00
|
|
|
def history_log(action, sonarrSeriesId, sonarrEpisodeId, description):
|
|
|
|
# Open database connection
|
|
|
|
db = sqlite3.connect('bazarr.db')
|
|
|
|
c = db.cursor()
|
2017-09-16 00:49:46 +00:00
|
|
|
|
2017-09-17 13:02:16 +00: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 00:49:46 +00:00
|
|
|
|
2017-09-17 13:02:16 +00:00
|
|
|
# Commit changes to DB
|
|
|
|
db.commit()
|
|
|
|
|
|
|
|
# Close database connection
|
|
|
|
db.close()
|