diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-08 01:08:03 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-14 11:03:20 +0200 |
commit | 91115fd577f20704ef7f2e74c4527ffbb0730a09 (patch) | |
tree | 198fc68f1eb6f42e220d0f1c68499f48ae70543c /pyload | |
parent | Project __init__ with info (diff) | |
download | pyload-91115fd577f20704ef7f2e74c4527ffbb0730a09.tar.xz |
Restructure pyload file tree (1)
Diffstat (limited to 'pyload')
109 files changed, 130 insertions, 968 deletions
diff --git a/pyload/Core.py b/pyload/Core.py index 5f506b980..3e78a5bea 100644 --- a/pyload/Core.py +++ b/pyload/Core.py @@ -25,7 +25,7 @@ CURRENT_VERSION = '0.4.10' import __builtin__ from getopt import getopt, GetoptError -import pyload.common.pylgettext as gettext +import pyload.utils.pylgettext as gettext from imp import find_module import logging import logging.handlers @@ -40,17 +40,17 @@ from time import time, sleep from traceback import print_exc from pyload import InitHomeDir -from pyload.plugins.AccountManager import AccountManager -from pyload.CaptchaManager import CaptchaManager -from pyload.ConfigParser import ConfigParser -from pyload.plugins.PluginManager import PluginManager -from pyload.PullEvents import PullManager +from pyload.manager.AccountManager import AccountManager +from pyload.manager.CaptchaManager import CaptchaManager +from pyload.config.Parser import ConfigParser +from pyload.manager.PluginManager import PluginManager +from pyload.manager.event.PullEvents import PullManager from pyload.network.RequestFactory import RequestFactory -from pyload.threads.ServerThread import WebServer -from pyload.Scheduler import Scheduler -from pyload.common.JsEngine import JsEngine +from pyload.manager.thread.ServerThread import WebServer +from pyload.manager.event.Scheduler import Scheduler +from pyload.utils.JsEngine import JsEngine from pyload import remote -from pyload.remote.RemoteManager import RemoteManager +from pyload.manager.RemoteManager import RemoteManager from pyload.database import DatabaseBackend, FileHandler from pyload.utils import freeSpace, formatSize, get_console_encoding @@ -99,21 +99,21 @@ class Core(object): elif option in ("-d", "--debug"): self.doDebug = True elif option in ("-u", "--user"): - from pyload.setup import Setup + from pyload.config.Setup import SetupAssistant as Setup self.config = ConfigParser() s = Setup(pypath, self.config) s.set_user() exit() elif option in ("-s", "--setup"): - from pyload.setup import Setup + from pyload.config.Setup import SetupAssistant as Setup self.config = ConfigParser() s = Setup(pypath, self.config) s.start() exit() elif option == "--changedir": - from pyload.setup import Setup + from pyload.config.Setup import SetupAssistant as Setup self.config = ConfigParser() s = Setup(pypath, self.config) @@ -263,7 +263,7 @@ class Core(object): self.version = CURRENT_VERSION if not exists("pyload.conf"): - from pyload.setup import Setup + from pyload.config.Setup import SetupAssistant as Setup print "This is your first start, running configuration assistent now." self.config = ConfigParser() @@ -376,14 +376,14 @@ class Core(object): self.lastClientConnected = 0 # later imported because they would trigger api import, and remote value not set correctly - from pyload import Api - from pyload.HookManager import HookManager - from pyload.ThreadManager import ThreadManager + from pyload import api + from pyload.manager.HookManager import HookManager + from pyload.manager.ThreadManager import ThreadManager - if Api.activated != self.remote: + if api.activated != self.remote: self.log.warning("Import error: API remote status not correct.") - self.api = Api.Api(self) + self.api = api.Api(self) self.scheduler = Scheduler(self) @@ -439,18 +439,6 @@ class Core(object): self.log.info(_("pyLoad is up and running")) - #test api -# from pyload.common.APIExerciser import startApiExerciser -# startApiExerciser(self, 3) - - #some memory stats -# from guppy import hpy -# hp=hpy() -# import objgraph -# objgraph.show_most_common_types(limit=20) -# import memdebug -# memdebug.start(8002) - locals().clear() while True: diff --git a/pyload/Api.py b/pyload/api/__init__.py index 066d490ec..3da1e13e1 100644 --- a/pyload/Api.py +++ b/pyload/api/__init__.py @@ -21,9 +21,9 @@ from os.path import join from time import time import re -from PyFile import PyFile +from pyload.datatypes.PyFile import PyFile from utils import freeSpace, compare_time -from common.packagetools import parseNames +from pyload.utils.packagetools import parseNames from network.RequestFactory import getURL from remote import activated diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py index 447829ef7..f05e98b1a 100644 --- a/pyload/cli/Cli.py +++ b/pyload/cli/Cli.py @@ -19,7 +19,7 @@ from __future__ import with_statement from getopt import GetoptError, getopt -import pyload.common.pylgettext as gettext +import pyload.utils.pylgettext as gettext import os from os import _exit from os.path import join, exists, abspath, basename @@ -29,7 +29,7 @@ from threading import Thread, Lock from time import sleep from traceback import print_exc -import ConfigParser +from pyload.config.Parser import ConfigParser from codecs import getwriter @@ -44,7 +44,7 @@ from pyload import InitHomeDir from pyload.cli.printer import * from pyload.cli import AddPackage, ManageFiles -from pyload.Api import Destination +from pyload.api import Destination from pyload.utils import formatSize, decode from pyload.remote.thriftbackend.ThriftClient import ThriftClient, NoConnection, NoSSL, WrongLogin, ConnectionClosed from Getch import Getch diff --git a/pyload/cli/ManageFiles.py b/pyload/cli/ManageFiles.py index fba96b990..6901e3731 100644 --- a/pyload/cli/ManageFiles.py +++ b/pyload/cli/ManageFiles.py @@ -23,7 +23,7 @@ from time import time from Handler import Handler from printer import * -from pyload.Api import Destination, PackageData +from pyload.api import Destination, PackageData class ManageFiles(Handler): """ possibility to manage queue/collector """ diff --git a/pyload/common/APIExerciser.py b/pyload/common/APIExerciser.py deleted file mode 100644 index 886c72a4a..000000000 --- a/pyload/common/APIExerciser.py +++ /dev/null @@ -1,157 +0,0 @@ -# -*- coding: utf-8 -*- - -import string -from threading import Thread -from random import choice, random, sample, randint -from time import time, sleep -from math import floor -import gc - -from traceback import print_exc, format_exc - -from pyload.remote.thriftbackend.ThriftClient import ThriftClient, Destination - -def createURLs(): - """ create some urls, some may fail """ - urls = [] - for x in range(0, randint(20, 100)): - name = "DEBUG_API" - if randint(0, 5) == 5: - name = "" #this link will fail - - urls.append(name + "".join(sample(string.ascii_letters, randint(10, 20)))) - - return urls - -AVOID = (0, 3, 8) - -idPool = 0 -sumCalled = 0 - - -def startApiExerciser(core, n): - for i in range(n): - APIExerciser(core).start() - -class APIExerciser(Thread): - - - def __init__(self, core, thrift=False, user=None, pw=None): - global idPool - - Thread.__init__(self) - self.setDaemon(True) - self.core = core - self.count = 0 #number of methods - self.time = time() - - if thrift: - self.api = ThriftClient(user=user, password=pw) - else: - self.api = core.api - - - self.id = idPool - - idPool += 1 - - #self.start() - - def run(self): - - self.core.log.info("API Excerciser started %d" % self.id) - - out = open("error.log", "ab") - #core errors are not logged of course - out.write("\n" + "Starting\n") - out.flush() - - while True: - try: - self.testAPI() - except Exception: - self.core.log.error("Excerciser %d throw an execption" % self.id) - print_exc() - out.write(format_exc() + 2 * "\n") - out.flush() - - if not self.count % 100: - self.core.log.info("Exerciser %d tested %d api calls" % (self.id, self.count)) - if not self.count % 1000: - out.flush() - - if not sumCalled % 1000: #not thread safe - self.core.log.info("Exercisers tested %d api calls" % sumCalled) - persec = sumCalled / (time() - self.time) - self.core.log.info("Approx. %.2f calls per second." % persec) - self.core.log.info("Approx. %.2f ms per call." % (1000 / persec)) - self.core.log.info("Collected garbage: %d" % gc.collect()) - - - #sleep(random() / 500) - - def testAPI(self): - global sumCalled - - m = ["statusDownloads", "statusServer", "addPackage", "getPackageData", "getFileData", "deleteFiles", - "deletePackages", "getQueue", "getCollector", "getQueueData", "getCollectorData", "isCaptchaWaiting", - "getCaptchaTask", "stopAllDownloads", "getAllInfo", "getServices" , "getAccounts", "getAllUserData"] - - method = choice(m) - #print "Testing:", method - - if hasattr(self, method): - res = getattr(self, method)() - else: - res = getattr(self.api, method)() - - self.count += 1 - sumCalled += 1 - - #print res - - def addPackage(self): - name = "".join(sample(string.ascii_letters, 10)) - urls = createURLs() - - self.api.addPackage(name, urls, choice([Destination.Queue, Destination.Collector])) - - - def deleteFiles(self): - info = self.api.getQueueData() - if not info: return - - pack = choice(info) - fids = pack.links - - if len(fids): - fids = [f.fid for f in sample(fids, randint(1, max(len(fids) / 2, 1)))] - self.api.deleteFiles(fids) - - - def deletePackages(self): - info = choice([self.api.getQueue(), self.api.getCollector()]) - if not info: return - - pids = [p.pid for p in info] - if len(pids): - pids = sample(pids, randint(1, max(floor(len(pids) / 2.5), 1))) - self.api.deletePackages(pids) - - def getFileData(self): - info = self.api.getQueueData() - if info: - p = choice(info) - if p.links: - self.api.getFileData(choice(p.links).fid) - - def getPackageData(self): - info = self.api.getQueue() - if info: - self.api.getPackageData(choice(info).pid) - - def getAccounts(self): - self.api.getAccounts(False) - - def getCaptchaTask(self): - self.api.getCaptchaTask(False) diff --git a/pyload/common/ImportDebugger.py b/pyload/common/ImportDebugger.py deleted file mode 100644 index ae3aef629..000000000 --- a/pyload/common/ImportDebugger.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -import sys - -class ImportDebugger(object): - - def __init__(self): - self.imported = {} - - def find_module(self, name, path=None): - - if name not in self.imported: - self.imported[name] = 0 - - self.imported[name] += 1 - - print name, path - -sys.meta_path.append(ImportDebugger()) diff --git a/pyload/common/json_layer.py b/pyload/common/json_layer.py deleted file mode 100644 index bb3937cdc..000000000 --- a/pyload/common/json_layer.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- - -# abstraction layer for json operations - -try: # since python 2.6 - import json - from json import loads as json_loads - from json import dumps as json_dumps -except ImportError: #use system simplejson if available - import simplejson as json - from simplejson import loads as json_loads - from simplejson import dumps as json_dumps diff --git a/pyload/common/pavement.py b/pyload/common/pavement.py deleted file mode 100644 index 9b2dc98b3..000000000 --- a/pyload/common/pavement.py +++ /dev/null @@ -1,412 +0,0 @@ -# -*- coding: utf-8 -*- - -from paver.easy import * -from paver.setuputils import setup -from paver.doctools import cog - -import os -import sys -import shutil -import re -from glob import glob -from tempfile import mkdtemp -from urllib import urlretrieve -from subprocess import call, Popen, PIPE -from zipfile import ZipFile - -PROJECT_DIR = path(__file__).dirname() -sys.path.append(PROJECT_DIR) - -options = environment.options -path("pyload").mkdir() - -extradeps = [] -if sys.version_info <= (2, 5): - extradeps += 'simplejson' - -setup( - name="pyload", - version="0.4.10", - description='Fast, lightweight and full featured download manager.', - long_description=open(PROJECT_DIR / "README.md").read(), - keywords = ("pyload", "download-manager", "one-click-hoster", "download"), - url="http://pyload.org", - download_url='http://pyload.org/download', - license='GPL v3', - author="pyLoad Team", - author_email="support@pyload.org", - platforms = ('Any',), - #package_dir={'pyload': "src"}, - packages=["pyload"], - #package_data=find_package_data(), - #data_files=[], - include_package_data=True, - exclude_package_data={'pyload': ["docs*", "scripts*", "tests*"]}, #exluced from build but not from sdist - # 'bottle >= 0.10.0' not in list, because its small and contain little modifications - install_requires=['thrift >= 0.8.0', 'jinja2', 'pycurl', 'Beaker', 'BeautifulSoup >= 3.2, < 3.3'] + extradeps, - extras_require={ - 'SSL': ["pyOpenSSL"], - 'DLC': ['pycrypto'], - 'lightweight webserver': ['bjoern'], - 'RSS plugins': ['feedparser'], - }, - #setup_requires=["setuptools_hg"], - entry_points={ - 'console_scripts': [ - 'pyLoadCore = pyLoadCore:main', - 'pyLoadCli = pyLoadCli:main' - ]}, - zip_safe=False, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Topic :: Internet :: WWW/HTTP", - "Environment :: Console", - "Environment :: Web Environment", - "Intended Audience :: End Users/Desktop", - "License :: OSI Approved :: GNU General Public License (GPL)", - "Operating System :: OS Independent", - "Programming Language :: Python :: 2" - ] -) - -options( - sphinx=Bunch( - builddir="_build", - sourcedir="" - ), - get_source=Bunch( - src="https://bitbucket.org/spoob/pyload/get/tip.zip", - rev=None, - clean=False - ), - thrift=Bunch( - path="../thrift/trunk/compiler/cpp/thrift", - gen="" - ), - virtualenv=Bunch( - dir="env", - python="python2", - virtual="virtualenv2", - ), - cog=Bunch( - pattern="*.py", - ) -) - -# xgettext args -xargs = ["--language=Python", "--add-comments=L10N", - "--from-code=utf-8", "--copyright-holder=pyLoad Team", "--package-name=pyLoad", - "--package-version=%s" % options.version, "--msgid-bugs-address='bugs@pyload.org'"] - -@task -@needs('cog') -def html(): - """Build html documentation""" - module = path("docs") / "pyload" - pyload.rmtree() - call_task('paver.doctools.html') - - -@task -@cmdopts([ - ('src=', 's', 'Url to source'), - ('rev=', 'r', "HG revision"), - ("clean", 'c', 'Delete old source folder') -]) -def get_source(options): - """ Downloads pyload source from bitbucket tip or given rev""" - if options.rev: options.url = "https://bitbucket.org/spoob/pyload/get/%s.zip" % options.rev - - pyload = path("pyload") - - if len(pyload.listdir()) and not options.clean: - return - elif pyload.exists(): - pyload.rmtree() - - urlretrieve(options.src, "pyload_src.zip") - zip = ZipFile("pyload_src.zip") - zip.extractall() - path("pyload_src.zip").remove() - - folder = [x for x in path(".").dirs() if x.name.startswith("spoob-pyload-")][0] - folder.move(pyload) - - change_mode(pyload, 0644) - change_mode(pyload, 0755, folder=True) - - for file in pyload.files(): - if file.name.endswith(".py"): - file.chmod(0755) - - (pyload / ".hgtags").remove() - (pyload / ".gitignore").remove() - #(pyload / "docs").rmtree() - - f = open(pyload / "__init__.py", "wb") - f.close() - - #options.setup.packages = find_packages() - #options.setup.package_data = find_package_data() - - -@task -@needs('clean', 'generate_setup', 'minilib', 'get_source', 'setuptools.command.sdist') -def sdist(): - """ Build source code package with distutils """ - - -@task -@cmdopts([ - ('path=', 'p', 'Thrift path'), - ('gen=', 'g', "Extra --gen option") -]) -def thrift(options): - """ Generate Thrift stubs """ - - print "add import for TApplicationException manually as long it is not fixed" - - outdir = path("pyload") / "remote" / "thriftbackend" - (outdir / "gen-py").rmtree() - - cmd = [options.thrift.path, "-strict", "-o", outdir, "--gen", "py:slots, dynamic", outdir / "pyload.thrift"] - - if options.gen: - cmd.insert(len(cmd) - 1, "--gen") - cmd.insert(len(cmd) - 1, options.gen) - - print "running", cmd - - p = Popen(cmd) - p.communicate() - - (outdir / "thriftgen").rmtree() - (outdir / "gen-py").move(outdir / "thriftgen") - - #create light ttypes - from pyload.remote.socketbackend.create_ttypes import main - main() - -@task -def compile_js(): - """ Compile .coffee files to javascript""" - - root = path("pyload") / "web" / "media" / "js" - for f in root.glob("*.coffee"): - print "generate", f - coffee = Popen(["coffee", "-cbs"], stdin=open(f, "rb"), stdout=PIPE) - yui = Popen(["yuicompressor", "--type", "js"], stdin=coffee.stdout, stdout=PIPE) - coffee.stdout.close() - content = yui.communicate()[0] - with open(root / f.name.replace(".coffee", ".js"), "wb") as js: - js.write("{% autoescape true %}\n") - js.write(content) - js.write("\n{% endautoescape %}") - - -@task -def generate_locale(): - """ Generates localization files """ - - EXCLUDE = ["BeautifulSoup.py", "pyload/cli", "web/locale", "web/ajax", "web/cnl", "web/pyload", - "setup.py"] - makepot("core", path("pyload"), EXCLUDE, "./pyload.py\n") - - makepot("cli", path("pyload") / "cli", [], includes="./pyload-cli.py\n") - makepot("setup", "", [], includes="./pyload/setup.py\n") - - EXCLUDE = ["ServerThread.py", "web/media/default"] - - # strings from js files - strings = set() - - for fi in path("pyload/web").walkfiles(): - if not fi.name.endswith(".js") and not fi.endswith(".coffee"): continue - with open(fi, "rb") as c: - content = c.read() - - strings.update(re.findall(r"_\s*\(\s*\"([^\"]+)", content)) - strings.update(re.findall(r"_\s*\(\s*\'([^\']+)", content)) - - trans = path("pyload") / "web" / "translations.js" - - with open(trans, "wb") as js: - for s in strings: - js.write('_("%s")\n' % s) - - makepot("django", path("pyload/web"), EXCLUDE, "./%s\n" % trans.relpath(), [".py", ".html"], ["--language=Python"]) - - trans.remove() - - path("includes.txt").remove() - - print "Locale generated" - - -@task -@cmdopts([ - ('key=', 'k', 'api key') -]) -def upload_translations(options): - """ Uploads the locale files to translation server """ - tmp = path(mkdtemp()) - - shutil.copy('locale/crowdin.yaml', tmp) - os.mkdir(tmp / 'pyLoad') - for f in glob('locale/*.pot'): - if os.path.isfile(f): - shutil.copy(f, tmp / 'pyLoad') - - config = tmp / 'crowdin.yaml' - content = open(config, 'rb').read() - content = content.format(key=options.key, tmp=tmp) - f = open(config, 'wb') - f.write(content) - f.close() - - call(['crowdin-cli', '-c', config, 'upload', 'source']) - - shutil.rmtree(tmp) - - print "Translations uploaded" - - -@task -@cmdopts([ - ('key=', 'k', 'api key') -]) -def download_translations(options): - """ Downloads the translated files from translation server """ - tmp = path(mkdtemp()) - - shutil.copy('locale/crowdin.yaml', tmp) - os.mkdir(tmp / 'pyLoad') - for f in glob('locale/*.pot'): - if os.path.isfile(f): - shutil.copy(f, tmp / 'pyLoad') - - config = tmp / 'crowdin.yaml' - content = open(config, 'rb').read() - content = content.format(key=options.key, tmp=tmp) - f = open(config, 'wb') - f.write(content) - f.close() - - call(['crowdin-cli', '-c', config, 'download']) - - for language in (tmp / 'pyLoad').listdir(): - if not language.isdir(): - continue - - target = path('locale') / language.basename() - print "Copy language %s" % target - if target.exists(): - shutil.rmtree(target) - - shutil.copytree(language, target) - - shutil.rmtree(tmp) - - -@task -def compile_translations(): - """ Compile PO files to MO """ - for language in path('locale').listdir(): - if not language.isdir(): - continue - - for f in glob(language / 'LC_MESSAGES' / '*.po'): - print "Compiling %s" % f - call(['msgfmt', '-o', f.replace('.po', '.mo'), f]) - - -@task -def tests(): - call(["nosetests2"]) - -@task -def virtualenv(options): - """Setup virtual environment""" - if path(options.dir).exists(): - return - - call([options.virtual, "--no-site-packages", "--python", options.python, options.dir]) - print "$ source %s/bin/activate" % options.dir - - -@task -def clean_env(): - """Deletes the virtual environment""" - env = path(options.virtualenv.dir) - if env.exists(): - env.rmtree() - - -@task -@needs('generate_setup', 'minilib', 'get_source', 'virtualenv') -def env_install(): - """Install pyLoad into the virtualenv""" - venv = options.virtualenv - call([path(venv.dir) / "bin" / "easy_install", "."]) - - -@task -def clean(): - """Cleans build directories""" - path("build").rmtree() - path("dist").rmtree() - - -#helper functions - -def walk_trans(path, EXCLUDE, endings=[".py"]): - result = "" - - for f in path.walkfiles(): - if [True for x in EXCLUDE if x in f.dirname().relpath()]: continue - if f.name in EXCLUDE: continue - - for e in endings: - if f.name.endswith(e): - result += "./%s\n" % f.relpath() - break - - return result - - -def makepot(domain, p, excludes=[], includes="", endings=[".py"], xxargs=[]): - print "Generate %s.pot" % domain - - f = open("includes.txt", "wb") - if includes: - f.write(includes) - - if p: - f.write(walk_trans(path(p), excludes, endings)) - - f.close() - - call(["xgettext", "--files-from=includes.txt", "--default-domain=%s" % domain] + xargs + xxargs) - - # replace charset und move file - with open("%s.po" % domain, "rb") as f: - content = f.read() - - path("%s.po" % domain).remove() - content = content.replace("charset=CHARSET", "charset=UTF-8") - - with open("locale/%s.pot" % domain, "wb") as f: - f.write(content) - - -def change_owner(dir, uid, gid): - for p in dir.walk(): - p.chown(uid, gid) - - -def change_mode(dir, mode, folder=False): - for p in dir.walk(): - if folder and p.isdir(): - p.chmod(mode) - elif p.isfile() and not folder: - p.chmod(mode) diff --git a/pyload/common/test_api.py b/pyload/common/test_api.py deleted file mode 100644 index 4efaa35d6..000000000 --- a/pyload/common/test_api.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.common import APIExerciser -from nose.tools import nottest - - -class TestApi: - - def __init__(self): - self.api = APIExerciser.APIExerciser(None, True, "TestUser", "pwhere") - - def test_login(self): - assert self.api.api.login("crapp", "wrong pw") is False - - #takes really long, only test when needed - @nottest - def test_random(self): - - for i in range(0, 100): - self.api.testAPI() diff --git a/pyload/common/test_json.py b/pyload/common/test_json.py deleted file mode 100644 index 320a42d4f..000000000 --- a/pyload/common/test_json.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -from urllib import urlencode -from urllib2 import urlopen, HTTPError -from json import loads - -from logging import log - -url = "http://localhost:8001/api/%s" - -class TestJson: - - def call(self, name, post=None): - if not post: post = {} - post["session"] = self.key - u = urlopen(url % name, data=urlencode(post)) - return loads(u.read()) - - def setUp(self): - u = urlopen(url % "login", data=urlencode({"username": "TestUser", "password": "pwhere"})) - self.key = loads(u.read()) - assert self.key is not False - - def test_wronglogin(self): - u = urlopen(url % "login", data=urlencode({"username": "crap", "password": "wrongpw"})) - assert loads(u.read()) is False - - def test_access(self): - try: - urlopen(url % "getServerVersion") - except HTTPError, e: - assert e.code == 403 - else: - assert False - - def test_status(self): - ret = self.call("statusServer") - log(1, str(ret)) - assert "pause" in ret - assert "queue" in ret - - def test_unknown_method(self): - try: - self.call("notExisting") - except HTTPError, e: - assert e.code == 404 - else: - assert False diff --git a/pyload/ConfigParser.py b/pyload/config/Parser.py index 64ce6b10e..64ce6b10e 100644 --- a/pyload/ConfigParser.py +++ b/pyload/config/Parser.py diff --git a/pyload/setup.py b/pyload/config/Setup.py index 6a98cc6f3..63c6188c4 100644 --- a/pyload/setup.py +++ b/pyload/config/Setup.py @@ -3,7 +3,7 @@ import os import sys -import pyload.common.pylgettext as gettext +import pyload.utils.pylgettext as gettext from getpass import getpass from os import makedirs @@ -13,7 +13,7 @@ from subprocess import PIPE, call from pyload.utils import get_console_encoding, versiontuple -class Setup: +class SetupAssistant: """ pyLoads initial setup configuration assistant """ def __init__(self, path, config): @@ -40,7 +40,7 @@ class Setup: # viaweb = self.ask(_("Start initial webinterface for configuration?"), "y", bool=True) # if viaweb: # try: - # from pyload.threads import ServerThread + # from pyload.manager.thread import ServerThread # ServerThread.setup = self # import pyload.webui as webinterface # webinterface.run_simple() @@ -264,7 +264,7 @@ class Setup: web = sqlite and beaker - from pyload.common import JsEngine + from pyload.utils import JsEngine js = True if JsEngine.ENGINE else False self.print_dep(_("JS engine"), js) diff --git a/pyload/database/FileDatabase.py b/pyload/database/FileDatabase.py index fb30735bb..54e5450e8 100644 --- a/pyload/database/FileDatabase.py +++ b/pyload/database/FileDatabase.py @@ -21,9 +21,9 @@ from threading import RLock from time import time from pyload.utils import formatSize, lock -from pyload.PullEvents import InsertEvent, ReloadAllEvent, RemoveEvent, UpdateEvent -from pyload.PyPackage import PyPackage -from pyload.PyFile import PyFile +from pyload.manager.event.PullEvents import InsertEvent, ReloadAllEvent, RemoveEvent, UpdateEvent +from pyload.datatypes.PyPackage import PyPackage +from pyload.datatypes.PyFile import PyFile from pyload.database import style, DatabaseBackend try: diff --git a/pyload/PyFile.py b/pyload/datatypes/PyFile.py index c4ce71570..be3129681 100644 --- a/pyload/PyFile.py +++ b/pyload/datatypes/PyFile.py @@ -16,7 +16,7 @@ @author: mkaay """ -from pyload.PullEvents import UpdateEvent +from pyload.manager.event.PullEvents import UpdateEvent from pyload.utils import formatSize, lock from time import sleep, time diff --git a/pyload/PyPackage.py b/pyload/datatypes/PyPackage.py index 3961d8a70..c8d3e6096 100644 --- a/pyload/PyPackage.py +++ b/pyload/datatypes/PyPackage.py @@ -16,7 +16,7 @@ @author: mkaay """ -from pyload.PullEvents import UpdateEvent +from pyload.manager.event.PullEvents import UpdateEvent from pyload.utils import safe_filename class PyPackage: diff --git a/pyload/common/__init__.py b/pyload/datatypes/__init__.py index e69de29bb..e69de29bb 100644 --- a/pyload/common/__init__.py +++ b/pyload/datatypes/__init__.py diff --git a/pyload/debug.py b/pyload/debug.py deleted file mode 100644 index 54a159e78..000000000 --- a/pyload/debug.py +++ /dev/null @@ -1,94 +0,0 @@ -#coding:utf-8 - -import re -import InitHomeDir -from os import listdir - -class Wrapper(object): - pass - -def filter_info(line): - if "object at 0x" in line: - return False - elif " at line " in line: - return False - elif " <DownloadThread(" in line: - return False - elif "<class '" in line: - return False - elif "PyFile " in line: - return False - elif " <module '" in line: - return False - - else: - return True - -def appendName(lines, name): - test = re.compile("^[a-zA-z0-9]+ = ") - - for i, line in enumerate(lines): - if test.match(line): - lines[i] = name+"."+line - - return lines - -def initReport(): - reports = [] - for f in listdir("."): - if f.startswith("debug_"): - reports.append(f) - - for i, f in enumerate(reports): - print "%s. %s" % (i, f) - - choice = raw_input("Choose Report: ") - - report = reports[int(choice)] - - f = open(report, "rb") - - content = f.readlines() - content = [x.strip() for x in content if x.strip()] - - frame = Wrapper() - plugin = Wrapper() - pyfile = Wrapper() - - frame_c = [] - plugin_c = [] - pyfile_c = [] - - dest = None - - for line in content: - if line == "FRAMESTACK:": - dest = frame_c - continue - elif line == "PLUGIN OBJECT DUMP:": - dest = plugin_c - continue - elif line == "PYFILE OBJECT DUMP:": - dest = pyfile_c - continue - elif line == "CONFIG:": - dest = None - - if dest is not None: - dest.append(line) - - - frame_c = filter(filter_info, frame_c) - plugin_c = filter(filter_info, plugin_c) - pyfile_c = filter(filter_info, pyfile_c) - - frame_c = appendName(frame_c, "frame") - plugin_c = appendName(plugin_c, "plugin") - pyfile_c = appendName(pyfile_c, "pyfile") - - exec("\n".join(frame_c+plugin_c+pyfile_c) ) - - return frame, plugin, pyfile - -if __name__=='__main__': - print "No main method, use this module with your python shell" diff --git a/pyload/forwarder.py b/pyload/forwarder.py deleted file mode 100644 index 3cb3a7748..000000000 --- a/pyload/forwarder.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- 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 -""" - -from sys import argv -from sys import exit - -import socket -import thread - -from traceback import print_exc - -class Forwarder: - - def __init__(self, extip, extport=9666): - print "Start portforwarding to %s:%s" % (extip, extport) - proxy(extip, extport, 9666) - - -def proxy(*settings): - while True: - server(*settings) - -def server(*settings): - try: - dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - dock_socket.bind(("127.0.0.1", settings[2])) - dock_socket.listen(5) - while True: - client_socket = dock_socket.accept()[0] - server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - server_socket.connect((settings[0], settings[1])) - thread.start_new_thread(forward, (client_socket, server_socket)) - thread.start_new_thread(forward, (server_socket, client_socket)) - except Exception: - print_exc() - -def forward(source, destination): - string = ' ' - while string: - string = source.recv(1024) - if string: - destination.sendall(string) - else: - #source.shutdown(socket.SHUT_RD) - destination.shutdown(socket.SHUT_WR) diff --git a/pyload/plugins/AccountManager.py b/pyload/manager/AccountManager.py index 67909072f..d1958f4b6 100644 --- a/pyload/plugins/AccountManager.py +++ b/pyload/manager/AccountManager.py @@ -5,7 +5,7 @@ from shutil import copy from threading import Lock -from pyload.PullEvents import AccountUpdateEvent +from pyload.manager.event.PullEvents import AccountUpdateEvent from pyload.utils import chmod, lock ACC_VERSION = 1 diff --git a/pyload/CaptchaManager.py b/pyload/manager/CaptchaManager.py index 0ba876ae8..0ba876ae8 100644 --- a/pyload/CaptchaManager.py +++ b/pyload/manager/CaptchaManager.py diff --git a/pyload/HookManager.py b/pyload/manager/HookManager.py index 7545b4d60..6f5477aeb 100644 --- a/pyload/HookManager.py +++ b/pyload/manager/HookManager.py @@ -25,8 +25,8 @@ from threading import RLock from types import MethodType -from pyload.threads.PluginThread import HookThread -from pyload.plugins.PluginManager import literal_eval +from pyload.manager.thread.PluginThread import HookThread +from pyload.manager.PluginManager import literal_eval from utils import lock class HookManager: diff --git a/pyload/plugins/PluginManager.py b/pyload/manager/PluginManager.py index be467b41a..56e59237c 100644 --- a/pyload/plugins/PluginManager.py +++ b/pyload/manager/PluginManager.py @@ -11,7 +11,7 @@ from traceback import print_exc from SafeEval import const_eval as literal_eval -from pyload.ConfigParser import IGNORE +from pyload.config.Parser import IGNORE class PluginManager: diff --git a/pyload/remote/RemoteManager.py b/pyload/manager/RemoteManager.py index e53e317e3..e53e317e3 100644 --- a/pyload/remote/RemoteManager.py +++ b/pyload/manager/RemoteManager.py diff --git a/pyload/ThreadManager.py b/pyload/manager/ThreadManager.py index d9a6e1b8c..1073f8040 100644 --- a/pyload/ThreadManager.py +++ b/pyload/manager/ThreadManager.py @@ -27,8 +27,8 @@ from random import choice import pycurl -from pyload.threads import PluginThread -from pyload.PyFile import PyFile +from pyload.manager.thread import PluginThread +from pyload.datatypes.PyFile import PyFile from pyload.network.RequestFactory import getURL from pyload.utils import freeSpace, lock diff --git a/pyload/threads/__init__.py b/pyload/manager/__init__.py index e69de29bb..e69de29bb 100644 --- a/pyload/threads/__init__.py +++ b/pyload/manager/__init__.py diff --git a/pyload/PullEvents.py b/pyload/manager/event/PullEvents.py index 0739b4ec8..0739b4ec8 100644 --- a/pyload/PullEvents.py +++ b/pyload/manager/event/PullEvents.py diff --git a/pyload/Scheduler.py b/pyload/manager/event/Scheduler.py index 71b5f96af..71b5f96af 100644 --- a/pyload/Scheduler.py +++ b/pyload/manager/event/Scheduler.py diff --git a/pyload/manager/event/__init__.py b/pyload/manager/event/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/pyload/manager/event/__init__.py diff --git a/pyload/threads/PluginThread.py b/pyload/manager/thread/PluginThread.py index ca1d396dc..5c274fa46 100644 --- a/pyload/threads/PluginThread.py +++ b/pyload/manager/thread/PluginThread.py @@ -30,11 +30,11 @@ from types import MethodType from pycurl import error -from pyload.PyFile import PyFile +from pyload.datatypes.PyFile import PyFile from pyload.plugins.Plugin import Abort, Fail, Reconnect, Retry, SkipDownload -from pyload.common.packagetools import parseNames +from pyload.utils.packagetools import parseNames from pyload.utils import safe_join -from pyload.Api import OnlineStatus +from pyload.api import OnlineStatus class PluginThread(Thread): """abstract base class for thread types""" diff --git a/pyload/threads/ServerThread.py b/pyload/manager/thread/ServerThread.py index 7de3b1ca1..7de3b1ca1 100644 --- a/pyload/threads/ServerThread.py +++ b/pyload/manager/thread/ServerThread.py diff --git a/pyload/manager/thread/__init__.py b/pyload/manager/thread/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/pyload/manager/thread/__init__.py diff --git a/pyload/plugins/accounts/BayfilesCom.py b/pyload/plugins/accounts/BayfilesCom.py index a42ac6457..38537da0e 100644 --- a/pyload/plugins/accounts/BayfilesCom.py +++ b/pyload/plugins/accounts/BayfilesCom.py @@ -3,7 +3,7 @@ from time import time from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class BayfilesCom(Account): diff --git a/pyload/plugins/accounts/FastixRu.py b/pyload/plugins/accounts/FastixRu.py index a7b939a2c..69840fa2c 100644 --- a/pyload/plugins/accounts/FastixRu.py +++ b/pyload/plugins/accounts/FastixRu.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class FastixRu(Account): diff --git a/pyload/plugins/accounts/FilecloudIo.py b/pyload/plugins/accounts/FilecloudIo.py index 5e6b001e8..dc764d218 100644 --- a/pyload/plugins/accounts/FilecloudIo.py +++ b/pyload/plugins/accounts/FilecloudIo.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class FilecloudIo(Account): diff --git a/pyload/plugins/accounts/FileserveCom.py b/pyload/plugins/accounts/FileserveCom.py index 211023991..99f4430c2 100644 --- a/pyload/plugins/accounts/FileserveCom.py +++ b/pyload/plugins/accounts/FileserveCom.py @@ -3,7 +3,7 @@ from time import mktime, strptime from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class FileserveCom(Account): diff --git a/pyload/plugins/accounts/FourSharedCom.py b/pyload/plugins/accounts/FourSharedCom.py index a62749c43..217bd2874 100644 --- a/pyload/plugins/accounts/FourSharedCom.py +++ b/pyload/plugins/accounts/FourSharedCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class FourSharedCom(Account): diff --git a/pyload/plugins/accounts/FreeWayMe.py b/pyload/plugins/accounts/FreeWayMe.py index baca53cd4..5106067a9 100644 --- a/pyload/plugins/accounts/FreeWayMe.py +++ b/pyload/plugins/accounts/FreeWayMe.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class FreeWayMe(Account): diff --git a/pyload/plugins/accounts/LetitbitNet.py b/pyload/plugins/accounts/LetitbitNet.py index 88e679f8e..bce97d378 100644 --- a/pyload/plugins/accounts/LetitbitNet.py +++ b/pyload/plugins/accounts/LetitbitNet.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -# from pyload.common.json_layer import json_loads, json_dumps +# from pyload.utils import json_loads, json_dumps class LetitbitNet(Account): diff --git a/pyload/plugins/accounts/LinksnappyCom.py b/pyload/plugins/accounts/LinksnappyCom.py index 4ac046988..35fc881b0 100644 --- a/pyload/plugins/accounts/LinksnappyCom.py +++ b/pyload/plugins/accounts/LinksnappyCom.py @@ -3,7 +3,7 @@ from hashlib import md5 from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class LinksnappyCom(Account): diff --git a/pyload/plugins/accounts/MegaDebridEu.py b/pyload/plugins/accounts/MegaDebridEu.py index b449d7246..5ba8d3577 100644 --- a/pyload/plugins/accounts/MegaDebridEu.py +++ b/pyload/plugins/accounts/MegaDebridEu.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class MegaDebridEu(Account): diff --git a/pyload/plugins/accounts/MultiDebridCom.py b/pyload/plugins/accounts/MultiDebridCom.py index fa10c92cc..cca6a9849 100644 --- a/pyload/plugins/accounts/MultiDebridCom.py +++ b/pyload/plugins/accounts/MultiDebridCom.py @@ -3,7 +3,7 @@ from time import time from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class MultiDebridCom(Account): diff --git a/pyload/plugins/accounts/OboomCom.py b/pyload/plugins/accounts/OboomCom.py index 3ef6f9d58..b281a289a 100644 --- a/pyload/plugins/accounts/OboomCom.py +++ b/pyload/plugins/accounts/OboomCom.py @@ -4,7 +4,7 @@ import time from beaker.crypto.pbkdf2 import PBKDF2 -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Account import Account diff --git a/pyload/plugins/accounts/OverLoadMe.py b/pyload/plugins/accounts/OverLoadMe.py index ba5a58158..18a3db645 100644 --- a/pyload/plugins/accounts/OverLoadMe.py +++ b/pyload/plugins/accounts/OverLoadMe.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class OverLoadMe(Account): diff --git a/pyload/plugins/accounts/PremiumizeMe.py b/pyload/plugins/accounts/PremiumizeMe.py index 822ca8db9..ecb03afda 100644 --- a/pyload/plugins/accounts/PremiumizeMe.py +++ b/pyload/plugins/accounts/PremiumizeMe.py @@ -2,7 +2,7 @@ from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class PremiumizeMe(Account): diff --git a/pyload/plugins/accounts/RPNetBiz.py b/pyload/plugins/accounts/RPNetBiz.py index 0e600b4e3..c2b7cad21 100644 --- a/pyload/plugins/accounts/RPNetBiz.py +++ b/pyload/plugins/accounts/RPNetBiz.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class RPNetBiz(Account): diff --git a/pyload/plugins/accounts/RapidgatorNet.py b/pyload/plugins/accounts/RapidgatorNet.py index 391d7ffcb..c8f129c5b 100644 --- a/pyload/plugins/accounts/RapidgatorNet.py +++ b/pyload/plugins/accounts/RapidgatorNet.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class RapidgatorNet(Account): diff --git a/pyload/plugins/accounts/SimplyPremiumCom.py b/pyload/plugins/accounts/SimplyPremiumCom.py index 5958c1f34..3a385c477 100644 --- a/pyload/plugins/accounts/SimplyPremiumCom.py +++ b/pyload/plugins/accounts/SimplyPremiumCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Account import Account diff --git a/pyload/plugins/accounts/UnrestrictLi.py b/pyload/plugins/accounts/UnrestrictLi.py index 39a75f959..6e878b556 100644 --- a/pyload/plugins/accounts/UnrestrictLi.py +++ b/pyload/plugins/accounts/UnrestrictLi.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Account import Account -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class UnrestrictLi(Account): diff --git a/pyload/plugins/crypter/DailymotionBatch.py b/pyload/plugins/crypter/DailymotionBatch.py index d44350c6b..2c818d8bc 100644 --- a/pyload/plugins/crypter/DailymotionBatch.py +++ b/pyload/plugins/crypter/DailymotionBatch.py @@ -4,7 +4,7 @@ import re from urlparse import urljoin -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Crypter import Crypter from pyload.utils import safe_join diff --git a/pyload/plugins/crypter/GooGl.py b/pyload/plugins/crypter/GooGl.py index ae48c61b5..93f3456cc 100644 --- a/pyload/plugins/crypter/GooGl.py +++ b/pyload/plugins/crypter/GooGl.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.plugins.Crypter import Crypter -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class GooGl(Crypter): diff --git a/pyload/plugins/crypter/LinkSaveIn.py b/pyload/plugins/crypter/LinkSaveIn.py index 84dd8172e..4a56606c8 100644 --- a/pyload/plugins/crypter/LinkSaveIn.py +++ b/pyload/plugins/crypter/LinkSaveIn.py @@ -9,7 +9,7 @@ import re from Crypto.Cipher import AES from pyload.plugins.Crypter import Crypter -from pyload.unescape import unescape +from pyload.utils import html_unescape class LinkSaveIn(Crypter): @@ -153,7 +153,7 @@ class LinkSaveIn(Crypter): dlLink = re.search(r'http://linksave\.in/dl-\w+', jseval).group(0) self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink) response = self.load(dlLink) - link = unescape(re.search(r'<iframe src="(.+?)"', response).group(1)) + link = html_unescape(re.search(r'<iframe src="(.+?)"', response).group(1)) package_links.append(link) except Exception, detail: self.logDebug("Error decrypting Web link %s, %s" % (webLink, detail)) @@ -169,7 +169,7 @@ class LinkSaveIn(Crypter): containersLinks = re.findall(pattern, self.html) self.logDebug("Found %d %s Container links" % (len(containersLinks), type_.upper())) for containerLink in containersLinks: - link = "http://linksave.in/%s" % unescape(containerLink) + link = "http://linksave.in/%s" % html_unescape(containerLink) package_links.append(link) return package_links diff --git a/pyload/plugins/crypter/MediafireComFolder.py b/pyload/plugins/crypter/MediafireComFolder.py index 4ea904e89..98c05f450 100644 --- a/pyload/plugins/crypter/MediafireComFolder.py +++ b/pyload/plugins/crypter/MediafireComFolder.py @@ -3,7 +3,7 @@ import re from pyload.plugins.Crypter import Crypter from pyload.plugins.hoster.MediafireCom import checkHTMLHeader -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class MediafireComFolder(Crypter): diff --git a/pyload/plugins/crypter/MultiuploadCom.py b/pyload/plugins/crypter/MultiuploadCom.py index 5aa77e5f5..b1650b647 100644 --- a/pyload/plugins/crypter/MultiuploadCom.py +++ b/pyload/plugins/crypter/MultiuploadCom.py @@ -4,7 +4,7 @@ import re from time import time from pyload.plugins.Crypter import Crypter -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class MultiuploadCom(Crypter): diff --git a/pyload/plugins/crypter/OneKhDe.py b/pyload/plugins/crypter/OneKhDe.py index 320eaf6c6..4f3ab2a20 100644 --- a/pyload/plugins/crypter/OneKhDe.py +++ b/pyload/plugins/crypter/OneKhDe.py @@ -2,7 +2,7 @@ import re -from pyload.unescape import unescape +from pyload.utils import html_unescape from pyload.plugins.Crypter import Crypter @@ -33,6 +33,6 @@ class OneKhDe(Crypter): self.html = self.req.load(url) link_ids = re.findall(r"<a id=\"DownloadLink_(\d*)\" href=\"http://1kh.de/", self.html) for id in link_ids: - new_link = unescape( + new_link = html_unescape( re.search("width=\"100%\" src=\"(.*)\"></iframe>", self.req.load("http://1kh.de/l/" + id)).group(1)) self.urls.append(new_link) diff --git a/pyload/plugins/crypter/SafelinkingNet.py b/pyload/plugins/crypter/SafelinkingNet.py index 543fb32fb..9c68ba915 100644 --- a/pyload/plugins/crypter/SafelinkingNet.py +++ b/pyload/plugins/crypter/SafelinkingNet.py @@ -6,7 +6,7 @@ from pycurl import FOLLOWLOCATION from BeautifulSoup import BeautifulSoup -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Crypter import Crypter from pyload.plugins.internal.CaptchaService import SolveMedia diff --git a/pyload/plugins/crypter/SerienjunkiesOrg.py b/pyload/plugins/crypter/SerienjunkiesOrg.py index a1745c6c9..713086cb9 100644 --- a/pyload/plugins/crypter/SerienjunkiesOrg.py +++ b/pyload/plugins/crypter/SerienjunkiesOrg.py @@ -8,7 +8,7 @@ from time import sleep from BeautifulSoup import BeautifulSoup from pyload.plugins.Crypter import Crypter -from pyload.unescape import unescape +from pyload.utils import html_unescape class SerienjunkiesOrg(Crypter): @@ -48,7 +48,7 @@ class SerienjunkiesOrg(Crypter): soup = BeautifulSoup(src) packageName = self.pyfile.package().name if self.getConfig("changeNameSJ") == "Show": - found = unescape(soup.find("h2").find("a").string.split(' –')[0]) + found = html_unescape(soup.find("h2").find("a").string.split(' –')[0]) if found: packageName = found @@ -71,7 +71,7 @@ class SerienjunkiesOrg(Crypter): post = soup.find("div", attrs={"class": "post-content"}) ps = post.findAll("p") - seasonName = unescape(soup.find("a", attrs={"rel": "bookmark"}).string).replace("–", "-") + seasonName = html_unescape(soup.find("a", attrs={"rel": "bookmark"}).string).replace("–", "-") groups = {} gid = -1 for p in ps: @@ -79,7 +79,7 @@ class SerienjunkiesOrg(Crypter): var = p.findAll("strong") opts = {"Sprache": "", "Format": ""} for v in var: - n = unescape(v.string).strip() + n = html_unescape(v.string).strip() n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n) if n.strip() not in opts: continue @@ -198,7 +198,7 @@ class SerienjunkiesOrg(Crypter): soup = BeautifulSoup(src) post = soup.find("div", attrs={"id": "page_post"}) ps = post.findAll("p") - found = unescape(soup.find("h2").find("a").string.split(' –')[0]) + found = html_unescape(soup.find("h2").find("a").string.split(' –')[0]) if found: seasonName = found @@ -209,7 +209,7 @@ class SerienjunkiesOrg(Crypter): var = p.findAll("strong") opts = {"Sprache": "", "Format": ""} for v in var: - n = unescape(v.string).strip() + n = html_unescape(v.string).strip() n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n) if n.strip() not in opts: continue diff --git a/pyload/plugins/crypter/TurbobitNetFolder.py b/pyload/plugins/crypter/TurbobitNetFolder.py index 48b28c28a..c7786b7be 100644 --- a/pyload/plugins/crypter/TurbobitNetFolder.py +++ b/pyload/plugins/crypter/TurbobitNetFolder.py @@ -3,7 +3,7 @@ import re from pyload.plugins.internal.SimpleCrypter import SimpleCrypter -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class TurbobitNetFolder(SimpleCrypter): diff --git a/pyload/plugins/crypter/YoutubeBatch.py b/pyload/plugins/crypter/YoutubeBatch.py index 5b7cb6530..bc72e04ea 100644 --- a/pyload/plugins/crypter/YoutubeBatch.py +++ b/pyload/plugins/crypter/YoutubeBatch.py @@ -4,7 +4,7 @@ import re from urlparse import urljoin -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Crypter import Crypter from pyload.utils import safe_join diff --git a/pyload/plugins/hooks/DeathByCaptcha.py b/pyload/plugins/hooks/DeathByCaptcha.py index 57bf9031f..6db91b8c1 100644 --- a/pyload/plugins/hooks/DeathByCaptcha.py +++ b/pyload/plugins/hooks/DeathByCaptcha.py @@ -9,7 +9,7 @@ from pycurl import FORM_FILE, HTTPHEADER from thread import start_new_thread from time import sleep -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getRequest from pyload.plugins.Hook import Hook diff --git a/pyload/plugins/hooks/FastixRu.py b/pyload/plugins/hooks/FastixRu.py index 966bc6bd3..9e2abd92a 100644 --- a/pyload/plugins/hooks/FastixRu.py +++ b/pyload/plugins/hooks/FastixRu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.internal.MultiHoster import MultiHoster diff --git a/pyload/plugins/hooks/IRCInterface.py b/pyload/plugins/hooks/IRCInterface.py index af8d8fa69..ef1fa2a09 100644 --- a/pyload/plugins/hooks/IRCInterface.py +++ b/pyload/plugins/hooks/IRCInterface.py @@ -10,7 +10,7 @@ from threading import Thread from time import sleep from traceback import print_exc -from pyload.Api import PackageDoesNotExists, FileDoesNotExists +from pyload.api import PackageDoesNotExists, FileDoesNotExists from pyload.network.RequestFactory import getURL from pyload.plugins.Hook import Hook from pyload.utils import formatSize diff --git a/pyload/plugins/hooks/LinksnappyCom.py b/pyload/plugins/hooks/LinksnappyCom.py index f662ae4e9..9086e3c2a 100644 --- a/pyload/plugins/hooks/LinksnappyCom.py +++ b/pyload/plugins/hooks/LinksnappyCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.internal.MultiHoster import MultiHoster diff --git a/pyload/plugins/hooks/MegaDebridEu.py b/pyload/plugins/hooks/MegaDebridEu.py index da151f9aa..8c8894c9b 100644 --- a/pyload/plugins/hooks/MegaDebridEu.py +++ b/pyload/plugins/hooks/MegaDebridEu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.internal.MultiHoster import MultiHoster diff --git a/pyload/plugins/hooks/MultiDebridCom.py b/pyload/plugins/hooks/MultiDebridCom.py index 7d9b6526a..6aa5ba3eb 100644 --- a/pyload/plugins/hooks/MultiDebridCom.py +++ b/pyload/plugins/hooks/MultiDebridCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.internal.MultiHoster import MultiHoster diff --git a/pyload/plugins/hooks/PremiumizeMe.py b/pyload/plugins/hooks/PremiumizeMe.py index 70bc4a0f2..b6d89adb6 100644 --- a/pyload/plugins/hooks/PremiumizeMe.py +++ b/pyload/plugins/hooks/PremiumizeMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.internal.MultiHoster import MultiHoster diff --git a/pyload/plugins/hooks/RPNetBiz.py b/pyload/plugins/hooks/RPNetBiz.py index e119e6451..b46e326e6 100644 --- a/pyload/plugins/hooks/RPNetBiz.py +++ b/pyload/plugins/hooks/RPNetBiz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.internal.MultiHoster import MultiHoster diff --git a/pyload/plugins/hooks/SimplyPremiumCom.py b/pyload/plugins/hooks/SimplyPremiumCom.py index 8e9bc5e1e..f0df36b22 100644 --- a/pyload/plugins/hooks/SimplyPremiumCom.py +++ b/pyload/plugins/hooks/SimplyPremiumCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.internal.MultiHoster import MultiHoster diff --git a/pyload/plugins/hooks/UnSkipOnFail.py b/pyload/plugins/hooks/UnSkipOnFail.py index fd3b35a0a..941ce4fc7 100644 --- a/pyload/plugins/hooks/UnSkipOnFail.py +++ b/pyload/plugins/hooks/UnSkipOnFail.py @@ -2,7 +2,7 @@ from os.path import basename -from pyload.PyFile import PyFile +from pyload.datatypes.PyFile import PyFile from pyload.plugins.Hook import Hook from pyload.utils import fs_encode diff --git a/pyload/plugins/hooks/UnrestrictLi.py b/pyload/plugins/hooks/UnrestrictLi.py index 1562bdf24..2ca5ad907 100644 --- a/pyload/plugins/hooks/UnrestrictLi.py +++ b/pyload/plugins/hooks/UnrestrictLi.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.internal.MultiHoster import MultiHoster diff --git a/pyload/plugins/hoster/AlldebridCom.py b/pyload/plugins/hoster/AlldebridCom.py index 1b115f19e..bdb5b1599 100644 --- a/pyload/plugins/hoster/AlldebridCom.py +++ b/pyload/plugins/hoster/AlldebridCom.py @@ -5,7 +5,7 @@ import re from random import randrange from urllib import unquote -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster from pyload.utils import parseFileSize diff --git a/pyload/plugins/hoster/BayfilesCom.py b/pyload/plugins/hoster/BayfilesCom.py index ea4bd3ca5..5906ade75 100644 --- a/pyload/plugins/hoster/BayfilesCom.py +++ b/pyload/plugins/hoster/BayfilesCom.py @@ -4,7 +4,7 @@ import re from time import time -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/pyload/plugins/hoster/DailymotionCom.py b/pyload/plugins/hoster/DailymotionCom.py index 0ae4c697b..5692fa652 100644 --- a/pyload/plugins/hoster/DailymotionCom.py +++ b/pyload/plugins/hoster/DailymotionCom.py @@ -2,8 +2,8 @@ import re -from pyload.PyFile import statusMap -from pyload.common.json_layer import json_loads +from pyload.datatypes.PyFile import statusMap +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/DlFreeFr.py b/pyload/plugins/hoster/DlFreeFr.py index 387e11efc..0365754bc 100644 --- a/pyload/plugins/hoster/DlFreeFr.py +++ b/pyload/plugins/hoster/DlFreeFr.py @@ -3,7 +3,7 @@ import pycurl import re -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.Browser import Browser from pyload.network.CookieJar import CookieJar from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns diff --git a/pyload/plugins/hoster/ExtabitCom.py b/pyload/plugins/hoster/ExtabitCom.py index 38479410e..78172ef02 100644 --- a/pyload/plugins/hoster/ExtabitCom.py +++ b/pyload/plugins/hoster/ExtabitCom.py @@ -2,7 +2,7 @@ import re -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight from pyload.plugins.internal.CaptchaService import ReCaptcha diff --git a/pyload/plugins/hoster/FastixRu.py b/pyload/plugins/hoster/FastixRu.py index e031e3e55..aa1794047 100644 --- a/pyload/plugins/hoster/FastixRu.py +++ b/pyload/plugins/hoster/FastixRu.py @@ -5,7 +5,7 @@ import re from random import randrange from urllib import unquote -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/FilecloudIo.py b/pyload/plugins/hoster/FilecloudIo.py index 05753a67e..9cf9306d1 100644 --- a/pyload/plugins/hoster/FilecloudIo.py +++ b/pyload/plugins/hoster/FilecloudIo.py @@ -2,7 +2,7 @@ import re -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.internal.CaptchaService import ReCaptcha from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/pyload/plugins/hoster/FilepostCom.py b/pyload/plugins/hoster/FilepostCom.py index ac2ae4845..382971c61 100644 --- a/pyload/plugins/hoster/FilepostCom.py +++ b/pyload/plugins/hoster/FilepostCom.py @@ -4,7 +4,7 @@ import re from time import time -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.internal.CaptchaService import ReCaptcha from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/pyload/plugins/hoster/FileserveCom.py b/pyload/plugins/hoster/FileserveCom.py index 15830b759..5892cd96a 100644 --- a/pyload/plugins/hoster/FileserveCom.py +++ b/pyload/plugins/hoster/FileserveCom.py @@ -2,7 +2,7 @@ import re -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.RequestFactory import getURL from pyload.plugins.Hoster import Hoster from pyload.plugins.Plugin import chunks diff --git a/pyload/plugins/hoster/IfileIt.py b/pyload/plugins/hoster/IfileIt.py index 2707edd5a..fc26e2f23 100644 --- a/pyload/plugins/hoster/IfileIt.py +++ b/pyload/plugins/hoster/IfileIt.py @@ -2,7 +2,7 @@ import re -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.internal.CaptchaService import ReCaptcha from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/pyload/plugins/hoster/LetitbitNet.py b/pyload/plugins/hoster/LetitbitNet.py index 3a8e28a90..a28f06571 100644 --- a/pyload/plugins/hoster/LetitbitNet.py +++ b/pyload/plugins/hoster/LetitbitNet.py @@ -10,7 +10,7 @@ import re from urllib import urlencode, urlopen -from pyload.common.json_layer import json_loads, json_dumps +from pyload.utils import json_loads, json_dumps from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight from pyload.plugins.internal.CaptchaService import ReCaptcha from pyload.plugins.internal.SimpleHoster import SimpleHoster diff --git a/pyload/plugins/hoster/LinksnappyCom.py b/pyload/plugins/hoster/LinksnappyCom.py index aed74d09b..e7cc61391 100644 --- a/pyload/plugins/hoster/LinksnappyCom.py +++ b/pyload/plugins/hoster/LinksnappyCom.py @@ -4,7 +4,7 @@ import re from urlparse import urlsplit -from pyload.common.json_layer import json_loads, json_dumps +from pyload.utils import json_loads, json_dumps from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/MegaDebridEu.py b/pyload/plugins/hoster/MegaDebridEu.py index 6c980009e..ed3747aed 100644 --- a/pyload/plugins/hoster/MegaDebridEu.py +++ b/pyload/plugins/hoster/MegaDebridEu.py @@ -4,7 +4,7 @@ import re from urllib import unquote_plus -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/MegaNz.py b/pyload/plugins/hoster/MegaNz.py index 801df9c9d..2e70b5dc6 100644 --- a/pyload/plugins/hoster/MegaNz.py +++ b/pyload/plugins/hoster/MegaNz.py @@ -9,7 +9,7 @@ from array import array from base64 import standard_b64decode from os import remove -from pyload.common.json_layer import json_loads, json_dumps +from pyload.utils import json_loads, json_dumps from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/MegacrypterCom.py b/pyload/plugins/hoster/MegacrypterCom.py index 0cc17bfe3..cdc019fdf 100644 --- a/pyload/plugins/hoster/MegacrypterCom.py +++ b/pyload/plugins/hoster/MegacrypterCom.py @@ -2,7 +2,7 @@ import re -from pyload.common.json_layer import json_loads, json_dumps +from pyload.utils import json_loads, json_dumps from pyload.plugins.hoster.MegaNz import MegaNz diff --git a/pyload/plugins/hoster/MultiDebridCom.py b/pyload/plugins/hoster/MultiDebridCom.py index 765022eef..bd7d9460c 100644 --- a/pyload/plugins/hoster/MultiDebridCom.py +++ b/pyload/plugins/hoster/MultiDebridCom.py @@ -2,7 +2,7 @@ import re -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/MyvideoDe.py b/pyload/plugins/hoster/MyvideoDe.py index 4ce75b4a2..06cfb9c63 100644 --- a/pyload/plugins/hoster/MyvideoDe.py +++ b/pyload/plugins/hoster/MyvideoDe.py @@ -3,7 +3,7 @@ import re from pyload.plugins.Hoster import Hoster -from pyload.unescape import unescape +from pyload.utils import html_unescape class MyvideoDe(Hoster): @@ -35,7 +35,7 @@ class MyvideoDe(Hoster): def get_file_name(self): file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>" - return unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') + return html_unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') def file_exists(self): self.download_html() diff --git a/pyload/plugins/hoster/OboomCom.py b/pyload/plugins/hoster/OboomCom.py index 04efa31b7..8c0d9d760 100644 --- a/pyload/plugins/hoster/OboomCom.py +++ b/pyload/plugins/hoster/OboomCom.py @@ -5,7 +5,7 @@ import re -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster from pyload.plugins.internal.CaptchaService import ReCaptcha diff --git a/pyload/plugins/hoster/OverLoadMe.py b/pyload/plugins/hoster/OverLoadMe.py index 8061b2e1d..e27972fc2 100644 --- a/pyload/plugins/hoster/OverLoadMe.py +++ b/pyload/plugins/hoster/OverLoadMe.py @@ -5,7 +5,7 @@ import re from random import randrange from urllib import unquote -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster from pyload.utils import parseFileSize diff --git a/pyload/plugins/hoster/PremiumizeMe.py b/pyload/plugins/hoster/PremiumizeMe.py index 16649f492..45c011084 100644 --- a/pyload/plugins/hoster/PremiumizeMe.py +++ b/pyload/plugins/hoster/PremiumizeMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/RPNetBiz.py b/pyload/plugins/hoster/RPNetBiz.py index e305c35ce..8a7bec097 100644 --- a/pyload/plugins/hoster/RPNetBiz.py +++ b/pyload/plugins/hoster/RPNetBiz.py @@ -3,7 +3,7 @@ import re from pyload.plugins.Hoster import Hoster -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads class RPNetBiz(Hoster): diff --git a/pyload/plugins/hoster/RapidgatorNet.py b/pyload/plugins/hoster/RapidgatorNet.py index 46fe285b7..cc13f7097 100644 --- a/pyload/plugins/hoster/RapidgatorNet.py +++ b/pyload/plugins/hoster/RapidgatorNet.py @@ -4,7 +4,7 @@ import re from pycurl import HTTPHEADER -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.network.HTTPRequest import BadHeader from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight from pyload.plugins.internal.CaptchaService import AdsCaptcha, ReCaptcha, SolveMedia diff --git a/pyload/plugins/hoster/RealdebridCom.py b/pyload/plugins/hoster/RealdebridCom.py index a458cc5d0..08f7b9329 100644 --- a/pyload/plugins/hoster/RealdebridCom.py +++ b/pyload/plugins/hoster/RealdebridCom.py @@ -6,7 +6,7 @@ from random import randrange from urllib import quote, unquote from time import time -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster from pyload.utils import parseFileSize diff --git a/pyload/plugins/hoster/RedtubeCom.py b/pyload/plugins/hoster/RedtubeCom.py index 42c24628e..9f5d2d0d9 100644 --- a/pyload/plugins/hoster/RedtubeCom.py +++ b/pyload/plugins/hoster/RedtubeCom.py @@ -3,7 +3,7 @@ import re from pyload.plugins.Hoster import Hoster -from pyload.unescape import unescape +from pyload.utils import html_unescape class RedtubeCom(Hoster): @@ -36,7 +36,7 @@ class RedtubeCom(Hoster): if not self.html: self.download_html() - file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) + file_url = html_unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) return file_url diff --git a/pyload/plugins/hoster/UlozTo.py b/pyload/plugins/hoster/UlozTo.py index 2f1fdc595..c3957aaa0 100644 --- a/pyload/plugins/hoster/UlozTo.py +++ b/pyload/plugins/hoster/UlozTo.py @@ -3,7 +3,7 @@ import re import time -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/pyload/plugins/hoster/UnrestrictLi.py b/pyload/plugins/hoster/UnrestrictLi.py index 2cad6616f..c0c1e3965 100644 --- a/pyload/plugins/hoster/UnrestrictLi.py +++ b/pyload/plugins/hoster/UnrestrictLi.py @@ -4,7 +4,7 @@ import re from datetime import datetime, timedelta -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/UploadingCom.py b/pyload/plugins/hoster/UploadingCom.py index a7c328eec..882cb863f 100644 --- a/pyload/plugins/hoster/UploadingCom.py +++ b/pyload/plugins/hoster/UploadingCom.py @@ -4,7 +4,7 @@ import re from pycurl import HTTPHEADER -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp diff --git a/pyload/plugins/hoster/XHamsterCom.py b/pyload/plugins/hoster/XHamsterCom.py index 0afb94b74..aa406cc45 100644 --- a/pyload/plugins/hoster/XHamsterCom.py +++ b/pyload/plugins/hoster/XHamsterCom.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.Hoster import Hoster diff --git a/pyload/plugins/hoster/YibaishiwuCom.py b/pyload/plugins/hoster/YibaishiwuCom.py index b6d06d234..24cd0e9fc 100644 --- a/pyload/plugins/hoster/YibaishiwuCom.py +++ b/pyload/plugins/hoster/YibaishiwuCom.py @@ -2,7 +2,7 @@ import re -from pyload.common.json_layer import json_loads +from pyload.utils import json_loads from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/pyload/remote/ClickAndLoadBackend.py b/pyload/remote/ClickAndLoadBackend.py index 82167f6e3..365364a3b 100644 --- a/pyload/remote/ClickAndLoadBackend.py +++ b/pyload/remote/ClickAndLoadBackend.py @@ -27,7 +27,7 @@ try: except: pass -from RemoteManager import BackendBase +from pyload.manager.RemoteManager import BackendBase core = None js = None diff --git a/pyload/remote/SocketBackend.py b/pyload/remote/SocketBackend.py index 1a157cf1d..c85e59f42 100644 --- a/pyload/remote/SocketBackend.py +++ b/pyload/remote/SocketBackend.py @@ -2,7 +2,7 @@ import SocketServer -from RemoteManager import BackendBase +from pyload.manager.RemoteManager import BackendBase class RequestHandler(SocketServer.BaseRequestHandler): diff --git a/pyload/remote/ThriftBackend.py b/pyload/remote/ThriftBackend.py index 2c65578be..609a3c158 100644 --- a/pyload/remote/ThriftBackend.py +++ b/pyload/remote/ThriftBackend.py @@ -17,7 +17,7 @@ """ from os.path import exists -from pyload.remote.RemoteManager import BackendBase +from pyload.manager.RemoteManager import BackendBase from thriftbackend.Processor import Processor from thriftbackend.Protocol import ProtocolFactory diff --git a/pyload/unescape.py b/pyload/unescape.py deleted file mode 100644 index 7bcc1aa72..000000000 --- a/pyload/unescape.py +++ /dev/null @@ -1,3 +0,0 @@ -from pyload.utils import html_unescape -#deprecated -unescape = html_unescape diff --git a/pyload/common/JsEngine.py b/pyload/utils/JsEngine.py index 46789f64d..46789f64d 100644 --- a/pyload/common/JsEngine.py +++ b/pyload/utils/JsEngine.py diff --git a/pyload/utils.py b/pyload/utils/__init__.py index b9eb8c88e..b9eb8c88e 100644 --- a/pyload/utils.py +++ b/pyload/utils/__init__.py diff --git a/pyload/common/packagetools.py b/pyload/utils/packagetools.py index d5ab4d182..d5ab4d182 100644 --- a/pyload/common/packagetools.py +++ b/pyload/utils/packagetools.py diff --git a/pyload/common/pylgettext.py b/pyload/utils/pylgettext.py index cab631cf4..cab631cf4 100644 --- a/pyload/common/pylgettext.py +++ b/pyload/utils/pylgettext.py diff --git a/pyload/webui/__init__.py b/pyload/webui/__init__.py index c421b632e..6173c57df 100644 --- a/pyload/webui/__init__.py +++ b/pyload/webui/__init__.py @@ -17,7 +17,7 @@ """ import sys -import pyload.common.pylgettext as gettext +import pyload.utils.pylgettext as gettext import os from os.path import join, abspath, dirname, exists @@ -40,7 +40,7 @@ from middlewares import StripPathMiddleware, GZipMiddleWare, PrefixMiddleware SETUP = None PYLOAD = None -from pyload.threads import ServerThread +from pyload.manager.thread import ServerThread if not ServerThread.core: if ServerThread.setup: @@ -52,7 +52,7 @@ else: PYLOAD = ServerThread.core.api config = ServerThread.core.config -from pyload.common.JsEngine import JsEngine +from pyload.utils.JsEngine import JsEngine JS = JsEngine() diff --git a/pyload/webui/app/api.py b/pyload/webui/app/api.py index 7050b78dc..286061c2a 100644 --- a/pyload/webui/app/api.py +++ b/pyload/webui/app/api.py @@ -9,9 +9,9 @@ from bottle import route, request, response, HTTPError from utils import toDict, set_session from pyload.webui import PYLOAD -from pyload.common.json_layer import json +from pyload.utils import json from SafeEval import const_eval as literal_eval -from pyload.Api import BaseObject +from pyload.api import BaseObject # json encoder that accepts TBase objects class TBaseEncoder(json.JSONEncoder): diff --git a/pyload/webui/app/utils.py b/pyload/webui/app/utils.py index 895696c19..d5fa66a35 100644 --- a/pyload/webui/app/utils.py +++ b/pyload/webui/app/utils.py @@ -22,7 +22,7 @@ from bottle import request, HTTPError, redirect, ServerAdapter from pyload.webui import env, THEME -from pyload.Api import has_permission, PERMS, ROLE +from pyload.api import has_permission, PERMS, ROLE def render_to_response(file, args={}, proc=[]): for p in proc: |