def __init__(self): self.client = TorClient.TorrentClient() if not self.client.connect(mylar.RTORRENT_HOST, mylar.RTORRENT_USERNAME, mylar.RTORRENT_PASSWORD): logger.error('could not connect to %s, exiting', mylar.RTORRENT_HOST) sys.exit(-1)
def __init__(self): self.client = TorClient.TorrentClient() if not self.client.connect(mylar.CONFIG.RTORRENT_HOST, mylar.CONFIG.RTORRENT_USERNAME, mylar.CONFIG.RTORRENT_PASSWORD, mylar.CONFIG.RTORRENT_AUTHENTICATION, mylar.CONFIG.RTORRENT_VERIFY, mylar.CONFIG.RTORRENT_RPC_URL, mylar.CONFIG.RTORRENT_CA_BUNDLE): logger.error('[ERROR] Could not connect to %s - exiting' % mylar.CONFIG.RTORRENT_HOST) sys.exit(-1)
def __init__(self, hash=None, file=None, add=False, label=None, partial=False, conf=None): if hash is None: self.torrent_hash = None else: self.torrent_hash = hash if file is None: self.filepath = None else: self.filepath = file self.basedir = None if label is None: self.label = None else: self.label = label if add is True: self.add = True else: self.add = False if partial is True: self.partial = True else: self.partial = False if conf is None: logger.warn( 'Unable to load config file properly for rtorrent usage. Make sure harpoon.conf is located in the /conf directory' ) return None else: self.conf_location = conf config = ConfigParser.RawConfigParser() config.read(self.conf_location) self.applylabel = config.getboolean('general', 'applylabel') self.multiple_seedboxes = config.getboolean('general', 'multiple_seedboxes') logger.info('multiple_seedboxes: %s' % self.multiple_seedboxes) if self.multiple_seedboxes is True: sectionsconfig1 = config.get('general', 'multiple1') sectionsconfig2 = config.get('general', 'multiple2') sectionlist1 = sectionsconfig1.split(',') sections1 = [x for x in sectionlist1 if x.lower() == label.lower()] sectionlist2 = sectionsconfig2.split(',') sections2 = [x for x in sectionlist2 if x.lower() == label.lower()] logger.info('sections1: %s' % sections1) logger.info('sections2: %s' % sections2) if sections1: logger.info('SEEDBOX-1 ENABLED!') self.start = config.getboolean('rtorrent', 'startonload') self.rtorrent_host = config.get( 'rtorrent', 'rtorr_host') + ':' + config.get( 'rtorrent', 'rtorr_port') self.rtorrent_user = config.get('rtorrent', 'rtorr_user') self.rtorrent_pass = config.get('rtorrent', 'rtorr_passwd') self.rtorrent_auth = config.get('rtorrent', 'authentication') self.rtorrent_rpc = config.get('rtorrent', 'rpc_url') self.rtorrent_ssl = config.getboolean('rtorrent', 'ssl') self.rtorrent_verify = config.getboolean( 'rtorrent', 'verify_ssl') self.basedir = config.get('post-processing', 'pp_basedir') self.multiple = '1' elif sections2: logger.info('SEEDBOX-2 ENABLED!') self.start = config.getboolean('rtorrent2', 'startonload') self.rtorrent_host = config.get( 'rtorrent2', 'rtorr_host') + ':' + config.get( 'rtorrent2', 'rtorr_port') self.rtorrent_user = config.get('rtorrent2', 'rtorr_user') self.rtorrent_pass = config.get('rtorrent2', 'rtorr_passwd') self.rtorrent_auth = config.get('rtorrent2', 'authentication') self.rtorrent_rpc = config.get('rtorrent2', 'rpc_url') self.rtorrent_ssl = config.getboolean('rtorrent2', 'ssl') self.rtorrent_verify = config.getboolean( 'rtorrent2', 'verify_ssl') self.basedir = config.get('post-processing2', 'pp_basedir2') self.multiple = '2' else: logger.info( 'No label directory assignment provided (ie. the torrent file is not located in a directory named after the label.' ) return None else: logger.info('SEEDBOX-1 IS LONE OPTION - ENABLED!') self.start = config.getboolean('rtorrent', 'startonload') self.rtorrent_host = config.get('rtorrent', 'rtorr_host') + ':' + config.get( 'rtorrent', 'rtorr_port') self.rtorrent_user = config.get('rtorrent', 'rtorr_user') self.rtorrent_pass = config.get('rtorrent', 'rtorr_passwd') self.rtorrent_auth = config.get('rtorrent', 'authentication') self.rtorrent_rpc = config.get('rtorrent', 'rpc_url') self.rtorrent_ssl = config.getboolean('rtorrent', 'ssl') self.rtorrent_verify = config.getboolean('rtorrent', 'verify_ssl') self.basedir = config.get('post-processing', 'pp_basedir') self.multiple = None self.client = TorClient.TorrentClient() if not self.client.connect(self.rtorrent_host, self.rtorrent_user, self.rtorrent_pass, self.rtorrent_auth, self.rtorrent_rpc, self.rtorrent_ssl, self.rtorrent_verify): logger.info('could not connect to host, exiting') return None