diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-01 18:57:18 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-01 18:57:18 +0200 |
commit | 4ebe6b095e66caa5764e08486aeac46b32df0866 (patch) | |
tree | d4687f7ebcc203d039708264d5058a11908e2ed8 | |
parent | ocr + db fix (diff) | |
download | pyload-4ebe6b095e66caa5764e08486aeac46b32df0866.tar.xz |
wait fix
-rw-r--r-- | module/FileDatabase.py | 2 | ||||
-rw-r--r-- | module/plugins/Plugin.py | 4 | ||||
-rw-r--r-- | module/plugins/captcha/captcha.py | 7 | ||||
-rw-r--r-- | module/plugins/hoster/NetloadIn.py | 7 |
4 files changed, 11 insertions, 9 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index b52acd4d0..8daacf050 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -353,7 +353,7 @@ class FileDatabaseBackend(Thread): """create tables for database""" self.c.execute('CREATE TABLE IF NOT EXISTS "packages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "folder" TEXT, "password" TEXT, "site" TEXT, "queue" INTEGER DEFAULT 0 NOT NULL)') - self.c.execute('CREATE TABLE IF NOT EXISTS "links" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "url" TEXT NOT NULL, "name" TEXT, "size" INTEGER DEFAULT 0 NOT NULL, "status" INTEGER DEFAULT 3 NOT NULL, "plugin" TEXT DEFAULT "BasePlugin" NOT NULL, "error" TEXT, "package" INTEGER DEFAULT 0 NOT NULL, FOREIGN KEY(package) REFERENCES packages(id))') + self.c.execute('CREATE TABLE IF NOT EXISTS "links" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "url" TEXT NOT NULL, "name" TEXT, "size" INTEGER DEFAULT 0 NOT NULL, "status" INTEGER DEFAULT 3 NOT NULL, "plugin" TEXT DEFAULT "BasePlugin" NOT NULL, "error" TEXT DEFAULT "", "package" INTEGER DEFAULT 0 NOT NULL, FOREIGN KEY(package) REFERENCES packages(id))') self.c.execute('CREATE INDEX IF NOT EXISTS "pIdIndex" ON links(package)') self.c.execute('VACUUM') diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index e3b1b3299..de29dfc4e 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -146,8 +146,9 @@ class Plugin(object): def wait(self): """ waits the time previously set """ self.waiting = True + self.pyfile.setStatus("waiting") - while self.pyfile.waitUntil < time(): + while self.pyfile.waitUntil > time(): self.thread.m.reconnecting.wait(2) if self.pyfile.abort: raise Abort @@ -156,6 +157,7 @@ class Plugin(object): raise Reconnect self.waiting = False + self.pyfile.setStatus("starting") def fail(self, reason): """ fail and give reason """ diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index 501a57737..8b3b4ccbc 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -83,9 +83,9 @@ class OCR(object): self.result_captcha = self.run(['gocr', tmp.name]).replace("\n", "") def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): - self.logger.debug("create tmp tif") + #self.logger.debug("create tmp tif") tmp = tempfile.NamedTemporaryFile(suffix=".tif") - self.logger.debug("create tmp txt") + #self.logger.debug("create tmp txt") tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") self.logger.debug("save tiff") self.image.save(tmp.name, 'TIFF') @@ -93,7 +93,7 @@ class OCR(object): tessparams = ['tesseract', tmp.name, tmpTxt.name.replace(".txt", "")] if subset and (digits or lowercase or uppercase): - self.logger.debug("create temp subset config") + #self.logger.debug("create temp subset config") tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") tmpSub.write("tessedit_char_whitelist ") if digits: @@ -114,6 +114,7 @@ class OCR(object): with open(tmpTxt.name, 'r') as f: self.result_captcha = f.read().replace("\n", "") + self.logger.debug(self.result_captcha) def get_captcha(self): raise NotImplementedError diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 04b9f81f7..219d69944 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -42,11 +42,10 @@ class NetloadIn(Hoster): self.download_html() self.setWait(self.get_wait_time()) - #self.wait() - self.log.info("Netload: waiting %d seconds" % self.get_wait_time()) - self.pyfile.setStatus("waiting") - sleep(self.get_wait_time()) + self.log.debug("Netload: waiting %d seconds" % self.get_wait_time()) + + self.wait() self.url = self.get_file_url() return True |