From 967d6dd16c25ceba22dcd105079f72534ddb87e9 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 26 Sep 2013 16:40:38 +0200 Subject: rewritten decrypter and info fetching thread --- pyload/plugins/Base.py | 30 +++++++------- pyload/plugins/Crypter.py | 77 ++++++++++++++++++----------------- pyload/plugins/Hoster.py | 6 +-- pyload/plugins/network/CurlRequest.py | 1 + 4 files changed, 56 insertions(+), 58 deletions(-) (limited to 'pyload/plugins') diff --git a/pyload/plugins/Base.py b/pyload/plugins/Base.py index 3ca8abdd0..abb59a7bc 100644 --- a/pyload/plugins/Base.py +++ b/pyload/plugins/Base.py @@ -1,21 +1,19 @@ # -*- 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 . - - @author: RaNaN -""" +############################################################################### +# Copyright(c) 2008-2013 pyLoad Team +# http://www.pyload.org +# +# This file is part of pyLoad. +# pyLoad is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Subjected to the terms and conditions in LICENSE +# +# @author: RaNaN +############################################################################### import sys from time import time, sleep diff --git a/pyload/plugins/Crypter.py b/pyload/plugins/Crypter.py index cce43fb56..2175b5f94 100644 --- a/pyload/plugins/Crypter.py +++ b/pyload/plugins/Crypter.py @@ -1,50 +1,60 @@ # -*- coding: utf-8 -*- -from traceback import print_exc - -from pyload.Api import LinkStatus +from pyload.Api import LinkStatus, DownloadStatus as DS from pyload.utils import to_list, has_method, uniqify from pyload.utils.fs import exists, remove, fs_encode from pyload.utils.packagetools import parseNames -from Base import Base, Retry +from Base import Base, Fail, Retry, Abort class Package: """ Container that indicates that a new package should be created """ - def __init__(self, name=None, urls=None): + def __init__(self, name=None, links=None): self.name = name - self.urls = urls if urls else [] + self.links = [] + + if links: + self.addLinks(links) # nested packages self.packs = [] - def addURL(self, url): - self.urls.append(url) + def addLinks(self, links): + """ Add one or multiple links to the package + + :param links: One or list of urls or :class:`LinkStatus` + """ + links = to_list(links) + for link in links: + if not isinstance(link, LinkStatus): + link = LinkStatus(link, link, -1, DS.Queued) - def addLink(self, url, name, status, size): - # TODO: allow to add urls with known information - pass + self.links.append(link) def addPackage(self, pack): self.packs.append(pack) + def getURLs(self): + return [link.url for link in self.links] + def getAllURLs(self): - urls = self.urls + urls = self.getURLs() for p in self.packs: urls.extend(p.getAllURLs()) return urls # same name and urls is enough to be equal for packages def __eq__(self, other): - return self.name == other.name and self.urls == other.urls + return self.name == other.name and self.links == other.links def __repr__(self): - return u"