summaryrefslogtreecommitdiffstats
path: root/module/Api.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-27 23:04:37 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-27 23:04:37 +0100
commitd0d8a733bf618e6c31d8af727a35aa7ec14cb544 (patch)
tree2008aeb2ec5e7da5f84e779f0fd01352cad4d1b4 /module/Api.py
parent[Plugin] Initial support for plugin deactivation (diff)
downloadpyload-d0d8a733bf618e6c31d8af727a35aa7ec14cb544.tar.xz
[Api] Fix addPackage folder generator
Diffstat (limited to 'module/Api.py')
-rw-r--r--module/Api.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/module/Api.py b/module/Api.py
index f0bf5e264..c038ccaad 100644
--- a/module/Api.py
+++ b/module/Api.py
@@ -27,6 +27,7 @@ from utils import freeSpace, compare_time
from common.packagetools import parseNames
from network.RequestFactory import getURL
from remote import activated
+from utils import save_path
if activated:
try:
@@ -49,7 +50,7 @@ def permission(bits):
def __new__(cls, func, *args, **kwargs):
permMap[func.__name__] = bits
return func
-
+
return _Dec
@@ -160,7 +161,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)
@@ -219,7 +220,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()),
@@ -317,12 +318,10 @@ class Api(Iface):
:return: package id of the new package
"""
if self.core.config['general']['folder_per_package']:
- folder = name
+ folder = save_path(name.replace("http://", "").replace(":", "").replace("/", "_").replace("\\", "_"))
else:
folder = ""
- folder = folder.replace("http://", "").replace(":", "").replace("/", "_").replace("\\", "_")
-
pid = self.core.files.addPackage(name, folder, dest)
self.core.files.addLinks(links, pid)
@@ -484,7 +483,7 @@ class Api(Iface):
:return: `PackageData` with .fid attribute
"""
data = self.core.files.getPackageData(int(pid))
-
+
if not data:
raise PackageDoesNotExists(pid)
@@ -511,7 +510,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:
@@ -584,7 +583,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
"""
@@ -706,7 +705,7 @@ class Api(Iface):
"""Gives a package a new position.
:param pid: package id
- :param position:
+ :param position:
"""
self.core.files.reorderPackage(pid, position)
@@ -918,7 +917,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":