Created
September 3, 2010 14:30
-
-
Save zahardzhan/563946 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
address_dispatch_table = {} | |
class MetaDownloadAgent(type): | |
def __new__(cls, name, bases, attributes): | |
return super(MetaDownloadAgent, cls).__new__(cls, name, bases, attributes) | |
def __init__(self, name, bases, attributes): | |
super(MetaDownloadAgent, self).__init__(name, bases, attributes) | |
if 'address_pattern' in attributes: | |
address_dispatch_table[attributes['address_pattern']] = self | |
class DownloadAgent(object): | |
__metaclass__ = MetaDownloadAgent | |
def __init__(self): | |
self.precedence = 0 | |
self.desires = set() | |
self.intentions = list() | |
self.pending_actions = list() | |
self.running_actions = set() | |
self.alive = True | |
self.run = False | |
self.stop = False | |
self.fail = None | |
self.environment = None | |
self.program = None | |
self.path = None | |
self.name = None | |
self.goal = None | |
class DataCodRuDownloadAgent(DownloadAgent): | |
address_pattern = r"http://[\w\.\-]*.data.cod.ru/\d+" | |
tag = 'data.cod.ru' | |
def __init__(self): | |
self.address = None | |
self.link = None | |
self.child = None | |
def program(self): | |
pass | |
class Files3DsvDataCodRuDownloadAgent(DownloadAgent): | |
address_pattern = r"http://files3?.dsv.*.data.cod.ru/.+" | |
tag = 'files3?.dsv.*.data.cod.ru' | |
max_active_agents = 1 | |
def __init__(self): | |
self.address = None | |
self.name = None | |
self.filename = None | |
self.path = None | |
self.total_file_length = None | |
self.actual_file_length = None | |
def program(self): | |
pass | |
class Files2DsvDataCodRuDownloadAgent(DownloadAgent): | |
address_pattern = r"http://files2.dsv.*.data.cod.ru/.+" | |
tag = 'files2.dsv.*.data.cod.ru' | |
max_active_agents = 1 | |
def __init__(self): | |
self.address = None | |
self.name = None | |
self.filename = None | |
self.path = None | |
self.total_file_length = None | |
self.actual_file_length = None | |
def program(self): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment