summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/Api.py3
-rw-r--r--module/HookManager.py9
-rw-r--r--module/PluginThread.py2
-rw-r--r--module/database/FileDatabase.py2
-rw-r--r--module/plugins/Hook.py2
-rw-r--r--module/plugins/hooks/ExternalScripts.py2
-rw-r--r--module/plugins/hooks/ExtractArchive.py9
-rw-r--r--module/remote/thriftbackend/pyload.thrift2
-rw-r--r--module/web/media/js/package_ui.js2
9 files changed, 15 insertions, 18 deletions
diff --git a/module/Api.py b/module/Api.py
index 9aa6f86bb..11072b2cd 100644
--- a/module/Api.py
+++ b/module/Api.py
@@ -733,8 +733,7 @@ class Api(Iface):
:return: list of deleted package ids
"""
- deleted = self.core.files.deleteFinishedLinks()
- return deleted
+ return self.core.files.deleteFinishedLinks()
@permission(PERMS.MODIFY)
def restartFailed(self):
diff --git a/module/HookManager.py b/module/HookManager.py
index 88ce62da6..25f84831e 100644
--- a/module/HookManager.py
+++ b/module/HookManager.py
@@ -208,11 +208,10 @@ class HookManager:
self.dispatchEvent("coreExiting")
@lock
- def downloadStarts(self, pyfile):
- #TODO: rename to downloadPreparing
+ def downloadPreparing(self, pyfile):
for plugin in self.plugins:
if plugin.isActivated():
- plugin.downloadStarts(pyfile)
+ plugin.downloadPreparing(pyfile)
self.dispatchEvent("downloadPreparing", pyfile)
@@ -265,10 +264,6 @@ class HookManager:
self.dispatchEvent("afterReconnecting", ip)
- @lock
- def unrarFinished(self, folder, fname):
- self.dispatchEvent("unrarFinished", folder, fname)
-
def startThread(self, function, *args, **kwargs):
t = HookThread(self.core.threadManager, function, args, kwargs)
diff --git a/module/PluginThread.py b/module/PluginThread.py
index 03db68100..c4bdd59c8 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -183,7 +183,7 @@ class DownloadThread(PluginThread):
self.m.log.info(_("Download starts: %s" % pyfile.name))
# start download
- self.m.core.hookManager.downloadStarts(pyfile)
+ self.m.core.hookManager.downloadPreparing(pyfile)
pyfile.plugin.preprocessing(self)
self.m.log.info(_("Download finished: %s") % pyfile.name)
diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py
index 91213d8a6..1df8998b0 100644
--- a/module/database/FileDatabase.py
+++ b/module/database/FileDatabase.py
@@ -848,7 +848,7 @@ class FileMethods():
@style.queue
def deleteFinished(self):
- self.c.execute("DELETE FROM links WHERE status=0")
+ self.c.execute("DELETE FROM links WHERE status IN (0,4)")
self.c.execute("DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE packages.id=links.package)")
diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py
index 51ebd1aec..5efd08bae 100644
--- a/module/plugins/Hook.py
+++ b/module/plugins/Hook.py
@@ -129,7 +129,7 @@ class Hook(Base):
def coreExiting(self):
pass
- def downloadStarts(self, pyfile):
+ def downloadPreparing(self, pyfile):
pass
def downloadFinished(self, pyfile):
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py
index e8d929b71..2e77f1dae 100644
--- a/module/plugins/hooks/ExternalScripts.py
+++ b/module/plugins/hooks/ExternalScripts.py
@@ -79,7 +79,7 @@ class ExternalScripts(Hook):
except Exception, e:
self.logError(_("Error in %(script)s: %(error)s") % { "script" :basename(script), "error": str(e)})
- def downloadStarts(self, pyfile):
+ def downloadPreparing(self, pyfile):
for script in self.scripts['download_preparing']:
self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.id)
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 2e8daad35..54dd6ff2d 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -66,6 +66,9 @@ class WrongPassword(Exception):
class ExtractArchive(Hook):
+ """
+ Provides: unrarFinished (folder, filename)
+ """
__name__ = "ExtractArchive"
__version__ = "0.1"
__description__ = "Extract different kind of archives"
@@ -210,12 +213,12 @@ class ExtractArchive(Hook):
else:
self.logInfo(basename(plugin.file), _("Password protected"))
self.logDebug("Passwords: %s" % str(passwords))
-
+
pwlist = copy(self.getPasswords())
#remove already supplied pws from list (only local)
for pw in passwords:
if pw in pwlist: pwlist.remove(pw)
-
+
for pw in passwords + pwlist:
try:
self.logDebug("Try password: %s" % pw)
@@ -242,7 +245,7 @@ class ExtractArchive(Hook):
else: self.logDebug("%s does not exists" % f)
self.logInfo(basename(plugin.file), _("Extracting finished"))
- self.core.hookManager.unrarFinished(plugin.out, plugin.file)
+ self.manager.dispatchEvent("unrarFinished", plugin.out, plugin.file)
return plugin.getExtractedFiles()
diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift
index 03eb1d4eb..5d828854c 100644
--- a/module/remote/thriftbackend/pyload.thrift
+++ b/module/remote/thriftbackend/pyload.thrift
@@ -254,7 +254,7 @@ service Pyload {
void orderPackage(1: PackageID pid, 2: i16 position),
void orderFile(1: FileID fid, 2: i16 position),
void setPackageData(1: PackageID pid, 2: map<string, string> data) throws (1: PackageDoesNotExists e),
- void deleteFinished(),
+ list<PackageID> deleteFinished(),
void restartFailed(),
diff --git a/module/web/media/js/package_ui.js b/module/web/media/js/package_ui.js
index 17f6bcfdd..3ea965649 100644
--- a/module/web/media/js/package_ui.js
+++ b/module/web/media/js/package_ui.js
@@ -74,7 +74,7 @@ var PackageUI = new Class({
method: 'get',
url: '/api/deleteFinished',
onSuccess: function(data) {
- if (data.del.length > 0) {
+ if (data.length > 0) {
window.location.reload()
} else {
this.packages.each(function(pack) {