X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;ds=sidebyside;f=sima%2Flib%2Fsimadb.py;h=5e22f021635bc77b0eda39d81ca5b905cbe2c534;hb=4ea8f2fe3f29fe09e7a3ab60ac781d54841db5bb;hp=1fbd93c96dedd09d81887ed182fe48666cd41b3e;hpb=1c01e4a7aa37eeef825c6918fc90b154a7f4ccc7;p=mpd-sima.git diff --git a/sima/lib/simadb.py b/sima/lib/simadb.py index 1fbd93c..5e22f02 100644 --- a/sima/lib/simadb.py +++ b/sima/lib/simadb.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2009-2013 Jack Kaliko +# Copyright (c) 2009-2013, 2019-2020 kaliko # Copyright (c) 2009, Eric Casteleijn # Copyright (c) 2008 Rick van Hattem # @@ -42,20 +42,17 @@ class SimaDBError(Exception): """ Exceptions. """ - pass class SimaDBAccessError(SimaDBError): """Error on accessing DB file""" - pass class SimaDBNoFile(SimaDBError): """No DB file present""" - pass -class SimaDB(object): +class SimaDB: "SQLite management" def __init__(self, db_path=None): @@ -85,7 +82,7 @@ class SimaDB(object): def get_database_connection(self): """get database reference""" connection = sqlite3.connect( - self._db_path, timeout=5.0, isolation_level="immediate") + self._db_path, timeout=5.0, isolation_level=None) #connection.text_factory = str return connection @@ -324,6 +321,8 @@ class SimaDB(object): def get_artists_history(self, artists, duration=__HIST_DURATION__): """ + :param list artists: list of object that can evaluate equality with + artist name, iterable of str or Artist object """ date = datetime.utcnow() - timedelta(hours=duration) connection = self.get_database_connection()