diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-28 22:34:54 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-28 22:34:54 +0100 |
commit | e9f69e9df0fd1cd484670af180d64caea53eaa5c (patch) | |
tree | b9e39821e948cb8dbe0adf79f9109f010314aef3 /pyload/plugin | |
parent | Merge branch 'stable' into 0.4.10 (diff) | |
download | pyload-e9f69e9df0fd1cd484670af180d64caea53eaa5c.tar.xz |
safe_join -> fs_join
Diffstat (limited to 'pyload/plugin')
-rw-r--r-- | pyload/plugin/Container.py | 8 | ||||
-rw-r--r-- | pyload/plugin/OCR.py | 8 | ||||
-rw-r--r-- | pyload/plugin/Plugin.py | 8 | ||||
-rw-r--r-- | pyload/plugin/addon/Checksum.py | 10 | ||||
-rw-r--r-- | pyload/plugin/addon/ExternalScripts.py | 8 | ||||
-rw-r--r-- | pyload/plugin/addon/ExtractArchive.py | 10 | ||||
-rw-r--r-- | pyload/plugin/addon/HotFolder.py | 4 | ||||
-rw-r--r-- | pyload/plugin/addon/MergeFiles.py | 8 | ||||
-rw-r--r-- | pyload/plugin/addon/UpdateManager.py | 6 | ||||
-rw-r--r-- | pyload/plugin/container/CCF.py | 4 | ||||
-rw-r--r-- | pyload/plugin/crypter/DailymotionBatch.py | 4 | ||||
-rw-r--r-- | pyload/plugin/crypter/RelinkUs.py | 4 | ||||
-rw-r--r-- | pyload/plugin/crypter/YoutubeBatch.py | 4 | ||||
-rw-r--r-- | pyload/plugin/extractor/SevenZip.py | 4 | ||||
-rw-r--r-- | pyload/plugin/extractor/UnRar.py | 10 | ||||
-rw-r--r-- | pyload/plugin/hoster/Xdcc.py | 4 |
16 files changed, 52 insertions, 52 deletions
diff --git a/pyload/plugin/Container.py b/pyload/plugin/Container.py index e2e0f2248..87d75976f 100644 --- a/pyload/plugin/Container.py +++ b/pyload/plugin/Container.py @@ -8,7 +8,7 @@ from os import remove from os.path import basename, exists from pyload.plugin.internal.Crypter import Crypter -from pyload.utils import safe_join +from pyload.utils import fs_join class Container(Crypter): @@ -45,7 +45,7 @@ class Container(Crypter): if self.pyfile.url.startswith("http"): self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] content = self.load(self.pyfile.url) - self.pyfile.url = safe_join(self.core.config['general']['download_folder'], self.pyfile.name) + self.pyfile.url = fs_join(self.core.config['general']['download_folder'], self.pyfile.name) try: with open(self.pyfile.url, "wb") as f: f.write(content) @@ -55,8 +55,8 @@ class Container(Crypter): else: self.pyfile.name = basename(self.pyfile.url) if not exists(self.pyfile.url): - if exists(safe_join(pypath, self.pyfile.url)): - self.pyfile.url = safe_join(pypath, self.pyfile.url) + if exists(fs_join(pypath, self.pyfile.url)): + self.pyfile.url = fs_join(pypath, self.pyfile.url) else: self.fail(_("File not exists")) diff --git a/pyload/plugin/OCR.py b/pyload/plugin/OCR.py index 73b3a788a..109dd1843 100644 --- a/pyload/plugin/OCR.py +++ b/pyload/plugin/OCR.py @@ -14,7 +14,7 @@ import subprocess #import tempfile from pyload.plugin.Plugin import Base -from pyload.utils import safe_join +from pyload.utils import fs_join class OCR(Base): @@ -60,11 +60,11 @@ class OCR(Base): def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): #tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") try: - tmpTif = open(safe_join("tmp", "tmpTif_%s.tif" % self.__name), "wb") + tmpTif = open(fs_join("tmp", "tmpTif_%s.tif" % self.__name), "wb") tmpTif.close() #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") - tmpTxt = open(safe_join("tmp", "tmpTxt_%s.txt" % self.__name), "wb") + tmpTxt = open(fs_join("tmp", "tmpTxt_%s.txt" % self.__name), "wb") tmpTxt.close() except IOError, e: @@ -83,7 +83,7 @@ class OCR(Base): if subset and (digits or lowercase or uppercase): #tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") - with open(safe_join("tmp", "tmpSub_%s.subset" % self.__name), "wb") as tmpSub: + with open(fs_join("tmp", "tmpSub_%s.subset" % self.__name), "wb") as tmpSub: tmpSub.write("tessedit_char_whitelist ") if digits: diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py index 07797e8c6..e136bfc29 100644 --- a/pyload/plugin/Plugin.py +++ b/pyload/plugin/Plugin.py @@ -18,7 +18,7 @@ from itertools import islice from traceback import print_exc from urlparse import urlparse -from pyload.utils import fs_decode, fs_encode, safe_filename, safe_join +from pyload.utils import fs_decode, fs_encode, safe_filename, fs_join def chunks(iterable, size): @@ -535,7 +535,7 @@ class Plugin(Base): from inspect import currentframe frame = currentframe() - framefile = safe_join("tmp", self.__name, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) + framefile = fs_join("tmp", self.__name, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) try: if not exists(join("tmp", self.__name)): makedirs(join("tmp", self.__name)) @@ -598,7 +598,7 @@ class Plugin(Base): download_folder = self.core.config['general']['download_folder'] - location = safe_join(download_folder, self.pyfile.package().folder) + location = fs_join(download_folder, self.pyfile.package().folder) if not exists(location): try: @@ -722,7 +722,7 @@ class Plugin(Base): raise SkipDownload(pyfile.pluginname) download_folder = self.core.config['general']['download_folder'] - location = safe_join(download_folder, pack.folder, self.pyfile.name) + location = fs_join(download_folder, pack.folder, self.pyfile.name) if starting and self.core.config['download']['skip_existing'] and exists(location): size = os.stat(location).st_size diff --git a/pyload/plugin/addon/Checksum.py b/pyload/plugin/addon/Checksum.py index 043a1861c..76a4954ac 100644 --- a/pyload/plugin/addon/Checksum.py +++ b/pyload/plugin/addon/Checksum.py @@ -10,7 +10,7 @@ from os import remove from os.path import getsize, isfile, splitext from pyload.plugin.Addon import Addon -from pyload.utils import safe_join, fs_encode +from pyload.utils import fs_join, fs_encode def computeChecksum(local_file, algorithm): @@ -104,7 +104,7 @@ class Checksum(Addon): local_file = fs_encode(pyfile.plugin.lastDownload) #download_folder = self.config['general']['download_folder'] - #local_file = fs_encode(safe_join(download_folder, pyfile.package().folder, pyfile.name)) + #local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") @@ -164,7 +164,7 @@ class Checksum(Addon): def packageFinished(self, pypack): - download_folder = safe_join(self.config['general']['download_folder'], pypack.folder, "") + download_folder = fs_join(self.config['general']['download_folder'], pypack.folder, "") for link in pypack.getChildren().itervalues(): file_type = splitext(link['name'])[1][1:].lower() @@ -172,7 +172,7 @@ class Checksum(Addon): if file_type not in self.formats: continue - hash_file = fs_encode(safe_join(download_folder, link['name'])) + hash_file = fs_encode(fs_join(download_folder, link['name'])) if not isfile(hash_file): self.logWarning(_("File not found"), link['name']) continue @@ -184,7 +184,7 @@ class Checksum(Addon): data = m.groupdict() self.logDebug(link['name'], data) - local_file = fs_encode(safe_join(download_folder, data['NAME'])) + local_file = fs_encode(fs_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/pyload/plugin/addon/ExternalScripts.py b/pyload/plugin/addon/ExternalScripts.py index 139a7e3e7..137003595 100644 --- a/pyload/plugin/addon/ExternalScripts.py +++ b/pyload/plugin/addon/ExternalScripts.py @@ -6,7 +6,7 @@ import subprocess from itertools import chain from pyload.plugin.Addon import Addon -from pyload.utils import safe_join +from pyload.utils import fs_join class ExternalScripts(Addon): @@ -95,14 +95,14 @@ class ExternalScripts(Addon): def downloadFinished(self, pyfile): download_folder = self.config['general']['download_folder'] for script in self.scripts['download_finished']: - filename = safe_join(download_folder, pyfile.package().folder, pyfile.name) + filename = fs_join(download_folder, pyfile.package().folder, pyfile.name) self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name, filename, pyfile.id) def packageFinished(self, pypack): download_folder = self.config['general']['download_folder'] for script in self.scripts['package_finished']: - folder = safe_join(download_folder, pypack.folder) + folder = fs_join(download_folder, pypack.folder) self.callScript(script, pypack.name, folder, pypack.password, pypack.id) @@ -126,7 +126,7 @@ class ExternalScripts(Addon): def package_extracted(self, pypack): download_folder = self.config['general']['download_folder'] for script in self.scripts['package_extracted']: - folder = safe_join(download_folder, pypack.folder) + folder = fs_join(download_folder, pypack.folder) self.callScript(script, pypack.name, folder, pypack.password, pypack.id) diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index 29b2165ca..245b24322 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -52,7 +52,7 @@ if os.name != "nt": from pyload.plugin.Addon import Addon, threaded, Expose from pyload.plugin.Extractor import ArchiveError, CRCError, PasswordError from pyload.plugin.internal.SimpleHoster import replace_patterns -from pyload.utils import fs_encode, safe_join, uniqify +from pyload.utils import fs_encode, fs_join, uniqify class ArchiveQueue(object): @@ -259,17 +259,17 @@ class ExtractArchive(Addon): self.logInfo(_("Check package: %s") % pypack.name) # determine output folder - out = safe_join(dl, pypack.folder, destination, "") #: force trailing slash + out = fs_join(dl, pypack.folder, destination, "") #: force trailing slash if subfolder: - out = safe_join(out, pypack.folder) + out = fs_join(out, pypack.folder) if not os.path.exists(out): os.makedirs(out) matched = False success = True - files_ids = [(safe_join(dl, pypack.folder, pylink['name']), pylink['id'], out) for pylink in pypack.getChildren().itervalues()] + files_ids = [(fs_join(dl, pypack.folder, pylink['name']), pylink['id'], out) for pylink in pypack.getChildren().itervalues()] # check as long there are unseen files while files_ids: @@ -318,7 +318,7 @@ class ExtractArchive(Addon): self.setPermissions(new_files) for filename in new_files: - file = fs_encode(safe_join(os.path.dirname(archive.filename), filename)) + file = fs_encode(fs_join(os.path.dirname(archive.filename), filename)) if not os.path.exists(file): self.logDebug("New file %s does not exists" % filename) continue diff --git a/pyload/plugin/addon/HotFolder.py b/pyload/plugin/addon/HotFolder.py index f2c8a96a4..3d70853e6 100644 --- a/pyload/plugin/addon/HotFolder.py +++ b/pyload/plugin/addon/HotFolder.py @@ -8,7 +8,7 @@ import time from shutil import move from pyload.plugin.Addon import Addon -from pyload.utils import fs_encode, safe_join +from pyload.utils import fs_encode, fs_join class HotFolder(Addon): @@ -53,7 +53,7 @@ class HotFolder(Addon): name = "%s_%s.txt" % (file, time.strftime("%H-%M-%S_%d%b%Y")) - with open(safe_join(folder, "finished", name), "wb") as f: + with open(fs_join(folder, "finished", name), "wb") as f: f.write(content) self.core.api.addPackage(f.name, [f.name], 1) diff --git a/pyload/plugin/addon/MergeFiles.py b/pyload/plugin/addon/MergeFiles.py index 5efb8383b..f1981e5f1 100644 --- a/pyload/plugin/addon/MergeFiles.py +++ b/pyload/plugin/addon/MergeFiles.py @@ -8,7 +8,7 @@ import re from traceback import print_exc from pyload.plugin.Addon import Addon, threaded -from pyload.utils import safe_join +from pyload.utils import fs_join class MergeFiles(Addon): @@ -45,12 +45,12 @@ class MergeFiles(Addon): download_folder = self.config['general']['download_folder'] if self.config['general']['folder_per_package']: - download_folder = safe_join(download_folder, pack.folder) + download_folder = fs_join(download_folder, pack.folder) for name, file_list in files.iteritems(): self.logInfo(_("Starting merging of"), name) - final_file = open(safe_join(download_folder, name), "wb") + final_file = open(fs_join(download_folder, name), "wb") for splitted_file in file_list: self.logDebug("Merging part", splitted_file) @@ -59,7 +59,7 @@ class MergeFiles(Addon): pyfile.setStatus("processing") try: - with open(safe_join(download_folder, splitted_file), "rb") as s_file: + with open(fs_join(download_folder, splitted_file), "rb") as s_file: size_written = 0 s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file))) diff --git a/pyload/plugin/addon/UpdateManager.py b/pyload/plugin/addon/UpdateManager.py index 0c803bea6..fe5efe04c 100644 --- a/pyload/plugin/addon/UpdateManager.py +++ b/pyload/plugin/addon/UpdateManager.py @@ -10,7 +10,7 @@ from os import path, remove, stat from pyload.network.RequestFactory import getURL from pyload.plugin.Addon import Expose, Addon, threaded -from pyload.utils import safe_join +from pyload.utils import fs_join class UpdateManager(Addon): @@ -240,7 +240,7 @@ class UpdateManager(Addon): m = self.VERSION.search(content) if m and m.group(2) == version: - with open(safe_join("userplugins", prefix, filename), "wb") as f: + with open(fs_join("userplugins", prefix, filename), "wb") as f: f.write(content) updated.append((prefix, name)) @@ -282,7 +282,7 @@ class UpdateManager(Addon): for root in ("userplugins", path.join(pypath, "pyload", "plugins")): - filename = safe_join(root, type, file) + filename = fs_join(root, type, file) try: remove(filename) except Exception, e: diff --git a/pyload/plugin/container/CCF.py b/pyload/plugin/container/CCF.py index c2771a57b..447f0bc3c 100644 --- a/pyload/plugin/container/CCF.py +++ b/pyload/plugin/container/CCF.py @@ -9,7 +9,7 @@ from urllib2 import build_opener from MultipartPostHandler import MultipartPostHandler from pyload.plugin.Container import Container -from pyload.utils import fs_encode, safe_join +from pyload.utils import fs_encode, fs_join class CCF(Container): @@ -35,7 +35,7 @@ class CCF(Container): 'upload' : open(file, "rb")}).read() download_folder = self.config['general']['download_folder'] - dlc_file = safe_join(download_folder, "tmp_%s.dlc" % pyfile.name) + dlc_file = fs_join(download_folder, "tmp_%s.dlc" % pyfile.name) try: dlc = re.search(r'<dlc>(.+)</dlc>', dlc_content, re.S).group(1).decode('base64') diff --git a/pyload/plugin/crypter/DailymotionBatch.py b/pyload/plugin/crypter/DailymotionBatch.py index 7afcccceb..cbf402f40 100644 --- a/pyload/plugin/crypter/DailymotionBatch.py +++ b/pyload/plugin/crypter/DailymotionBatch.py @@ -6,7 +6,7 @@ from urlparse import urljoin from pyload.utils import json_loads from pyload.plugin.Crypter import Crypter -from pyload.utils import safe_join +from pyload.utils import fs_join class DailymotionBatch(Crypter): @@ -101,6 +101,6 @@ class DailymotionBatch(Crypter): for p_id, p_name, p_owner in playlists: p_videos = self.getVideos(p_id) - p_folder = safe_join(self.config['general']['download_folder'], p_owner, p_name) + p_folder = fs_join(self.config['general']['download_folder'], p_owner, p_name) self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) self.packages.append((p_name, p_videos, p_folder)) #: folder is NOT recognized by pyload 0.4.9! diff --git a/pyload/plugin/crypter/RelinkUs.py b/pyload/plugin/crypter/RelinkUs.py index 023024a82..d02d7a84d 100644 --- a/pyload/plugin/crypter/RelinkUs.py +++ b/pyload/plugin/crypter/RelinkUs.py @@ -8,7 +8,7 @@ import os from Crypto.Cipher import AES from pyload.plugin.Crypter import Crypter -from pyload.utils import safe_join +from pyload.utils import fs_join class RelinkUs(Crypter): @@ -219,7 +219,7 @@ class RelinkUs(Crypter): try: dlc = self.load(container_url) dlc_filename = self.fileid + ".dlc" - dlc_filepath = safe_join(self.config['general']['download_folder'], dlc_filename) + dlc_filepath = fs_join(self.config['general']['download_folder'], dlc_filename) with open(dlc_filepath, "wb") as f: f.write(dlc) package_links.append(dlc_filepath) diff --git a/pyload/plugin/crypter/YoutubeBatch.py b/pyload/plugin/crypter/YoutubeBatch.py index 3fea12ff0..1573cd36d 100644 --- a/pyload/plugin/crypter/YoutubeBatch.py +++ b/pyload/plugin/crypter/YoutubeBatch.py @@ -6,7 +6,7 @@ from urlparse import urljoin from pyload.utils import json_loads from pyload.plugin.Crypter import Crypter -from pyload.utils import safe_join +from pyload.utils import fs_join class YoutubeBatch(Crypter): @@ -132,7 +132,7 @@ class YoutubeBatch(Crypter): for p in playlists: p_name = p['title'] p_videos = self.getVideosId(p['id']) - p_folder = safe_join(self.config['general']['download_folder'], p['channelTitle'], p_name) + p_folder = fs_join(self.config['general']['download_folder'], p['channelTitle'], p_name) self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) if not p_videos: diff --git a/pyload/plugin/extractor/SevenZip.py b/pyload/plugin/extractor/SevenZip.py index 1d7d57886..eeafd3f6f 100644 --- a/pyload/plugin/extractor/SevenZip.py +++ b/pyload/plugin/extractor/SevenZip.py @@ -6,7 +6,7 @@ import re from subprocess import Popen, PIPE from pyload.plugin.extractor.UnRar import ArchiveError, CRCError, PasswordError, UnRar, renice -from pyload.utils import fs_encode, safe_join +from pyload.utils import fs_encode, fs_join class SevenZip(UnRar): @@ -131,7 +131,7 @@ class SevenZip(UnRar): result = set() for groups in self.re_filelist.findall(out): f = groups[-1].strip() - result.add(safe_join(self.out, f)) + result.add(fs_join(self.out, f)) return list(result) diff --git a/pyload/plugin/extractor/UnRar.py b/pyload/plugin/extractor/UnRar.py index a8279bfa9..07cd19959 100644 --- a/pyload/plugin/extractor/UnRar.py +++ b/pyload/plugin/extractor/UnRar.py @@ -8,7 +8,7 @@ from string import digits from subprocess import Popen, PIPE from pyload.plugin.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from pyload.utils import decode, fs_encode, safe_join +from pyload.utils import decode, fs_encode, fs_join def renice(pid, value): @@ -178,7 +178,7 @@ class UnRar(Extractor): files = [self.filename] # eventually Multipart Files - files.extend(safe_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir)) + files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir)) if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file)) return files @@ -200,13 +200,13 @@ class UnRar(Extractor): if not self.fullpath and self.VERSION.startswith('5'): # NOTE: Unrar 5 always list full path for f in decode(out).splitlines(): - f = safe_join(self.out, os.path.basename(f.strip())) + f = fs_join(self.out, os.path.basename(f.strip())) if os.path.isfile(f): - result.add(safe_join(self.out, os.path.basename(f))) + result.add(fs_join(self.out, os.path.basename(f))) else: for f in decode(out).splitlines(): f = f.strip() - result.add(safe_join(self.out, f)) + result.add(fs_join(self.out, f)) return list(result) diff --git a/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py index 5276cbdc2..aa5e32eab 100644 --- a/pyload/plugin/hoster/Xdcc.py +++ b/pyload/plugin/hoster/Xdcc.py @@ -11,7 +11,7 @@ from select import select from time import time from pyload.plugin.Hoster import Hoster -from pyload.utils import safe_join +from pyload.utils import fs_join class Xdcc(Hoster): @@ -192,7 +192,7 @@ class Xdcc(Hoster): self.pyfile.name = packname download_folder = self.config['general']['download_folder'] - filename = safe_join(download_folder, packname) + filename = fs_join(download_folder, packname) self.logInfo(_("Downloading %s from %s:%d") % (packname, ip, port)) |