diff options
Diffstat (limited to 'module/Api.py')
-rw-r--r-- | module/Api.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/module/Api.py b/module/Api.py index 551085b51..f0bf5e264 100644 --- a/module/Api.py +++ b/module/Api.py @@ -22,13 +22,11 @@ from os.path import join from time import time import re -from urlparse import urlparse - from PyFile import PyFile +from utils import freeSpace, compare_time from common.packagetools import parseNames from network.RequestFactory import getURL from remote import activated -from utils import compare_time, freeSpace, html_unescape, save_path if activated: try: @@ -51,7 +49,7 @@ def permission(bits): def __new__(cls, func, *args, **kwargs): permMap[func.__name__] = bits return func - + return _Dec @@ -162,7 +160,7 @@ class Api(Iface): @permission(PERMS.SETTINGS) def getConfig(self): """Retrieves complete config of core. - + :return: list of `ConfigSection` """ return self._convertConfigFormat(self.core.config.config) @@ -221,7 +219,7 @@ class Api(Iface): @permission(PERMS.LIST) def statusServer(self): """Some general information about the current status of pyLoad. - + :return: `ServerStatus` """ serverStatus = ServerStatus(self.core.threadManager.pause, len(self.core.threadManager.processingIds()), @@ -319,11 +317,11 @@ class Api(Iface): :return: package id of the new package """ if self.core.config['general']['folder_per_package']: - folder = urlparse(html_unescape(name)).path.split("/")[-1] + folder = name else: folder = "" - folder = save_path(folder) + folder = folder.replace("http://", "").replace(":", "").replace("/", "_").replace("\\", "_") pid = self.core.files.addPackage(name, folder, dest) @@ -486,7 +484,7 @@ class Api(Iface): :return: `PackageData` with .fid attribute """ data = self.core.files.getPackageData(int(pid)) - + if not data: raise PackageDoesNotExists(pid) @@ -513,7 +511,7 @@ class Api(Iface): @permission(PERMS.DELETE) def deleteFiles(self, fids): """Deletes several file entries from pyload. - + :param fids: list of file ids """ for id in fids: @@ -586,7 +584,7 @@ class Api(Iface): @permission(PERMS.ADD) def addFiles(self, pid, links): """Adds files to specific package. - + :param pid: package id :param links: list of urls """ @@ -708,7 +706,7 @@ class Api(Iface): """Gives a package a new position. :param pid: package id - :param position: + :param position: """ self.core.files.reorderPackage(pid, position) @@ -920,7 +918,7 @@ class Api(Iface): :param username: :param password: - :param remoteip: + :param remoteip: :return: dict with info, empty when login is incorrect """ if self.core.config["remote"]["nolocalauth"] and remoteip == "127.0.0.1": |