summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/Checksum.py10
-rw-r--r--module/plugins/hooks/ExternalScripts.py6
-rw-r--r--module/plugins/hooks/ExtractArchive.py10
-rw-r--r--module/plugins/hooks/MergeFiles.py6
-rw-r--r--module/plugins/hooks/UpdateManager.py6
5 files changed, 19 insertions, 19 deletions
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index 013172899..c2c088066 100644
--- a/module/plugins/hooks/Checksum.py
+++ b/module/plugins/hooks/Checksum.py
@@ -10,7 +10,7 @@ from os import remove
from os.path import getsize, isfile, splitext
from module.plugins.Hook import Hook
-from module.utils import save_join, fs_encode
+from module.utils import safe_join, fs_encode
def computeChecksum(local_file, algorithm):
@@ -91,7 +91,7 @@ class Checksum(Hook):
local_file = fs_encode(pyfile.plugin.lastDownload)
#download_folder = self.config['general']['download_folder']
- #local_file = fs_encode(save_join(download_folder, pyfile.package().folder, pyfile.name))
+ #local_file = fs_encode(safe_join(download_folder, pyfile.package().folder, pyfile.name))
if not isfile(local_file):
self.checkFailed(pyfile, None, "File does not exist")
@@ -143,7 +143,7 @@ class Checksum(Hook):
pyfile.plugin.fail(reason=msg)
def packageFinished(self, pypack):
- download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "")
+ download_folder = safe_join(self.config['general']['download_folder'], pypack.folder, "")
for link in pypack.getChildren().itervalues():
file_type = splitext(link['name'])[1][1:].lower()
@@ -152,7 +152,7 @@ class Checksum(Hook):
if file_type not in self.formats:
continue
- hash_file = fs_encode(save_join(download_folder, link['name']))
+ hash_file = fs_encode(safe_join(download_folder, link['name']))
if not isfile(hash_file):
self.logWarning("File not found: %s" % link['name'])
continue
@@ -164,7 +164,7 @@ class Checksum(Hook):
data = m.groupdict()
self.logDebug(link['name'], data)
- local_file = fs_encode(save_join(download_folder, data['name']))
+ local_file = fs_encode(safe_join(download_folder, data['name']))
algorithm = self.methods.get(file_type, file_type)
checksum = computeChecksum(local_file, algorithm)
if checksum == data['hash']:
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py
index 8d03d27d4..90ae3bee0 100644
--- a/module/plugins/hooks/ExternalScripts.py
+++ b/module/plugins/hooks/ExternalScripts.py
@@ -6,7 +6,7 @@ from os import listdir, access, X_OK, makedirs
from os.path import join, exists, basename, abspath
from module.plugins.Hook import Hook
-from module.utils import save_join
+from module.utils import safe_join
class ExternalScripts(Hook):
@@ -73,13 +73,13 @@ class ExternalScripts(Hook):
def downloadFinished(self, pyfile):
for script in self.scripts['download_finished']:
self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name,
- save_join(self.config['general']['download_folder'],
+ safe_join(self.config['general']['download_folder'],
pyfile.package().folder, pyfile.name), pyfile.id)
def packageFinished(self, pypack):
for script in self.scripts['package_finished']:
folder = self.config['general']['download_folder']
- folder = save_join(folder, pypack.folder)
+ folder = safe_join(folder, pypack.folder)
self.callScript(script, pypack.name, folder, pypack.password, pypack.id)
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 144829459..183f189a6 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -49,7 +49,7 @@ if os.name != "nt":
from module.plugins.Hook import Hook, threaded, Expose
from module.plugins.internal.AbstractExtractor import ArchiveError, CRCError, WrongPassword
-from module.utils import save_join, fs_encode
+from module.utils import safe_join, fs_encode
class ExtractArchive(Hook):
@@ -148,21 +148,21 @@ class ExtractArchive(Hook):
continue
# determine output folder
- out = save_join(dl, p.folder, "")
+ out = safe_join(dl, p.folder, "")
# force trailing slash
if self.getConfig("destination") and self.getConfig("destination").lower() != "none":
- out = save_join(dl, p.folder, self.getConfig("destination"), "")
+ out = safe_join(dl, p.folder, self.getConfig("destination"), "")
#relative to package folder if destination is relative, otherwise absolute path overwrites them
if self.getConfig("subfolder"):
- out = save_join(out, fs_encode(p.folder))
+ out = safe_join(out, fs_encode(p.folder))
if not exists(out):
makedirs(out)
- files_ids = [(save_join(dl, p.folder, x['name']), x['id']) for x in p.getChildren().itervalues()]
+ files_ids = [(safe_join(dl, p.folder, x['name']), x['id']) for x in p.getChildren().itervalues()]
matched = False
# check as long there are unseen files
diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py
index a859092fb..ad1de7e6a 100644
--- a/module/plugins/hooks/MergeFiles.py
+++ b/module/plugins/hooks/MergeFiles.py
@@ -5,7 +5,7 @@ import re
import traceback
from module.plugins.Hook import Hook, threaded
-from module.utils import save_join, fs_encode
+from module.utils import safe_join, fs_encode
class MergeFiles(Hook):
@@ -41,11 +41,11 @@ class MergeFiles(Hook):
download_folder = self.config['general']['download_folder']
if self.config['general']['folder_per_package']:
- download_folder = save_join(download_folder, pack.folder)
+ download_folder = safe_join(download_folder, pack.folder)
for name, file_list in files.iteritems():
self.logInfo("Starting merging of %s" % name)
- final_file = open(save_join(download_folder, name), "wb")
+ final_file = open(safe_join(download_folder, name), "wb")
for splitted_file in file_list:
self.logDebug("Merging part %s" % splitted_file)
diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py
index 546e6e6e8..320bc24e3 100644
--- a/module/plugins/hooks/UpdateManager.py
+++ b/module/plugins/hooks/UpdateManager.py
@@ -8,7 +8,7 @@ from os import path, remove, stat
from module.network.RequestFactory import getURL
from module.plugins.Hook import Expose, Hook, threaded
-from module.utils import save_join
+from module.utils import safe_join
class UpdateManager(Hook):
@@ -200,7 +200,7 @@ class UpdateManager(Hook):
content = getURL(url % plugin)
m = vre.search(content)
if m and m.group(2) == version:
- f = open(save_join("userplugins", prefix, filename), "wb")
+ f = open(safe_join("userplugins", prefix, filename), "wb")
f.write(content)
f.close()
updated.append((prefix, name))
@@ -257,7 +257,7 @@ class UpdateManager(Hook):
for root in ("userplugins", path.join(pypath, "module", "plugins")):
- filename = save_join(root, type, file)
+ filename = safe_join(root, type, file)
try:
remove(filename)
except Exception, e: