Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
8c1679382f |
1
.gitignore
vendored
1
.gitignore
vendored
@ -0,0 +1 @@
|
||||
.vscode
|
36
plugin.py
36
plugin.py
@ -38,12 +38,46 @@ except ImportError:
|
||||
# without the i18n module
|
||||
_ = lambda x: x
|
||||
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
class SqliteDoselogsDB(object):
|
||||
def __init__(self, filename):
|
||||
self.db = {}
|
||||
self.filename = filename
|
||||
|
||||
def close(self):
|
||||
self.db.close()
|
||||
|
||||
def _getDb(self):
|
||||
filename = os.path.basename(self.__class__.__name__)
|
||||
if filename in self.db:
|
||||
return self.db[filename]
|
||||
if os.path.exists(filename):
|
||||
db = sqlite3.connect(filename, check_same_thread=False)
|
||||
self.db[filename] = db
|
||||
return db
|
||||
db = sqlite3.connect(filename, check_same_thread=False)
|
||||
self.db[filename] = db
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""CREATE TABLE doselogs (
|
||||
id INTEGER PRIMARY KEY,
|
||||
username TEXT,
|
||||
nick TEXT,
|
||||
timezone TEXT,
|
||||
amount TEXT,
|
||||
drug TEXT,
|
||||
roa TEXT,
|
||||
timestamp TEXT
|
||||
)
|
||||
|
||||
""")
|
||||
|
||||
|
||||
class DoseLogs(callbacks.Plugin):
|
||||
"""Log and annotate your doses"""
|
||||
threaded = True
|
||||
|
||||
|
||||
Class = DoseLogs
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user