mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
speed up new card fetching, add a text factory arg to the db, fix stopMplayer()
This commit is contained in:
parent
ab281d0bc6
commit
174b13f7df
3 changed files with 5 additions and 3 deletions
|
@ -15,9 +15,11 @@ from anki.hooks import runHook
|
|||
#FIXME: do we need the dbFinished hook?
|
||||
|
||||
class DB(object):
|
||||
def __init__(self, path, level="EXCLUSIVE"):
|
||||
def __init__(self, path, level="EXCLUSIVE", text=None):
|
||||
self._db = sqlite.connect(
|
||||
path, timeout=0, isolation_level=level)
|
||||
if text:
|
||||
self._db.text_factory = text
|
||||
self._path = path
|
||||
self.echo = os.environ.get("DBECHO")
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class Scheduler(object):
|
|||
else:
|
||||
self.newQueue = self.db.all("""
|
||||
select id, due from cards where
|
||||
queue = 2 %s order by due, id limit %d""" % (self.groupLimit('new'),
|
||||
queue = 2 %s order by due limit %d""" % (self.groupLimit('new'),
|
||||
lim))
|
||||
self.newQueue.reverse()
|
||||
self.newCount = len(self.newQueue)
|
||||
|
|
|
@ -233,7 +233,7 @@ def ensureMplayerThreads():
|
|||
mplayerReader.daemon = True
|
||||
mplayerReader.start()
|
||||
|
||||
def stopMplayer():
|
||||
def stopMplayer(*args):
|
||||
if not mplayerManager:
|
||||
return
|
||||
mplayerManager.kill()
|
||||
|
|
Loading…
Reference in a new issue