Merge pull request 'Make sqlite open errors clearer' (#1) from dpedu/db-debug into master
All checks were successful
Gitea/pysonic/pipeline/head This commit looks good
All checks were successful
Gitea/pysonic/pipeline/head This commit looks good
Reviewed-on: #1
This commit is contained in:
commit
092c833c4f
@ -10,7 +10,7 @@ from collections import Iterable
|
||||
from pysonic.scanner import PysonicFilesystemScanner
|
||||
|
||||
|
||||
logging = logging.getLogger("database")
|
||||
logger = logging.getLogger("database")
|
||||
|
||||
|
||||
LETTER_GROUPS = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
|
||||
@ -63,6 +63,8 @@ class PysonicDatabase(object):
|
||||
self.scanner = PysonicFilesystemScanner(self)
|
||||
|
||||
def open(self):
|
||||
with open(self.path, "rb"): # sqlite doesn't give very descriptive permission errors, but this does
|
||||
pass
|
||||
self.db = sqlite3.connect(self.path, **self.sqlite_opts)
|
||||
self.db.row_factory = dict_factory
|
||||
|
||||
@ -158,14 +160,14 @@ class PysonicDatabase(object):
|
||||
|
||||
# Initialize DB
|
||||
if len(c.fetchall()) == 0:
|
||||
logging.warning("Initializing database")
|
||||
logger.warning("Initializing database")
|
||||
for query in queries:
|
||||
c.execute(query)
|
||||
c.execute("COMMIT")
|
||||
else:
|
||||
# Migrate if old db exists
|
||||
# c.execute("""UPDATE meta SET value=? WHERE key="db_version";""", (str(version), ))
|
||||
# logging.warning("db schema is version {}".format(version))
|
||||
# logger.warning("db schema is version {}".format(version))
|
||||
pass
|
||||
|
||||
def get_artist_info(self, item_id):
|
||||
|
Loading…
Reference in New Issue
Block a user