summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-02-11 14:57:27 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-02-11 14:57:27 +0100
commitd81cc8c0c46d295a3746ac658069820c95efe895 (patch)
treed8d6df73b9f90452a077b2f93615304bb8654417 /module
parentWebinterface with lighttpd! locale fixing try. (diff)
downloadpyload-d81cc8c0c46d295a3746ac658069820c95efe895.tar.xz
cnl, EOL, path fixes
Diffstat (limited to 'module')
-rw-r--r--module/HookManager.py2
-rw-r--r--module/file_list.py26
-rw-r--r--module/plugins/hooks/ExternalScripts.py15
-rw-r--r--module/plugins/hooks/LinuxFileEvents.py2
-rw-r--r--module/web/cnl/views.py28
-rw-r--r--module/web/urls.py2
6 files changed, 46 insertions, 29 deletions
diff --git a/module/HookManager.py b/module/HookManager.py
index a283a7349..01d191ce4 100644
--- a/module/HookManager.py
+++ b/module/HookManager.py
@@ -28,7 +28,7 @@ from module.XMLConfigParser import XMLConfigParser
class HookManager():
def __init__(self, core):
self.core = core
- self.configParser = XMLConfigParser(join("module", "config", "plugin.xml"))
+ self.configParser = XMLConfigParser(join(core.path, "module", "config", "plugin.xml"))
self.configParser.loadData()
self.config = self.configParser.getConfig()
self.logger = logging.getLogger("log")
diff --git a/module/file_list.py b/module/file_list.py
index 84f875cad..2cdda99c4 100644
--- a/module/file_list.py
+++ b/module/file_list.py
@@ -23,17 +23,19 @@
LIST_VERSION = 4
-from threading import RLock
-from download_thread import Status
-import cPickle
-import re
-import module.Plugin
-from operator import concat
from operator import attrgetter
-from os import sep
+from operator import concat
+from os.path import join
+import re
+from threading import RLock
from time import sleep
-from module.PullEvents import UpdateEvent, RemoveEvent, InsertEvent
+import cPickle
+from download_thread import Status
+import module.Plugin
+from module.PullEvents import InsertEvent
+from module.PullEvents import RemoveEvent
+from module.PullEvents import UpdateEvent
class NoSuchElementException(Exception):
pass
@@ -57,7 +59,7 @@ class File_List(object):
def load(self):
self.lock.acquire()
try:
- pkl_file = open('module' + sep + 'links.pkl', 'rb')
+ pkl_file = open(join(self.core.path, 'module', 'links.pkl'), 'rb')
obj = cPickle.load(pkl_file)
except:
obj = False
@@ -104,7 +106,7 @@ class File_List(object):
pdata["queue"] = [PyLoadPackageData().set(x) for x in self.data["queue"]]
pdata["collector"] = [PyLoadFileData().set(x) for x in self.data["collector"]]
- output = open('module' + sep + 'links.pkl', 'wb')
+ output = open(join(self.core.path, 'module', 'links.pkl'), 'wb')
cPickle.dump(pdata, output, -1)
self.lock.release()
@@ -214,7 +216,7 @@ class File_List(object):
"""
pyfile = PyLoadFile(url, collector.file_list)
pyfile.id = collector._getFreeID()
- pyfile.folder = collector.file_list.download_folder
+ pyfile.folder = collector.file_list.download_folder
collector.file_list.lock.acquire()
collector.file_list.data["collector"].append(pyfile)
collector.file_list.lock.release()
@@ -248,7 +250,7 @@ class File_List(object):
"""
returns a free id
"""
- ids = [ pypack.data["id"] for pypack in packager.file_list.data["packages"] + packager.file_list.data["queue"]]
+ ids = [pypack.data["id"] for pypack in packager.file_list.data["packages"] + packager.file_list.data["queue"]]
id = 1
while id in ids:
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py
index 30bd43770..01daab87a 100644
--- a/module/plugins/hooks/ExternalScripts.py
+++ b/module/plugins/hooks/ExternalScripts.py
@@ -36,17 +36,20 @@ class ExternalScripts(Hook):
self.core = core
self.scripts = {}
- script_folders = ['scripts'+sep+'download_preparing'+sep,
- 'scripts'+sep+'download_finished'+sep,
- 'scripts'+sep+'package_finished'+sep,
- 'scripts'+sep+'before_reconnect'+sep,
- 'scripts'+sep+'after_reconnect'+sep]
+ script_folders = [join(core.path, 'scripts','download_preparing'),
+ join(core.path,'scripts','download_finished'),
+ join(core.path,'scripts','package_finished'),
+ join(core.path,'scripts','before_reconnect'),
+ join(core.path,'scripts','after_reconnect')]
+
+ folder = core.make_path("scripts")
+
+ self.core.check_file(folder, _("folders for scripts"), True)
self.core.check_file(script_folders, _("folders for scripts"), True)
f = lambda x: False if x.startswith("#") or x.endswith("~") else True
self.scripts = {}
- folder = join(self.core.path, "scripts")
self.scripts['download_preparing'] = filter(f, listdir(join(folder, 'download_preparing')))
self.scripts['download_finished'] = filter(f, listdir(join(folder, 'download_finished')))
diff --git a/module/plugins/hooks/LinuxFileEvents.py b/module/plugins/hooks/LinuxFileEvents.py
index f71521b33..ed206866a 100644
--- a/module/plugins/hooks/LinuxFileEvents.py
+++ b/module/plugins/hooks/LinuxFileEvents.py
@@ -35,7 +35,7 @@ class LinuxFileEvents(Hook):
if not os.name == "posix":
return
- self.core.check_file("container", _("folder for container"), True)
+ self.core.check_file(self.core.make_path("container"), _("folder for container"), True)
self.core.check_install("pyinotify", _("pyinotify for LinuxFileEvents"))
try:
diff --git a/module/web/cnl/views.py b/module/web/cnl/views.py
index 9d309dbf6..30d72ca5a 100644
--- a/module/web/cnl/views.py
+++ b/module/web/cnl/views.py
@@ -37,7 +37,7 @@ def local_check(function):
@local_check
def flash(request):
- return HttpResponse()
+ return HttpResponse("JDownloader")
@local_check
def add(request):
@@ -73,13 +73,25 @@ def addcrypted2(request):
crypted = base64.standard_b64decode(unquote(crypted.replace(" ", "+")))
- jk = re.findall(r"return ('|\")(.+)('|\")", jk)[0][1]
+ print jk
+ try:
+ jk = re.findall(r"return ('|\")(.+)('|\")", jk)[0][1]
+ except:
+ ## Test for some known js functions to decode
+ if jk.find("dec") > -1 and jk.find("org") > -1:
+ org = re.findall(r"var org = ('|\")([^\"']+)", jk)[0][1]
+ jk = list(org)
+ jk.reverse()
+ jk = "".join(jk)
+ print jk
+
+
Key = binascii.unhexlify(jk)
IV = Key
obj = AES.new(Key, AES.MODE_CBC, IV)
- result = obj.decrypt(crypted).replace("\x00", "").split("\n")
+ result = obj.decrypt(crypted).replace("\x00", "").replace("\r","").split("\n")
result = filter(lambda x: x != "", result)
@@ -103,9 +115,9 @@ def flashgot(request):
@local_check
def crossdomain(request):
- rep = "<?xml version=\"1.0\"?>\r\n"
- rep += "<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">\r\n"
- rep += "<cross-domain-policy>\r\n"
- rep += "<allow-access-from domain=\"*\" />\r\n"
- rep += "</cross-domain-policy>\r\n"
+ rep = "<?xml version=\"1.0\"?>\n"
+ rep += "<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">\n"
+ rep += "<cross-domain-policy>\n"
+ rep += "<allow-access-from domain=\"*\" />\n"
+ rep += "</cross-domain-policy>"
return HttpResponse(rep) \ No newline at end of file
diff --git a/module/web/urls.py b/module/web/urls.py
index b753890ee..165c7e146 100644
--- a/module/web/urls.py
+++ b/module/web/urls.py
@@ -16,7 +16,7 @@ urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)), # django 1.0 not working
(r'^json/', include('ajax.urls')),
(r'^flashgot$', 'cnl.views.flashgot'),
- (r'^flash(got)?/', include('cnl.urls')),
+ (r'^flash(got)?/?', include('cnl.urls')),
(r'^crossdomain.xml$', 'cnl.views.crossdomain'),
(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/media/img/favicon.ico'}),
(r'^media/(?P<path>.*)$', 'django.views.static.serve',