Exemplo n.º 1
0
 def __init__(self,
              data_handler,
              overlay_bridge,
              session,
              buddycast_interval_function,
              log='',
              dnsindb=None):
     self.interval = buddycast_interval_function
     self.data_handler = data_handler
     self.dnsindb = dnsindb
     self.log = log
     self.overlay_bridge = overlay_bridge
     self.channelcastdb = ChannelCastDBHandler.getInstance()
     self.votecastdb = VoteCastDBHandler.getInstance()
     self.rtorrent_handler = RemoteTorrentHandler.getInstance()
     self.session = session
     self.my_permid = session.get_permid()
     self.network_delay = 30
     self.buddycast_core = None
     if self.log:
         self.overlay_log = OverlayLogger.getInstance(self.log)
         self.dnsindb = self.data_handler.get_dns_from_peerdb
     self.notifier = Notifier.getInstance()
     self.metadataDbHandler = MetadataDBHandler.getInstance()
     subtitleSupport = SubtitlesSupport.getInstance()
     self.peersHaveManger = PeersHaveManager.getInstance()
     if not self.peersHaveManger.isRegistered():
         self.peersHaveManger.register(self.metadataDbHandler,
                                       self.overlay_bridge)
Exemplo n.º 2
0
 def register(self, overlay_bridge, launchmany, config, bc_fac, log = ''):
     if DEBUG:
         print >> sys.stderr, 'rquery: register'
     self.overlay_bridge = overlay_bridge
     self.session = launchmany.session
     self.torrent_db = launchmany.torrent_db
     self.peer_db = launchmany.peer_db
     self.channelcast_db = launchmany.channelcast_db
     self.config = config
     self.bc_fac = bc_fac
     if log:
         self.overlay_log = OverlayLogger.getInstance(log)
     self.torrent_dir = os.path.abspath(self.config['torrent_collecting_dir'])
     self.registered = True
Exemplo n.º 3
0
 def register(self, overlay_bridge, launchmany, config, bc_fac, log=''):
     if DEBUG:
         print >> sys.stderr, 'rquery: register'
     self.overlay_bridge = overlay_bridge
     self.session = launchmany.session
     self.torrent_db = launchmany.torrent_db
     self.peer_db = launchmany.peer_db
     self.channelcast_db = launchmany.channelcast_db
     self.config = config
     self.bc_fac = bc_fac
     if log:
         self.overlay_log = OverlayLogger.getInstance(log)
     self.torrent_dir = os.path.abspath(
         self.config['torrent_collecting_dir'])
     self.registered = True
Exemplo n.º 4
0
 def __init__(self, data_handler, secure_overlay, session, buddycast_interval_function, log="", dnsindb=None):
     self.interval = buddycast_interval_function
     self.data_handler = data_handler
     self.dnsindb = dnsindb
     self.log = log
     self.peerdb = PeerDBHandler.getInstance()
     self.votecastdb = VoteCastDBHandler.getInstance()
     self.session = session
     self.my_permid = session.get_permid()
     self.max_length = SINGLE_VOTECAST_LENGTH * (
         session.get_votecast_random_votes() + session.get_votecast_recent_votes()
     )
     self.buddycast_core = None
     self.notifier = Notifier.getInstance()
     if self.log:
         self.overlay_log = OverlayLogger.getInstance(self.log)
Exemplo n.º 5
0
 def __init__(self, data_handler, overlay_bridge, log = '', dnsindb = None):
     if DEBUG:
         print >> sys.stderr, '=================Initializing bartercast core'
     self.data_handler = data_handler
     self.dnsindb = dnsindb
     self.log = log
     self.overlay_bridge = overlay_bridge
     self.bartercastdb = BarterCastDBHandler.getInstance()
     self.network_delay = 30
     self.send_block_list = {}
     self.recv_block_list = {}
     self.block_interval = 3600
     self.topn = self.bartercastdb.getTopNPeers(NO_PEERS_IN_MSG, local_only=True)['top']
     self.overlay_bridge.add_task(self.refreshTopN, REFRESH_TOPN_INTERVAL)
     if self.log:
         self.overlay_log = OverlayLogger.getInstance(self.log)
     if LOG:
         self.logfile = '/Users/michel/packages/bartercast_dataset/bartercast42.log'
         if not os.path.exists(self.logfile):
             log = open(self.logfile, 'w')
             log.close()
Exemplo n.º 6
0
 def __init__(self, data_handler, overlay_bridge, session, buddycast_interval_function, log = '', dnsindb = None):
     self.interval = buddycast_interval_function
     self.data_handler = data_handler
     self.dnsindb = dnsindb
     self.log = log
     self.overlay_bridge = overlay_bridge
     self.channelcastdb = ChannelCastDBHandler.getInstance()
     self.votecastdb = VoteCastDBHandler.getInstance()
     self.rtorrent_handler = RemoteTorrentHandler.getInstance()
     self.session = session
     self.my_permid = session.get_permid()
     self.network_delay = 30
     self.buddycast_core = None
     if self.log:
         self.overlay_log = OverlayLogger.getInstance(self.log)
         self.dnsindb = self.data_handler.get_dns_from_peerdb
     self.notifier = Notifier.getInstance()
     self.metadataDbHandler = MetadataDBHandler.getInstance()
     subtitleSupport = SubtitlesSupport.getInstance()
     self.peersHaveManger = PeersHaveManager.getInstance()
     if not self.peersHaveManger.isRegistered():
         self.peersHaveManger.register(self.metadataDbHandler, self.overlay_bridge)
Exemplo n.º 7
0
 def __init__(self, data_handler, overlay_bridge, log='', dnsindb=None):
     if DEBUG:
         print >> sys.stderr, '=================Initializing bartercast core'
     self.data_handler = data_handler
     self.dnsindb = dnsindb
     self.log = log
     self.overlay_bridge = overlay_bridge
     self.bartercastdb = BarterCastDBHandler.getInstance()
     self.network_delay = 30
     self.send_block_list = {}
     self.recv_block_list = {}
     self.block_interval = 3600
     self.topn = self.bartercastdb.getTopNPeers(NO_PEERS_IN_MSG,
                                                local_only=True)['top']
     self.overlay_bridge.add_task(self.refreshTopN, REFRESH_TOPN_INTERVAL)
     if self.log:
         self.overlay_log = OverlayLogger.getInstance(self.log)
     if LOG:
         self.logfile = '/Users/michel/packages/bartercast_dataset/bartercast42.log'
         if not os.path.exists(self.logfile):
             log = open(self.logfile, 'w')
             log.close()