summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/hooks/ClickAndLoad.py112
-rw-r--r--module/web/ajax/urls.py1
-rw-r--r--module/web/ajax/views.py8
-rw-r--r--module/web/cnl/__init__.py0
-rw-r--r--module/web/cnl/models.py3
-rw-r--r--module/web/cnl/tests.py23
-rw-r--r--module/web/cnl/urls.py18
-rw-r--r--module/web/cnl/views.py83
-rw-r--r--module/web/media/default/img/Button-Add-grey.pngbin2112 -> 0 bytes
-rw-r--r--module/web/media/default/img/Button-Add.pngbin2110 -> 0 bytes
-rw-r--r--module/web/media/default/img/Button-Pause-grey.pngbin1932 -> 0 bytes
-rw-r--r--module/web/media/default/img/Button-Pause.pngbin2146 -> 0 bytes
-rw-r--r--module/web/media/default/img/Button-Play-grey.pngbin1938 -> 0 bytes
-rw-r--r--module/web/media/default/img/Button-Play.pngbin2023 -> 0 bytes
-rw-r--r--module/web/media/default/img/head-menu-collector.pngbin0 -> 1953 bytes
-rw-r--r--module/web/media/default/img/head-menu-config.pngbin0 -> 1802 bytes
-rw-r--r--module/web/media/default/img/head-menu-development.pngbin1324 -> 876 bytes
-rw-r--r--module/web/media/default/img/head-menu-queue.pngbin0 -> 2629 bytes
-rw-r--r--module/web/media/default/img/package_go.pngbin0 -> 898 bytes
-rw-r--r--module/web/pyload/urls.py2
-rw-r--r--module/web/pyload/views.py21
-rw-r--r--module/web/settings.py1
-rw-r--r--module/web/templates/default/base.html12
-rw-r--r--module/web/templates/default/collector.html152
-rw-r--r--module/web/templates/default/downloads.html16
-rw-r--r--module/web/templates/default/logs.html18
-rw-r--r--module/web/templates/default/queue.html37
-rw-r--r--module/web/templates/default/settings.html32
-rw-r--r--module/web/urls.py3
-rwxr-xr-xpyLoadCli.py2
-rwxr-xr-xpyLoadCore.py11
31 files changed, 524 insertions, 31 deletions
diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py
new file mode 100644
index 000000000..83a328276
--- /dev/null
+++ b/module/plugins/hooks/ClickAndLoad.py
@@ -0,0 +1,112 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+ @interface-version: 0.1
+"""
+
+import asyncore
+import socket
+import thread
+
+from module.plugins.Hook import Hook
+
+class ClickAndLoad(Hook):
+ def __init__(self, core):
+ Hook.__init__(self, core)
+ props = {}
+ props['name'] = "ClickAndLoad"
+ props['version'] = "0.1"
+ props['description'] = """Gives abillity to use jd's click and load. depends on webinterface"""
+ props['author_name'] = ("RaNaN")
+ props['author_mail'] = ("RaNaN@pyload.de")
+ self.props = props
+
+ self.port = int(self.core.config['webinterface']['port'])
+ if not self.core.config['webinterface']['activated']:
+ forwarder('127.0.0.1', 9666, '127.0.0.1', self.port)
+ thread.start_new_thread(asyncore.loop, ())
+
+class forwarder(asyncore.dispatcher):
+ def __init__(self, ip, port, remoteip, remoteport, backlog=5):
+ asyncore.dispatcher.__init__(self)
+ self.remoteip = remoteip
+ self.remoteport = remoteport
+ self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.set_reuse_addr()
+ self.bind((ip, port))
+ self.listen(backlog)
+
+ def handle_accept(self):
+ conn, addr = self.accept()
+ # print '--- Connect --- '
+ sender(receiver(conn), self.remoteip, self.remoteport)
+
+class receiver(asyncore.dispatcher):
+ def __init__(self, conn):
+ asyncore.dispatcher.__init__(self, conn)
+ self.from_remote_buffer = ''
+ self.to_remote_buffer = ''
+ self.sender = None
+
+ def handle_connect(self):
+ pass
+
+ def handle_read(self):
+ read = self.recv(4096)
+ # print '%04i -->'%len(read)
+ self.from_remote_buffer += read
+
+ def writable(self):
+ return (len(self.to_remote_buffer) > 0)
+
+ def handle_write(self):
+ sent = self.send(self.to_remote_buffer)
+ # print '%04i <--'%sent
+ self.to_remote_buffer = self.to_remote_buffer[sent:]
+
+ def handle_close(self):
+ self.close()
+ if self.sender:
+ self.sender.close()
+
+class sender(asyncore.dispatcher):
+ def __init__(self, receiver, remoteaddr, remoteport):
+ asyncore.dispatcher.__init__(self)
+ self.receiver = receiver
+ receiver.sender = self
+ self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.connect((remoteaddr, remoteport))
+
+ def handle_connect(self):
+ pass
+
+ def handle_read(self):
+ read = self.recv(4096)
+ # print '<-- %04i'%len(read)
+ self.receiver.to_remote_buffer += read
+
+ def writable(self):
+ return (len(self.receiver.from_remote_buffer) > 0)
+
+ def handle_write(self):
+ sent = self.send(self.receiver.from_remote_buffer)
+ # print '--> %04i'%sent
+ self.receiver.from_remote_buffer = self.receiver.from_remote_buffer[sent:]
+
+ def handle_close(self):
+ self.close()
+ self.receiver.close() \ No newline at end of file
diff --git a/module/web/ajax/urls.py b/module/web/ajax/urls.py
index d50e7121e..dd68729eb 100644
--- a/module/web/ajax/urls.py
+++ b/module/web/ajax/urls.py
@@ -26,4 +26,5 @@ urlpatterns = patterns('ajax',
(r'^restart_package/(\d+)$', 'views.restart_package'),
(r'^remove_link/(\d+)$', 'views.remove_link'),
(r'^restart_link/(\d+)$', 'views.restart_link'),
+ (r'^push_to_queue/(\d+)$', 'views.push_to_queue'),
) \ No newline at end of file
diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py
index 4d9762ab4..d00c283f1 100644
--- a/module/web/ajax/views.py
+++ b/module/web/ajax/views.py
@@ -193,4 +193,12 @@ def abort_link(request, id):
settings.PYLOAD.stop_download("link", int(id))
return JsonResponse("sucess")
except:
+ return HttpResponseServerError()
+
+@permission('pyload.can_add_dl')
+def push_to_queue(request, id):
+ try:
+ settings.PYLOAD.push_package_2_queue(int(id))
+ return JsonResponse("sucess")
+ except:
return HttpResponseServerError() \ No newline at end of file
diff --git a/module/web/cnl/__init__.py b/module/web/cnl/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/module/web/cnl/__init__.py
diff --git a/module/web/cnl/models.py b/module/web/cnl/models.py
new file mode 100644
index 000000000..71a836239
--- /dev/null
+++ b/module/web/cnl/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/module/web/cnl/tests.py b/module/web/cnl/tests.py
new file mode 100644
index 000000000..2247054b3
--- /dev/null
+++ b/module/web/cnl/tests.py
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
diff --git a/module/web/cnl/urls.py b/module/web/cnl/urls.py
new file mode 100644
index 000000000..5e06b639f
--- /dev/null
+++ b/module/web/cnl/urls.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from django.conf.urls.defaults import *
+
+
+urlpatterns = patterns('cnl',
+ # Example:
+ # (r'^pyload/', include('pyload.foo.urls')),
+
+ # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
+ # to INSTALLED_APPS to enable admin documentation:
+ # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
+
+ # Uncomment the next line to enable the admin:
+ (r'^add$', 'views.add'),
+ (r'^addcrypted$', 'views.addcrypted'),
+ (r'^addcrypted2$', 'views.addcrypted2'),
+ (r'', 'views.flash')
+ ) \ No newline at end of file
diff --git a/module/web/cnl/views.py b/module/web/cnl/views.py
new file mode 100644
index 000000000..490a445f1
--- /dev/null
+++ b/module/web/cnl/views.py
@@ -0,0 +1,83 @@
+# Create your views here.
+
+
+from django.conf import settings
+from django.http import HttpResponse
+from django.http import HttpResponseServerError
+from os.path import join
+import binascii
+from urllib import unquote
+import re
+import base64
+
+try:
+ from Crypto.Cipher import AES
+except:
+ pass
+
+def flash(request):
+ return HttpResponse()
+
+def add(request):
+ package = request.POST.get('referer','ClickAndLoad Package')
+ urls = filter(lambda x: x != "", request.POST['urls'].split("\n"))
+
+ settings.PYLOAD.add_package(package, urls, False)
+
+ return HttpResponse()
+
+def addcrypted(request):
+
+ package = request.POST.get('referer','ClickAndLoad Package')
+ dlc = request.POST['crypted'].replace(" ","+")
+
+ dlc_path = join(settings.DL_ROOT, package.replace("/","").replace("\\","").replace(":","")+".dlc")
+ dlc_file = file(dlc_path, "wb")
+ dlc_file.write(dlc)
+ dlc_file.close()
+
+
+ settings.PYLOAD.add_package(package, [dlc_path], False)
+
+ return HttpResponse()
+
+def addcrypted2(request):
+
+ package = request.POST.get("source", "ClickAndLoad Package")
+ crypted = request.POST["crypted"]
+ jk = request.POST["jk"]
+
+ crypted = base64.standard_b64decode(unquote(crypted.replace(" ","+")))
+
+ jk = re.findall(r"return ('|\")(.+)('|\")", jk)[0][1]
+
+ Key = binascii.unhexlify(jk)
+ IV = Key
+
+ obj = AES.new(Key, AES.MODE_CBC, IV)
+ result = obj.decrypt(crypted).replace("\x00","").split("\n")
+
+ settings.PYLOAD.add_package(package, result, False)
+
+ return HttpResponse()
+
+def flashgot(request):
+ if request.META['HTTP_REFERER'] != "http://localhost:9666/flashgot" and request.META['HTTP_REFERER'] != "http://127.0.0.1:9666/flashgot":
+ return HttpResponseServerError()
+
+ autostart = int(request.POST.get('autostart',0))
+ package = request.POST.get('package', "FlashGot")
+ urls = request.POST['urls'].split("\n")
+ folder = request.POST.get('dir', None)
+
+ settings.PYLOAD.add_package(package, urls, autostart)
+
+ return HttpResponse("")
+
+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"
+ return HttpResponse(rep) \ No newline at end of file
diff --git a/module/web/media/default/img/Button-Add-grey.png b/module/web/media/default/img/Button-Add-grey.png
deleted file mode 100644
index 6659e230e..000000000
--- a/module/web/media/default/img/Button-Add-grey.png
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/Button-Add.png b/module/web/media/default/img/Button-Add.png
deleted file mode 100644
index 602da4131..000000000
--- a/module/web/media/default/img/Button-Add.png
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/Button-Pause-grey.png b/module/web/media/default/img/Button-Pause-grey.png
deleted file mode 100644
index d1017e974..000000000
--- a/module/web/media/default/img/Button-Pause-grey.png
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/Button-Pause.png b/module/web/media/default/img/Button-Pause.png
deleted file mode 100644
index 68f3ffc3a..000000000
--- a/module/web/media/default/img/Button-Pause.png
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/Button-Play-grey.png b/module/web/media/default/img/Button-Play-grey.png
deleted file mode 100644
index 9f44c2289..000000000
--- a/module/web/media/default/img/Button-Play-grey.png
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/Button-Play.png b/module/web/media/default/img/Button-Play.png
deleted file mode 100644
index 1ce1ed913..000000000
--- a/module/web/media/default/img/Button-Play.png
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/head-menu-collector.png b/module/web/media/default/img/head-menu-collector.png
new file mode 100644
index 000000000..861be40bc
--- /dev/null
+++ b/module/web/media/default/img/head-menu-collector.png
Binary files differ
diff --git a/module/web/media/default/img/head-menu-config.png b/module/web/media/default/img/head-menu-config.png
new file mode 100644
index 000000000..bbf43d4f3
--- /dev/null
+++ b/module/web/media/default/img/head-menu-config.png
Binary files differ
diff --git a/module/web/media/default/img/head-menu-development.png b/module/web/media/default/img/head-menu-development.png
index 8ef08e2e5..fad150fe1 100644
--- a/module/web/media/default/img/head-menu-development.png
+++ b/module/web/media/default/img/head-menu-development.png
Binary files differ
diff --git a/module/web/media/default/img/head-menu-queue.png b/module/web/media/default/img/head-menu-queue.png
new file mode 100644
index 000000000..be98793ce
--- /dev/null
+++ b/module/web/media/default/img/head-menu-queue.png
Binary files differ
diff --git a/module/web/media/default/img/package_go.png b/module/web/media/default/img/package_go.png
new file mode 100644
index 000000000..aace63ad6
--- /dev/null
+++ b/module/web/media/default/img/package_go.png
Binary files differ
diff --git a/module/web/pyload/urls.py b/module/web/pyload/urls.py
index 73ba08c21..34c3aee18 100644
--- a/module/web/pyload/urls.py
+++ b/module/web/pyload/urls.py
@@ -11,6 +11,8 @@ urlpatterns = patterns('pyload',
(r'^downloads/$', 'views.downloads',{},'downloads'),
(r'^download/(?P<path>[a-zA-z\.0-9\-/_%]+)$', 'views.download',{},'download'),
(r'^queue/$', 'views.queue',{}, 'queue'),
+ (r'^collector/$', 'views.collector',{}, 'collector'),
+ (r'^settings/$', 'views.config',{}, 'config'),
(r'^logs/$', 'views.logs',{}, 'logs'),
(r'^logs/(?P<page>\d+)$', 'views.logs',{}, 'logs'),
(r'^$', 'views.home',{}, 'home'),
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index 9d3b6dd29..2891b373d 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -74,9 +74,7 @@ def home(request):
@permission('pyload.can_see_dl')
@check_server
def queue(request):
- queue = settings.PYLOAD.get_queue()
- for pack in queue:
- pack["children"] = map(settings.PYLOAD.get_file_info, settings.PYLOAD.get_package_files(pack["id"]))
+ queue = settings.PYLOAD.get_full_queue()
return render_to_response(join(settings.TEMPLATE, 'queue.html'), RequestContext(request, {'content': queue}, [status_proc]))
@@ -146,6 +144,7 @@ def download(request, path):
def logs(request, page=0):
log = file(join(settings.LOG_ROOT, "log.txt")).readlines()
+ log.reverse()
data = []
page = int(page)
try:
@@ -155,3 +154,19 @@ def logs(request, page=0):
pass
return render_to_response(join(settings.TEMPLATE, 'logs.html'), RequestContext(request, {'log': data, 'next': str(page + 20), 'prev': 0 if page-20 < 0 else page-20}, [status_proc]))
+
+@login_required
+@permission('pyload.can_add_dl')
+@check_server
+def collector(request):
+ coll = settings.PYLOAD.get_collector_packages()
+ for pack in coll:
+ pack["children"] = map(settings.PYLOAD.get_file_info, settings.PYLOAD.get_package_files(pack["id"]))
+ return render_to_response(join(settings.TEMPLATE, 'collector.html'), RequestContext(request, {'content': coll}, [status_proc]))
+
+
+@login_required
+@permission('pyload.can_change_status')
+@check_server
+def config(request):
+ return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {}, [status_proc]))
diff --git a/module/web/settings.py b/module/web/settings.py
index dfde88f5c..0b9a9e460 100644
--- a/module/web/settings.py
+++ b/module/web/settings.py
@@ -129,6 +129,7 @@ INSTALLED_APPS = (
'django.contrib.admin',
'pyload',
'ajax',
+ 'cnl'
)
diff --git a/module/web/templates/default/base.html b/module/web/templates/default/base.html
index bb44433ce..6f9157ecd 100644
--- a/module/web/templates/default/base.html
+++ b/module/web/templates/default/base.html
@@ -147,12 +147,20 @@ function AddBox()
<a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
</li>
<li>
- <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-download.png" alt="" /> {% trans "Queue" %}</a></li>
+ <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
+ </li>
+ <li>
+ <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
+ </li>
<li>
- <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a></li>
+ <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
+ </li>
<li class="right">
<a href="/logs/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
</li>
+ <li class="right">
+ <a href="/settings/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
+ </li>
{% endblock %}
</ul>
diff --git a/module/web/templates/default/collector.html b/module/web/templates/default/collector.html
new file mode 100644
index 000000000..73625136c
--- /dev/null
+++ b/module/web/templates/default/collector.html
@@ -0,0 +1,152 @@
+{% extends 'default/base.html' %}
+{% load i18n %}
+
+{% block head %}
+<script type="text/javascript">
+
+document.addEvent("domready", function(){
+ $$('.package').each(function(item){
+ id = item.get('id').match(/[0-9]+/)
+
+ imgs = item.getElements('img');
+ imgs[0].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/remove_package/'+this,
+ onSuccess: function(){
+ $('package_'+this).nix()
+ }.bind(this)
+ }).send();
+ e.stop();
+ }.bind(id));
+
+ imgs[1].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/restart_package/'+this,
+ onSuccess: function(){
+ $('package_'+this).nix()
+ }.bind(this)
+ }).send();
+ e.stop();
+ }.bind(id));
+
+ imgs[2].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/push_to_queue/'+this,
+ onSuccess: function(){
+ $('package_'+this).nix()
+ }.bind(this)
+ }).send();
+ e.stop();
+ }.bind(id));
+
+ item.getElement('.packagename').addEvent('click', function(){
+
+ child = item.getElement('.children')
+ if (child.getStyle('display') == "block"){
+ child.dissolve();
+ }else{
+ child.reveal();
+ }
+ }.bind(item));
+
+
+ item.getElements('.child').each(function(child){
+ id = child.get('id').match(/[0-9]+/)
+ imgs = child.getElements('.child_secrow img')
+ imgs[0].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/remove_link/'+this,
+ onSuccess: function(){
+ $('file_'+this).nix()
+ }.bind(this)
+ }).send();
+ }.bind(id));
+
+ imgs[1].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/restart_link/'+this,
+ onSuccess: function(){
+ $('file_'+this).nix()
+ }.bind(this)
+ }).send();
+ }.bind(id));
+ });
+
+ })
+});
+</script>
+{% endblock %}
+
+{% block title %}{% trans "Collector" %} - {{block.super}} {% endblock %}
+{% block subtitle %}{% trans "Collector" %}{% endblock %}
+
+{% block menu %}
+<li>
+ <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
+</li>
+<li>
+ <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
+</li>
+<li class="selected">
+ <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
+</li>
+<li>
+ <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
+</li>
+<li class="right">
+ <a href="/logs/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
+</li>
+<li class="right">
+ <a href="/settings/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
+</li>{% endblock %}
+
+{% block content %}
+{% for package in content %}
+<div id="package_{{package.id}}" class="package">
+ <div class="packagename" style="cursor: pointer;">
+ {{ package.package_name }}
+ &nbsp;&nbsp;
+ <img title="{% trans "Delete Package" %}" width="12px" height="12px" src="{{ MEDIA_URL }}img/delete.png" />
+ &nbsp;&nbsp;
+ <img title="{% trans "Reset Package" %}" style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
+ &nbsp;&nbsp;
+ <img title="{% trans "Push Package to Queue" %}" style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/package_go.png" />
+ </div>
+ <div id="children_{{package.id}}" style="display: none;" class="children">
+ {% for child in package.children %}
+ <div class="child" id="file_{{child.id}}">
+ <span class="child_status">
+ <img src="/media/default/img/status_{{child.status_type}}.png" style="width: 12px; height:12px;"/>
+ </span>
+ <span style="font-size: 15px">{{ child.filename }}</span><br />
+ <div class="child_secrow">
+ <span class="child_status">{{ child.status_type }}</span>{{child.status_error}}&nbsp;
+ <span class="child_status">{{ child.size }} KB</span>
+ <span class="child_status">{{ child.plugin }}</span>
+ <span class="child_status">{% trans "Folder:" %} {{child.folder}}</span>
+ &nbsp;&nbsp;
+ <img title="{% trans "Delete Link" %}" style="cursor: pointer;" width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" />
+ &nbsp;&nbsp;
+ <img title="{% trans "Restart Link" %}" style="cursor: pointer;margin-left: -4px" width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+</div>
+{% endfor %}
+<!--table >
+ <tr>
+ <td colspan="3"><h1>!Paketname!</h1></td>
+ </tr>
+ <tr>
+ <td><h2>test.png</h2></td>
+ <td>loading</td>
+ <td><a href="/"><img id="button" src="/img/button-delete.gif" alt="delete" /></a><a href="/"><img id="button" src="/img/button-unpause.gif" alt="unpause" /></a></td>
+ </tr>
+</table-->
+{% endblock %} \ No newline at end of file
diff --git a/module/web/templates/default/downloads.html b/module/web/templates/default/downloads.html
index 3c370aaa2..b9cffa955 100644
--- a/module/web/templates/default/downloads.html
+++ b/module/web/templates/default/downloads.html
@@ -5,14 +5,22 @@
{% block menu %}
<li>
- <a href="{% url home %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> Home</a>
+ <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
</li>
<li>
- <a href="{% url queue %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-download.png" alt="" /> Queue</a></li>
+ <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
+</li>
+<li>
+ <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
+</li>
<li class="selected">
- <a href="{% url downloads %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> Downloads</a></li>
+ <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
+</li>
+<li class="right">
+ <a href="/logs/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
+</li>
<li class="right">
- <a href="{% url logs %}" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />Logs</a>
+ <a href="/settings/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
</li>
{% endblock %}
diff --git a/module/web/templates/default/logs.html b/module/web/templates/default/logs.html
index 8dbe5a382..52120ffc4 100644
--- a/module/web/templates/default/logs.html
+++ b/module/web/templates/default/logs.html
@@ -6,14 +6,22 @@
{% block menu %}
<li>
- <a href="{% url home %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> Home</a>
+ <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
</li>
<li>
- <a href="{% url queue %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-download.png" alt="" /> Queue</a></li>
+ <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
+</li>
+<li>
+ <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
+</li>
<li>
- <a href="{% url downloads %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> Downloads</a></li>
-<li class="right" class="selected">
- <a href="{% url logs %}" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />Logs</a>
+ <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
+</li>
+<li class="right selected">
+ <a href="/logs/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
+</li>
+<li class="right">
+ <a href="/settings/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
</li>
{% endblock %}
diff --git a/module/web/templates/default/queue.html b/module/web/templates/default/queue.html
index 4cc01eeef..d33a11032 100644
--- a/module/web/templates/default/queue.html
+++ b/module/web/templates/default/queue.html
@@ -76,23 +76,36 @@ document.addEvent("domready", function(){
{% block subtitle %}{% trans "Queue" %}{% endblock %}
{% block menu %}
-<li> <a href="{% url home %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a> </li>
-<li class="selected"> <a href="{% url queue %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-download.png" alt="" /> {% trans "Queue" %}</a></li>
-<li> <a href="{% url downloads %}" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a></li>
-<li class="right"> <a href="{% url logs %}" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a> </li>
-{% endblock %}
+<li>
+ <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
+</li>
+<li class="selected">
+ <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
+</li>
+<li>
+ <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
+</li>
+<li>
+ <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
+</li>
+<li class="right">
+ <a href="/logs/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
+</li>
+<li class="right">
+ <a href="/settings/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
+</li>{% endblock %}
{% block content %}
{% for package in content %}
-<div id="package_{{package.id}}" class="package">
+<div id="package_{{package.data.id}}" class="package">
<div class="packagename" style="cursor: pointer;">
- {{ package.package_name }}
+ {{ package.data.package_name }}
&nbsp;&nbsp;
- <img width="12px" height="12px" src="{{ MEDIA_URL }}img/delete.png" />
+ <img title="{% trans "Delete Package" %}" width="12px" height="12px" src="{{ MEDIA_URL }}img/delete.png" />
&nbsp;&nbsp;
- <img style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
+ <img title="{% trans "Restart Package" %}" style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
</div>
- <div id="children_{{package.id}}" style="display: none;" class="children">
+ <div id="children_{{package.data.id}}" style="display: none;" class="children">
{% for child in package.children %}
<div class="child" id="file_{{child.id}}">
<span class="child_status">
@@ -105,9 +118,9 @@ document.addEvent("domready", function(){
<span class="child_status">{{ child.plugin }}</span>
<span class="child_status">{% trans "Folder:" %} {{child.folder}}</span>
&nbsp;&nbsp;
- <img style="cursor: pointer;" width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" />
+ <img title="{% trans "Delete Link" %}" style="cursor: pointer;" width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" />
&nbsp;&nbsp;
- <img style="cursor: pointer;margin-left: -4px" width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
+ <img title="{% trans "Restart Link" %}" style="cursor: pointer;margin-left: -4px" width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
</div>
</div>
{% endfor %}
diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html
new file mode 100644
index 000000000..ab144bed6
--- /dev/null
+++ b/module/web/templates/default/settings.html
@@ -0,0 +1,32 @@
+{% extends 'default/base.html' %}
+{% load i18n %}
+
+{% block title %}{% trans "Config" %} - {{block.super}} {% endblock %}
+{% block subtitle %}{% trans "Config" %}{% endblock %}
+
+{% block menu %}
+<li>
+ <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
+</li>
+<li>
+ <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
+</li>
+<li>
+ <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
+</li>
+<li>
+ <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
+</li>
+<li class="right">
+ <a href="/logs/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
+</li>
+<li class="right selected">
+ <a href="/settings/" class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
+</li>
+{% endblock %}
+
+{% block content %}
+
+<h3>Coming Soon.</h3>
+
+{% endblock %} \ No newline at end of file
diff --git a/module/web/urls.py b/module/web/urls.py
index 1392b827a..b753890ee 100644
--- a/module/web/urls.py
+++ b/module/web/urls.py
@@ -15,6 +15,9 @@ 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'^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',
{'document_root': settings.MEDIA_ROOT}),
diff --git a/pyLoadCli.py b/pyLoadCli.py
index 9b65bf2b3..03a44cc02 100755
--- a/pyLoadCli.py
+++ b/pyLoadCli.py
@@ -431,7 +431,7 @@ if __name__ == "__main__":
config = xmlconfig.getConfig()
translation = gettext.translation("pyLoadCli", join(abspath(dirname(__file__)), "locale"), languages=[config['general']['language']])
- translation.install(unicode=False if sys.getdefaultencoding() == "ascii" else True)
+ translation.install(unicode=(False if sys.stdout.encoding == "ascii" else True))
if len(sys.argv) > 1:
diff --git a/pyLoadCore.py b/pyLoadCore.py
index f85191ec4..30f025bbc 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -108,7 +108,7 @@ class Core(object):
self.do_kill = False
self.do_restart = False
translation = gettext.translation("pyLoad", join(self.path, "locale"), languages=[self.config['general']['language']])
- translation.install(unicode=False if sys.getdefaultencoding() == "ascii" else True)
+ translation.install(unicode=(False if sys.stdout.encoding == "ascii" else True))
self.check_install("Crypto", _("pycrypto to decode container files"))
self.check_install("Image", _("Python Image Libary (PIL) for captha reading"))
@@ -449,12 +449,15 @@ class ServerMethods():
self.core.file_list.collector.addLink(link)
self.core.file_list.save()
- def add_package(self, name, links):
+ def add_package(self, name, links, queue=True):
pid = self.new_package(name)
- self.core.file_list.packager.pushPackage2Queue(pid)
+
fids = map(self.core.file_list.collector.addLink, links)
map(lambda fid: self.move_file_2_package(fid, pid), fids)
- self.push_package_2_queue(pid)
+
+ if queue:
+ self.core.file_list.packager.pushPackage2Queue(pid)
+
self.core.file_list.save()
def new_package(self, name):