def run(self, peer_limit=0, torrent_limit=0, torrent_dir=None, icon_dir=None): if self.create_sqlite(self.sqlite_dbfile_path, self.sql_filename): self.scan_PeerIcons(icon_dir) MyDB.getInstance(None, self.bsddb_dir) self.convert_PeerDB(peer_limit) self.convert_MyDB(torrent_dir) self.convert_BartercastDB() self.convert_TorrentDB(torrent_limit) self.convert_MyPreferenceDB() self.convert_PreferenceDB() self.sdb.close() #self.remove_bsddb() return True else: if self.sdb: self.sdb.close() return False
def convert_MyDB(self, torrent_dir=None): print >> sys.stderr, "convert MyDB to MyInfo" mydb = MyDB.getInstance(self.bsddb_dir) desired_keys = [ 'permid', 'ip', 'port', 'name' ] #, 'version', 'torrent_path'] according to Jelle's plan, all these keys will not be included in db for key in desired_keys: value = mydb._data[key] # if key == 'permid' and value: # value = bin2str(value) self.cur.execute("insert into MyInfo (entry,value) values (?,?)", (key, value)) if torrent_dir is not None: sql = "insert into MyInfo (entry,value) values ('torrent_dir', ?)" self.cur.execute(sql, (torrent_dir, )) friends = mydb.getFriends() for permid in friends: self.addFriend(permid) superpeers = mydb.getSuperPeers() for permid in superpeers: self.addSuperPeer(permid) self._commit()
def convert_MyDB(self, torrent_dir=None): print >>sys.stderr, "convert MyDB to MyInfo" mydb = MyDB.getInstance(self.bsddb_dir) desired_keys = ['permid', 'ip', 'port', 'name']#, 'version', 'torrent_path'] according to Jelle's plan, all these keys will not be included in db for key in desired_keys: value = mydb._data[key] # if key == 'permid' and value: # value = bin2str(value) self.cur.execute("insert into MyInfo (entry,value) values (?,?)", (key,value)) if torrent_dir is not None: sql = "insert into MyInfo (entry,value) values ('torrent_dir', ?)" self.cur.execute(sql, (torrent_dir,)) friends = mydb.getFriends() for permid in friends: self.addFriend(permid) superpeers = mydb.getSuperPeers() for permid in superpeers: self.addSuperPeer(permid) self._commit()
def convert_MyDB(self, torrent_dir=None): print >>sys.stderr, "convert MyDB to MyInfo" mydb = MyDB.getInstance(self.bsddb_dir) friends = mydb.getFriends() for permid in friends: self.addFriend(permid) superpeers = mydb.getSuperPeers() for permid in superpeers: self.addSuperPeer(permid) self._commit()
def convert_MyDB(self, torrent_dir=None): print >> sys.stderr, "convert MyDB to MyInfo" mydb = MyDB.getInstance(self.bsddb_dir) friends = mydb.getFriends() for permid in friends: self.addFriend(permid) superpeers = mydb.getSuperPeers() for permid in superpeers: self.addSuperPeer(permid) self._commit()