""" A GUI to read bsddb or pickle and display the data by a tree ctrl. """ import sys from traceback import print_exc import os from pydb import BSDDBOpener, dunno2unicode, print_dict if __name__ == '__main__': if len(sys.argv) < 3: print >> sys.stderr, "Usage: change_torrent_dir torrent_db_path torrents_dir" sys.exit(1) db_path = sys.argv[1] torrents_dir = sys.argv[2] if not os.path.exists(torrents_dir): print >> sys.stderr, "torrents_dir does not exist" sys.exit(1) opener = BSDDBOpener() d = opener.openDB(db_path, 'db') for i in d: old = d[i]['torrent_dir'] data = d[i] data['torrent_dir'] = torrents_dir d.put(i,data) new = d[i]['torrent_dir'] print old, '->', new d.sync()