autorun: added class for starting NextShare
authorAdriana Draghici <adriana.draghici@cti.pub.ro>
Fri, 24 Sep 2010 15:42:36 +0000 (18:42 +0300)
committerP2P-Next <p2p-next@cs.pub.ro>
Fri, 24 Sep 2010 15:43:27 +0000 (18:43 +0300)
autorun/Util.py
autorun/server/NextShareRun.py [new file with mode: 0644]

index 54c24e5..02293b6 100644 (file)
@@ -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 (file)
index 0000000..a652417
--- /dev/null
@@ -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())