summaryrefslogtreecommitdiffhomepage
path: root/utils.py
blob: 4621cd882adc99be6ebecb7832412e605f4e346a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import sqlite3
import time

def history_log(action, sonarrSeriesId, sonarrEpisodeId, description):
    # Open database connection
    db = sqlite3.connect('data/db/bazarr.db')
    c = db.cursor()

    # 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))

    # Commit changes to DB
    db.commit()
    
    # Close database connection
    db.close()