Skip to content

Commit e03e4b6

Browse files
committed
closed pyload#411
1 parent 71d8e18 commit e03e4b6

9 files changed

Lines changed: 15 additions & 18 deletions

File tree

module/Api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,7 @@ def deleteFinished(self):
733733
734734
:return: list of deleted package ids
735735
"""
736-
deleted = self.core.files.deleteFinishedLinks()
737-
return deleted
736+
return self.core.files.deleteFinishedLinks()
738737

739738
@permission(PERMS.MODIFY)
740739
def restartFailed(self):

module/HookManager.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,10 @@ def coreExiting(self):
208208
self.dispatchEvent("coreExiting")
209209

210210
@lock
211-
def downloadStarts(self, pyfile):
212-
#TODO: rename to downloadPreparing
211+
def downloadPreparing(self, pyfile):
213212
for plugin in self.plugins:
214213
if plugin.isActivated():
215-
plugin.downloadStarts(pyfile)
214+
plugin.downloadPreparing(pyfile)
216215

217216
self.dispatchEvent("downloadPreparing", pyfile)
218217

@@ -265,10 +264,6 @@ def afterReconnecting(self, ip):
265264

266265
self.dispatchEvent("afterReconnecting", ip)
267266

268-
@lock
269-
def unrarFinished(self, folder, fname):
270-
self.dispatchEvent("unrarFinished", folder, fname)
271-
272267
def startThread(self, function, *args, **kwargs):
273268
t = HookThread(self.core.threadManager, function, args, kwargs)
274269

module/PluginThread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def run(self):
183183
self.m.log.info(_("Download starts: %s" % pyfile.name))
184184

185185
# start download
186-
self.m.core.hookManager.downloadStarts(pyfile)
186+
self.m.core.hookManager.downloadPreparing(pyfile)
187187
pyfile.plugin.preprocessing(self)
188188

189189
self.m.log.info(_("Download finished: %s") % pyfile.name)

module/database/FileDatabase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ def getUnfinished(self, pid):
848848

849849
@style.queue
850850
def deleteFinished(self):
851-
self.c.execute("DELETE FROM links WHERE status=0")
851+
self.c.execute("DELETE FROM links WHERE status IN (0,4)")
852852
self.c.execute("DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE packages.id=links.package)")
853853

854854

module/plugins/Hook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def coreReady(self):
129129
def coreExiting(self):
130130
pass
131131

132-
def downloadStarts(self, pyfile):
132+
def downloadPreparing(self, pyfile):
133133
pass
134134

135135
def downloadFinished(self, pyfile):

module/plugins/hooks/ExternalScripts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def callScript(self, script, *args):
7979
except Exception, e:
8080
self.logError(_("Error in %(script)s: %(error)s") % { "script" :basename(script), "error": str(e)})
8181

82-
def downloadStarts(self, pyfile):
82+
def downloadPreparing(self, pyfile):
8383
for script in self.scripts['download_preparing']:
8484
self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.id)
8585

module/plugins/hooks/ExtractArchive.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class WrongPassword(Exception):
6666

6767

6868
class ExtractArchive(Hook):
69+
"""
70+
Provides: unrarFinished (folder, filename)
71+
"""
6972
__name__ = "ExtractArchive"
7073
__version__ = "0.1"
7174
__description__ = "Extract different kind of archives"
@@ -210,12 +213,12 @@ def startExtracting(self, plugin, fid, passwords, thread):
210213
else:
211214
self.logInfo(basename(plugin.file), _("Password protected"))
212215
self.logDebug("Passwords: %s" % str(passwords))
213-
216+
214217
pwlist = copy(self.getPasswords())
215218
#remove already supplied pws from list (only local)
216219
for pw in passwords:
217220
if pw in pwlist: pwlist.remove(pw)
218-
221+
219222
for pw in passwords + pwlist:
220223
try:
221224
self.logDebug("Try password: %s" % pw)
@@ -242,7 +245,7 @@ def startExtracting(self, plugin, fid, passwords, thread):
242245
else: self.logDebug("%s does not exists" % f)
243246

244247
self.logInfo(basename(plugin.file), _("Extracting finished"))
245-
self.core.hookManager.unrarFinished(plugin.out, plugin.file)
248+
self.manager.dispatchEvent("unrarFinished", plugin.out, plugin.file)
246249

247250
return plugin.getExtractedFiles()
248251

module/remote/thriftbackend/pyload.thrift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ service Pyload {
254254
void orderPackage(1: PackageID pid, 2: i16 position),
255255
void orderFile(1: FileID fid, 2: i16 position),
256256
void setPackageData(1: PackageID pid, 2: map<string, string> data) throws (1: PackageDoesNotExists e),
257-
void deleteFinished(),
257+
list<PackageID> deleteFinished(),
258258
void restartFailed(),
259259

260260

module/web/media/js/package_ui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ var PackageUI = new Class({
7474
method: 'get',
7575
url: '/api/deleteFinished',
7676
onSuccess: function(data) {
77-
if (data.del.length > 0) {
77+
if (data.length > 0) {
7878
window.location.reload()
7979
} else {
8080
this.packages.each(function(pack) {

0 commit comments

Comments
 (0)