From: Razvan Deaconescu Date: Fri, 29 Jan 2010 11:29:34 +0000 (+0200) Subject: added Python run scripts for Aria, hrktorrent, mainline (BitTorrent) and Tribler X-Git-Tag: getopt_long~197 X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=234e878a13f2f495501e651a69221c8a13ed55e5;p=cs-p2p-next.git added Python run scripts for Aria, hrktorrent, mainline (BitTorrent) and Tribler --- diff --git a/scripts/start-clients/AriaRun.py b/scripts/start-clients/AriaRun.py new file mode 100644 index 0000000..f955872 --- /dev/null +++ b/scripts/start-clients/AriaRun.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +""" + Base class for running Aria client instances + 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro +""" + +import sys +import os.path +from BitTorrentClientRun import BitTorrentClientRun + +DEBUG = False + + +class AriaRun(BitTorrentClientRun): + def __init__(self, base_path): + BitTorrentClientRun.__init__(self, base_path, + "$base_path/src/aria2c --log-level=debug --dir=$download_dir --log=$log_dir/$log_file --torrent-file=$torrent_file &> $output_dir/$output_file", + "$base_path/src/aria2c --log-level=debug --dir=$download_dir --log=$log_dir/$log_file --torrent-file=$torrent_file &> $output_dir/$output_file") + + +def main(): + + """ + Test case + """ + + ar = AriaRun("/home/p2p/p2p-clients/aria") + ar.config_run("/home/p2p/p2p-dld/aria", "/home/p2p/p2p-log/aria", "aria-fedora.out", "/home/p2p/p2p-log/aria", "aria-fedora.log", 10150, "/home/p2p/p2p-meta/fedora.torrent") + ar.start() + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/start-clients/HrktorrentRun.py b/scripts/start-clients/HrktorrentRun.py new file mode 100644 index 0000000..812cf3b --- /dev/null +++ b/scripts/start-clients/HrktorrentRun.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +""" + Base class for running libtorrent (hrktorrent) client instances + 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro +""" + +import sys +import os.path +from BitTorrentClientRun import BitTorrentClientRun + +DEBUG = False + + +class HrktorrentRun(BitTorrentClientRun): + def __init__(self, base_path): + BitTorrentClientRun.__init__(self, base_path, + "cd $download_dir && $base_path/hrktorrent --minport$port --maxport$port $torrent_file &> $output_dir/$output_file", + "cd $download_dir && $base_path/hrktorrent --minport$port --maxport$port $torrent_file &> $output_dir/$output_file") + + +def main(): + + """ + Test case + """ + + hr = HrktorrentRun("/home/p2p/p2p-clients/hrktorrent") + hr.config_run("/home/p2p/p2p-dld/hrktorrent", "/home/p2p/p2p-log/hrktorrent", "hrktorrent-fedora.out", "/home/p2p/p2p-log/hrktorrent", "hrktorrent-fedora.log", 10150, "/home/p2p/p2p-meta/fedora.torrent") + hr.start() + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/start-clients/MainlineRun.py b/scripts/start-clients/MainlineRun.py new file mode 100644 index 0000000..ec65599 --- /dev/null +++ b/scripts/start-clients/MainlineRun.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +""" + Base class for running BitTorrent (Mainline) client instances + 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro +""" + +import sys +import os.path +from BitTorrentClientRun import BitTorrentClientRun + +DEBUG = False + + +class MainlineRun(BitTorrentClientRun): + def __init__(self, base_path): + BitTorrentClientRun.__init__(self, base_path, + "$base_path/bittorrent-console.py --save_in $download_dir --display_interval 1 $torrent_file 2> $log_dir/$log_file > $output_dir/$output_file", + "$base_path/bittorrent-console.py --save_in $download_dir --display_interval 1 $torrent_file 2> $log_dir/$log_file > $output_dir/$output_file") + + +def main(): + + """ + Test case + """ + + mr = MainlineRun("/home/p2p/p2p-clients/mainline") + mr.config_run("/home/p2p/p2p-dld/mainline", "/home/p2p/p2p-log/mainline", "mainline-fedora.out", "/home/p2p/p2p-log/mainline", "mainline-fedora.log", 10150, "/home/p2p/p2p-meta/fedora.torrent") + mr.start() + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/start-clients/TriblerRun.py b/scripts/start-clients/TriblerRun.py new file mode 100644 index 0000000..2a9c8dc --- /dev/null +++ b/scripts/start-clients/TriblerRun.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +""" + Base class for running Tribler client instances + 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro +""" + +import sys +import os.path +from BitTorrentClientRun import BitTorrentClientRun + +DEBUG = False + + +class TriblerRun(BitTorrentClientRun): + def __init__(self, base_path): + BitTorrentClientRun.__init__(self, base_path, + "PYTHONPATH=$base_path python $base_path/Tribler/Tools/cmdlinedl.py -o $download_dir -p $port $torrent_file 2> $log_dir/$log_file > $output_dir/$output_file", + "PYTHONPATH=$base_path python $base_path/Tribler/Tools/cmdlinedl.py -o $download_dir -p $port $torrent_file 2> $log_dir/$log_file > $output_dir/$output_file") + + +def main(): + + """ + Test case + """ + + tr = TriblerRun("/home/p2p/p2p-clients/tribler") + tr.config_run("/home/p2p/p2p-dld/tribler", "/home/p2p/p2p-log/tribler", "tribler-fedora.out", "/home/p2p/p2p-log/tribler", "tribler-fedora.log", 10150, "/home/p2p/p2p-meta/fedora.torrent") + tr.start() + + +if __name__ == "__main__": + sys.exit(main())