From: Adriana Draghici Date: Fri, 24 Sep 2010 15:42:36 +0000 (+0300) Subject: autorun: added class for starting NextShare X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=15f3ac6487e095eed5c42a973322e066dd5f1611;p=cs-p2p-next.git autorun: added class for starting NextShare --- diff --git a/autorun/Util.py b/autorun/Util.py index 54c24e5..02293b6 100644 --- a/autorun/Util.py +++ b/autorun/Util.py @@ -52,7 +52,7 @@ TORRENT = "torrent_file" TRIBLER = "tribler" TRANSMISSION = "transmission" HRKTORRENT = "hrktorrent" - +NEXTSHARE = "next-share" #status line TIMESTAMP = "timestamp" DL_SIZE = "download_size" diff --git a/autorun/server/NextShareRun.py b/autorun/server/NextShareRun.py new file mode 100644 index 0000000..a652417 --- /dev/null +++ b/autorun/server/NextShareRun.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +""" + Base class for running NextShare client instances + 2010, Adriana Draghici, adriana.draghici@cti.pub.ro +""" + +import sys +import os +import os.path +import logging +from Util import * +from BitTorrentClientRun import BitTorrentClientRun + +DEBUG = True + + +class TriblerRun(BitTorrentClientRun): + def __init__(self, base_path): + + os.environ["PYTHONPATH"] = base_path + BitTorrentClientRun.__init__(self, base_path, + "python $base_path/BaseLib/Tools/cmdlinedl.py -o $download_dir $torrent_file 2>> $log_dir/$log_file >> $output_dir/$output_file", + "python $base_path/Tribler/Tools/cmdlinedl.py -o $download_dir $torrent_file 2>> $log_dir/$log_file >> $output_dir/$output_file") + + self.my_logger = logging.getLogger('autorun.NextShareRun') + self.my_logger.setLevel(logging.DEBUG) + + +def main(): + + """ + Test case + """ + + tr = TriblerRun("/home/p2p/p2p-clients/next-share") + tr.config_run("/home/p2p/p2p-dld/next-share", + "/home/p2p/p2p-log/next-share", "test.out", + "/home/p2p/p2p-log/next-share", "test.log", + 10150,0, 0, # port, dl, up limits + "/home/p2p/cs-p2p-next/testing/torrent-files/fedora13-i386-DVD.torrent") + tr.start() + + tr.run_client(tr.simple_run_command, NEXTSHARE) + +if __name__ == "__main__": + sys.exit(main())