diff --git a/pysonic/database.py b/pysonic/database.py index c814c60..3b974b9 100644 --- a/pysonic/database.py +++ b/pysonic/database.py @@ -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,7 +63,8 @@ class PysonicDatabase(object): self.scanner = PysonicFilesystemScanner(self) def open(self): - logging.debug("opening database: %s", self.path) + 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 @@ -159,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): diff --git a/start.sh b/start.sh index c484eb6..dda6002 100644 --- a/start.sh +++ b/start.sh @@ -1,5 +1,8 @@ #!/bin/bash -chown -R app:app /db/ +set -x + +chmod 755 /db/. +chown -R app:app /db exec sudo --preserve-env -Hu app pysonicd $@