diff options
114 files changed, 141 insertions, 341 deletions
diff --git a/docs/access_api.rst b/docs/access_api.rst index d83698aa3..58fe56ca4 100644 --- a/docs/access_api.rst +++ b/docs/access_api.rst @@ -13,12 +13,12 @@ First of all, you need to know what you can do with our API. It lets you do all retrieving download status, manage queue, manage accounts, modify config and so on. This document is not intended to explain every function in detail, for a complete listing -see :class:`Api <pyload.Api.Api>`. +see :class:`Api <pyload.api.Api>`. Of course its possible to access the ``core.api`` attribute in plugins and hooks, but much more interesting is the possibillity to call function from different programs written in many different languages. -pyLoad uses thrift as backend and provides its :class:`Api <pyload.Api.Api>` as service. +pyLoad uses thrift as backend and provides its :class:`Api <pyload.api.Api>` as service. More information about thrift can be found here http://wiki.apache.org/thrift/. @@ -92,7 +92,7 @@ so pyLoad can authenticate you. Calling Methods =============== -In general you can use any method listed at the :class:`Api <pyload.Api.Api>` documentation, which is also available to +In general you can use any method listed at the :class:`Api <pyload.api.Api>` documentation, which is also available to the thriftbackend. Access works simply via ``http://pyload-core/api/methodName``, where ``pyload-core`` is the ip address @@ -107,7 +107,7 @@ Passing parameters To pass arguments you have two choices. Either use positional arguments, eg ``http://pyload-core/api/getFileData/1``, where 1 is the FileID, or use keyword arguments -supplied via GET or POST ``http://pyload-core/api/getFileData?fid=1``. You can find the argument names in the :class:`Api <pyload.Api.Api>` +supplied via GET or POST ``http://pyload-core/api/getFileData?fid=1``. You can find the argument names in the :class:`Api <pyload.api.Api>` documentation. It is important that *all* arguments are in JSON format. So ``http://pyload-core/api/getFileData/1`` is valid because diff --git a/docs/module_overview.rst b/docs/module_overview.rst index 8cea3874b..d76386ed7 100644 --- a/docs/module_overview.rst +++ b/docs/module_overview.rst @@ -6,7 +6,7 @@ You can find an overview of some important classes here: .. autosummary:: :toctree: pyload - pyload.Api.Api + pyload.api.Api pyload.plugins.Plugin.Base pyload.plugins.Plugin.Plugin pyload.plugins.Crypter.Crypter diff --git a/docs/write_hooks.rst b/docs/write_hooks.rst index 5508f5a0c..ebf2ed368 100644 --- a/docs/write_hooks.rst +++ b/docs/write_hooks.rst @@ -6,7 +6,7 @@ Hooks A Hook is a python file which is located at :file:`pyload/plugins/hooks`. The :class:`HookManager <pyload.HookManager.HookManager>` will load it automatically on startup. Only one instance exists over the complete lifetime of pyload. Your hook can interact on various events called by the :class:`HookManager <pyload.HookManager.HookManager>`, -do something complete autonomic and has full access to the :class:`Api <pyload.Api.Api>` and every detail of pyLoad. +do something complete autonomic and has full access to the :class:`Api <pyload.api.Api>` and every detail of pyLoad. The UpdateManager, CaptchaTrader, UnRar and many more are realised as hooks. Hook header @@ -102,7 +102,7 @@ available as event and not accessible through overwriting hook methods. However Providing RPC services ---------------------- -You may noticed that pyLoad has an :class:`Api <pyload.Api.Api>`, which can be used internal or called by clients via RPC. +You may noticed that pyLoad has an :class:`Api <pyload.api.Api>`, which can be used internal or called by clients via RPC. So probably clients want to be able to interact with your hook to request it's state or invoke some action. Sounds complicated but is very easy to do. Just use the ``Expose`` decorator: :: @@ -118,7 +118,7 @@ Sounds complicated but is very easy to do. Just use the ``Expose`` decorator: :: def invoke(self, arg): print "Invoked with", arg -Thats all, it's available via the :class:`Api <pyload.Api.Api>` now. If you want to use it read :ref:`access_api`. +Thats all, it's available via the :class:`Api <pyload.api.Api>` now. If you want to use it read :ref:`access_api`. Here is a basic example: :: #Assuming client is a ThriftClient or Api object @@ -128,7 +128,7 @@ Here is a basic example: :: Providing status information ---------------------------- -Your hook can store information in a ``dict`` that can easily be retrievied via the :class:`Api <pyload.Api.Api>`. +Your hook can store information in a ``dict`` that can easily be retrievied via the :class:`Api <pyload.api.Api>`. Just store everything in ``self.info``. :: diff --git a/pyload/common/pavement.py b/pavement.py index 9b2dc98b3..9b2dc98b3 100644 --- a/pyload/common/pavement.py +++ b/pavement.py 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/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/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: diff --git a/pyload/common/APIExerciser.py b/tests/APIExerciser.py index 886c72a4a..886c72a4a 100644 --- a/pyload/common/APIExerciser.py +++ b/tests/APIExerciser.py diff --git a/scripts/clonedigger.sh b/tests/clonedigger.sh index 358c1b68b..358c1b68b 100644 --- a/scripts/clonedigger.sh +++ b/tests/clonedigger.sh diff --git a/scripts/code_analysis.sh b/tests/code_analysis.sh index c853652bf..c853652bf 100644 --- a/scripts/code_analysis.sh +++ b/tests/code_analysis.sh diff --git a/pyload/common/test_api.py b/tests/test_api.py index 4efaa35d6..a4229cfe6 100644 --- a/pyload/common/test_api.py +++ b/tests/test_api.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -from pyload.common import APIExerciser +import APIExerciser + from nose.tools import nottest diff --git a/pyload/common/test_json.py b/tests/test_json.py index 320a42d4f..320a42d4f 100644 --- a/pyload/common/test_json.py +++ b/tests/test_json.py |