From c039d5822c4c53661813b6fd8e2252a3b633532e Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Fri, 27 Feb 2015 04:39:45 +0100
Subject: [container] Code cosmetics

---
 module/plugins/container/CCF.py  |  6 +++---
 module/plugins/container/DLC.py  |  8 ++++----
 module/plugins/container/RSDF.py | 19 +++++++++++--------
 module/plugins/container/TXT.py  | 10 +++++-----
 4 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py
index 452b9bb65..79d7879a7 100644
--- a/module/plugins/container/CCF.py
+++ b/module/plugins/container/CCF.py
@@ -26,13 +26,13 @@ class CCF(Container):
 
 
     def decrypt(self, pyfile):
-        file   = fs_encode(pyfile.url.strip())
-        opener = build_opener(MultipartPostHandler)
+        fs_filename = fs_encode(pyfile.url.strip())
+        opener      = build_opener(MultipartPostHandler)
 
         dlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php',
                                   {'src'     : "ccf",
                                    'filename': "test.ccf",
-                                   'upload'  : open(file, "rb")}).read()
+                                   'upload'  : open(fs_filename, "rb")}).read()
 
         download_folder = self.config['general']['download_folder']
         dlc_file        = save_join(download_folder, "tmp_%s.dlc" % pyfile.name)
diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py
index d1c34ef50..ff2f0104a 100644
--- a/module/plugins/container/DLC.py
+++ b/module/plugins/container/DLC.py
@@ -33,8 +33,8 @@ class DLC(Container):
 
 
     def decrypt(self, pyfile):
-        file = fs_encode(pyfile.url.strip())
-        with open(file) as dlc:
+        fs_filename = fs_encode(pyfile.url.strip())
+        with open(fs_filename) as dlc:
             data = dlc.read().strip()
 
         data += '=' * (-len(data) % 4)
@@ -52,8 +52,8 @@ class DLC(Container):
         key = iv = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc)
 
         self.data     = AES.new(key, AES.MODE_CBC, iv).decrypt(dlc_data).decode('base64')
-        self.packages = [(entry[0] if entry[0] else pyfile.name, entry[1], entry[0] if entry[0] else pyfile.name) \
-                         for entry in self.getPackages()]
+        self.packages = [(name or pyfile.name, links, name or pyfile.name) \
+                         for name, links in self.getPackages()]
 
 
     def getPackages(self):
diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py
index 60e15e2b5..dd2d14cf7 100644
--- a/module/plugins/container/RSDF.py
+++ b/module/plugins/container/RSDF.py
@@ -37,22 +37,25 @@ class RSDF(Container):
         cipher = AES.new(KEY, AES.MODE_CFB, iv)
 
         try:
-            file = fs_encode(pyfile.url.strip())
-            with open(file, 'r') as rsdf:
+            fs_filename = fs_encode(pyfile.url.strip())
+            with open(fs_filename, 'r') as rsdf:
                 data = rsdf.read()
 
         except IOError, e:
             self.fail(e)
 
         if re.search(r"<title>404 - Not Found</title>", data):
-            return
+            pyfile.setStatus("offline")
 
-        try:
-            for link in binascii.unhexlify(''.join(data.split())).splitlines():
+        else:
+            try:
+                raw_links = binascii.unhexlify(''.join(data.split())).splitlines()
+
+            except TypeError:
+                self.fail(_("Container is corrupted"))
+
+            for link in raw_links:
                 if not link:
                     continue
                 link = cipher.decrypt(link.decode('base64')).replace('CCF: ', '')
                 self.urls.append(link)
-
-        except TypeError:
-            self.fail(_("Container is corrupted"))
diff --git a/module/plugins/container/TXT.py b/module/plugins/container/TXT.py
index 585da8ac6..98ca426d7 100644
--- a/module/plugins/container/TXT.py
+++ b/module/plugins/container/TXT.py
@@ -28,10 +28,10 @@ class TXT(Container):
         except Exception:
             encoding = "utf-8"
 
-        file     = fs_encode(pyfile.url.strip())
-        txt      = codecs.open(file, 'r', encoding)
-        curPack  = "Parsed links from %s" % pyfile.name
-        packages = {curPack:[],}
+        fs_filename = fs_encode(pyfile.url.strip())
+        txt         = codecs.open(fs_filename, 'r', encoding)
+        curPack     = "Parsed links from %s" % pyfile.name
+        packages    = {curPack:[],}
 
         for link in txt.readlines():
             link = link.strip()
@@ -59,7 +59,7 @@ class TXT(Container):
 
         if self.getConfig("flush"):
             try:
-                txt = open(file, 'wb')
+                txt = open(fs_filename, 'wb')
                 txt.close()
 
             except IOError:
-- 
cgit v1.2.3