diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-16 10:30:16 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-27 22:33:31 +0100 |
commit | 20b54693f7dcc617ae9b2fb2e341b944dbd88e04 (patch) | |
tree | fb7dfb49df2f99dee7e5879860b236be4fcb147e /module/plugins/internal/Container.py | |
parent | [OCR] Code cosmetics (diff) | |
download | pyload-20b54693f7dcc617ae9b2fb2e341b944dbd88e04.tar.xz |
[Container] Compact code
Diffstat (limited to 'module/plugins/internal/Container.py')
-rw-r--r-- | module/plugins/internal/Container.py | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py index cff4ac4ec..b2d52a204 100644 --- a/module/plugins/internal/Container.py +++ b/module/plugins/internal/Container.py @@ -6,13 +6,13 @@ import os import re from module.plugins.internal.Crypter import Crypter -from module.plugins.internal.utils import encode, exists, fs_join +from module.plugins.internal.misc import encode, exists, fsjoin class Container(Crypter): __name__ = "Container" __type__ = "container" - __version__ = "0.09" + __version__ = "0.10" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -34,7 +34,8 @@ class Container(Crypter): self.decrypt(pyfile) - self.delete_tmp() + if self.pyfile.name.startswith("tmp_"): + self.remove(pyfile.url, trash=False) if self.links: self._generate_packages() @@ -53,7 +54,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 = fs_join(self.pyload.config.get("general", "download_folder"), self.pyfile.name) + self.pyfile.url = fsjoin(self.pyload.config.get("general", "download_folder"), self.pyfile.name) try: with open(self.pyfile.url, "wb") as f: f.write(encode(content)) @@ -65,19 +66,9 @@ class Container(Crypter): self.pyfile.name = os.path.basename(self.pyfile.url) if not exists(self.pyfile.url): - if exists(fs_join(pypath, self.pyfile.url)): - self.pyfile.url = fs_join(pypath, self.pyfile.url) + if exists(fsjoin(pypath, self.pyfile.url)): + self.pyfile.url = fsjoin(pypath, self.pyfile.url) else: self.fail(_("File not exists")) else: self.data = self.pyfile.url #@NOTE: ??? - - - def delete_tmp(self): - if not self.pyfile.name.startswith("tmp_"): - return - - try: - os.remove(self.pyfile.url) - except OSError, e: - self.log_warning(_("Error removing `%s`") % self.pyfile.url, e) |