Ejemplo n.º 1
0
def do_download(category, release, link):
    link_extract_id_re = re.compile(config.get('download', 'link_extract_id_regexp'), re.IGNORECASE)

    format_args = {
            "release": release,
            "category": category,
            "link": link,
        }

    result = link_extract_id_re.match(link)

    if not result:
        return

    log.debug('Extracted link id: %s' % result.group(1))

    format_args['link_id'] = result.group(1)

    download_link = config.get('download', 'download_link_format') % format_args
    download_file = os.path.join(config.get('download', 'watch_directory'), '%(release)s.torrent' % format_args)
    
    log.debug('Download Link: %s' % download_link)
    log.debug('Download File: %s' % download_file)

    log.debug('Starting Download')

    d = downloadPage(download_link, download_file)

    def on_finished_download(*args, **kwargs):
        log.debug('finished downloading for real')

    d.addCallback(on_finished_download)

    log.debug('Finished Download')
Ejemplo n.º 2
0
    def _connect(self):
        self.site_client.do_login()

        f = irc_client.IRCClientFactory({
            config.get('irc', 'announce_channel'): self._irc_announce_observer,
            '': self._irc_control_observer,
        })

        irc_hostname = config.get('irc', 'hostname')
        irc_port = config.get('irc', 'port')

        log.info('Connecting to %s on port %d' % (irc_hostname, irc_port))

        reactor.connectTCP(irc_hostname, irc_port, f)
Ejemplo n.º 3
0
def announce_match_check(category, release, link):
    log.debug('Checking category %s for %s' % (category, release))

    if config.has_key('match', category):
        regexps = config.get('match', category)

        log.debug('Category in config, checking regexps')

        for regexp in regexps:
            if re.match(regexp, release):
                log.debug('%s matches %s' % (regexp, release))
                return True

    return False
Ejemplo n.º 4
0
 def __init__(self, channel_observers):
     self.channel_observers = channel_observers
     self.nickname = config.get('irc', 'nickname')
Ejemplo n.º 5
0
    def _load_settings(self):
        log.info('Loading configuration')
        config.load()

        self.site_client = site_client.SiteClient()
        self.announce_message_re = re.compile(config.get('irc', 'announce_message_regexp'), re.IGNORECASE)