Exemple #1
0
 def fetchTorrent(self, name, sizelim, **kwargs):
     site = remotes.getSiteMod(name)
     if site:
         s = site.Main(self.publog, self.ajax, self.storage)
         filename, torrent = s.fetch(kwargs["torrentid"])
         if sizelim[0] and sizelim[0] == 0:
             sizelim[0] = None
         if sizelim[1] and sizelim[1] == 0:
             sizelim[1] = None
         s.process(filename, torrent, sizelim[0], sizelim[1])
         return "OK", None
     else:
         return "ERROR", "No such handler"
Exemple #2
0
 def fetchTorrent(self, name, sizelim, **kwargs):
     site = remotes.getSiteMod(name)
     if site:
         s = site.Main(self.publog, self.ajax, self.storage)
         filename, torrent = s.fetch(kwargs["torrentdata"])
         if sizelim[0] and sizelim[0] == 0:
             sizelim[0] = None
         if sizelim[1] and sizelim[1] == 0:
             sizelim[1] = None
         s.process(filename, torrent, sizelim[0], sizelim[1])
         return "OK", None
     else:
         return "ERROR", "No such handler"
Exemple #3
0
    def __init__(self, name, log, storage, websocketURI, auth):
        self.STORAGE = storage
        self.NAME = name
        #search for storage settings
        store = storage.getRemoteByName(name)
        siteMod = remotes.getSiteMod(name)
        if not store or not siteMod:
            raise SettingsError("Nothing is stored for name '%s'" % name)

        #network, channel, and port should be stored in 'siteMod'
        #nick should be stored in 'store'

        try:
            self.network = siteMod.IRC_NETWORK
            self.port = siteMod.IRC_PORT
            self.channel = siteMod.IRC_CHANNEL
            matcher = siteMod.IRC_MATCH
        except AttributeError:
            raise SettingsError("IRC methods are not defined for name '%s'" % name)

        if "nick" not in store:
            self.nick = "pyrtBot"
        else:
            self.nick = store.nick

        if hasattr(siteMod, "IRC_COMMANDS"):
            startup = siteMod.IRC_COMMANDS
        else:
            startup = []

        if hasattr(siteMod, "IRC_DELAY"):
            delay = siteMod.IRC_DELAY
        else:
            delay = 0
        self.name = "pyrt"
        self.log = log
        self.options = store
        self.options.startup = startup
        self.options.startup_delay = delay
        self.options.websocketURI = websocketURI
        self.options.auth = auth
        self.options.matcher = matcher
Exemple #4
0
    def __init__(self, name, log, storage, websocketURI, auth):
        self.STORAGE = storage
        self.NAME = name
        # search for storage settings
        store = storage.getRemoteByName(name)
        siteMod = remotes.getSiteMod(name)
        if not store or not siteMod:
            raise SettingsError("Nothing is stored for name '%s'" % name)

        # network, channel, and port should be stored in 'siteMod'
        # nick should be stored in 'store'

        try:
            self.network = siteMod.IRC_NETWORK
            self.port = siteMod.IRC_PORT
            self.channel = siteMod.IRC_CHANNEL
            matcher = siteMod.IRC_MATCH
        except AttributeError:
            raise SettingsError("IRC methods are not defined for name '%s'" % name)

        if "nick" not in store:
            self.nick = "pyrtBot"
        else:
            self.nick = store.nick

        if hasattr(siteMod, "IRC_COMMANDS"):
            startup = siteMod.IRC_COMMANDS
        else:
            startup = []

        if hasattr(siteMod, "IRC_DELAY"):
            delay = siteMod.IRC_DELAY
        else:
            delay = 0
        self.name = "pyrt"
        self.log = log
        self.options = store
        self.options.startup = startup
        self.options.startup_delay = delay
        self.options.websocketURI = websocketURI
        self.options.auth = auth
        self.options.matcher = matcher