define timeslots in config

This commit is contained in:
2022-12-02 11:34:32 +01:00
parent 02ca1d543d
commit b5671b9282
4 changed files with 5 additions and 21 deletions

18
db.py
View File

@ -39,24 +39,6 @@ def create_transmissions_table():
else:
log.debug('DB transmissions exists, not creating.')
def create_timeslots_table():
scheme = """
CREATE TABLE IF NOT EXISTS timeslots (
timeslot INT NOT NULL,
time TEXT NOT NULL,
active BOOLEAN NOT NULL
);
"""
if cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='timeslots';").fetchall() == []:
try:
cursor.execute(scheme)
log.info("Successfully created database transmissions")
except sqlite3.Error as error:
log.critical("Couldn't create timeslots table: ", error)
exit(1)
else:
log.debug('DB timeslots exists, not creating.')
def get_transmissions(date=None, timeslot=None):
return cursor.execute("SELECT * FROM transmissions").fetchall()