diff --git a/Makefile.am b/Makefile.am index c432ae60..2b32e79f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ -SUBDIRS = src +SUBDIRS = \ + doc \ + src EXTRA_DIST= \ autogen.sh \ diff --git a/TODO b/TODO index 1503a7fa..d6e023fa 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,3 @@ Make accumulate return the value, no refs please... > created from rtorrent. Like when you start a torrent, but it is too > slow or broken or for various reasons you don't want to download it. - -Seperate download management from core::management. - -Recheck hash key. diff --git a/configure.ac b/configure.ac index e3318936..67ab0510 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ AC_DEFINE(HAVE_CONFIG_H, 1, true if config.h was included) AC_OUTPUT([ Makefile + doc/Makefile src/Makefile src/core/Makefile src/display/Makefile diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 00000000..e04f1780 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1 @@ +man_MANS = rtorrent.1 diff --git a/doc/rtorrent.1.txt b/doc/rtorrent.1.txt deleted file mode 100644 index 14cc8b41..00000000 --- a/doc/rtorrent.1.txt +++ /dev/null @@ -1,158 +0,0 @@ -//////////////// -// rtorrent.1.txt -// Asciidoc source for rtorrent manpage -// Lee Bigelow -// Use as you will. -// -// processed to manpage with: -// asciidoc -b docbook -d manpage rtorrent.1.txt -// docbook2x-man rtorrent.1.xml -// (or use: xmlto man rtorrent.xml) -// processed to html with: -// asciidoc -b css-embedded -d manpage rtorrent.1.txt -//////////////// - -RTORRENT(1) -=========== -Jari Sundell -v0.1.5, 9 April 2005 - -NAME ----- -rtorrent - rakshasa's ncurses bittorrent client using libtorrent - -SYNOPSIS --------- -*rtorrent* [-b ip] [-i ip] [-p portrange] [-d directory] [-s directory] [-h] - -DESCRIPTION ------------ -The rtorrent command starts a ncurses based bittorrent downloading front-end -that uses libtorrent to control multiple bittorrent downloads. - -OPTIONS -------- --b :: - Bind the listening socket to this IP. --i :: - Set the IP address sent to the tracker. - --p :: - Open a port in the range a to b. - --s :: - Use as the session directory. The torrents will be - saved with the info-hash in hex as the filename. - -KEYBOARD CONTROLS ------------------ -All: -~~~~ - -.................................... -Ctrl-q Quit - -a Increase Throttle by 1 KiB -z Decrease Throttle by 1 KiB - -s Increase Throttle by 5 KiB -x Decrease Throttle by 5 KiB - -d Increase Throttle by 50 KiB -c Decrease Throttle by 50 KiB -.................................... - -In main window: -~~~~~~~~~~~~~~~ - -............. -Backspace Activate text input for inserting urls/file - paths. Arrows/C^f/C^b for navigation, enter/C^m. - -Up/Down Select torrent - -Right View torrent - -Ctrl-s Start torrent -Ctrl-d Stop/delete torrent -............... - - -In torrent view: -~~~~~~~~~~~~~~~~ - -............... -Up/Down Select peer - -Left Back to main - -Right View files -p View peer -o View trackers - -1 Decrease max uploads -2 Increase max uploads - -3 Decrease min peers connected -4 Increase min peers connected - -5 Decrease max peers connected -6 Increase max peers connected - -t Query tracker - -* Snub peer -............. - -In file view: -~~~~~~~~~~~~~ - -............ -Up/Down Select file - -Left Back to torrent view - -SpaceBar Change file priority -............ - -RESOURCES ---------- - -Homepage for libtorrent and rtorrent:: - * http://libtorrent.rakshasa.no[] - -Mailing list for libtorrent and rtorrent:: - * Go to http://rakshasa.no/mailman/listinfo/libtorrent-devel[] to - subscribe to the mailing list - * Send your emails to the list at - - - -COPYING -------- - -Copyright (C) 2005 Jari Sundell - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -AUTHOR ------- - -Jari Sundell - -BUGS ----- - -Send bug reports to the authors email address or to the mailing list for libtorrent. diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml new file mode 100644 index 00000000..c95040d9 --- /dev/null +++ b/doc/rtorrent.1.xml @@ -0,0 +1,439 @@ + + + + + + + rtorrent + 1 + June 25th, 2005 + + BitTorrent client for ncurses + + + + + rtorrent + a BitTorrent client for ncurses + + + + + + rtorrent + -h + -o key1=opt1,... + URL | FILE + + + + + + DESCRIPTION + + + rtorrent is a BitTorrent client for ncurses, + using the libtorrent library. The client + and library is written in C++ with emphasis on speed and + efficiency, while delivering equivalent features to those found + in GUI based clients in an ncurses client. + + + + + + + KEYBOARD CONTROL + + + + + Global Keys + + + + + ^q + + Initiate shutdown, press again to force the shutdown and + skip sending the stop signal to trackers. + + + + + up | down + + Select item. + + + + + <- + + Go back to the previous screen. + + + + + a | s | d + + Increase the upload throttle by 1/5/50 KB. + + + + + A | S | D + + Increase the download throttle by 1/5/50 KB. + + + + + z | x | c + + Decrease the upload throttle by 1/5/50 KB. + + + + + Z | X | C + + Decrease the download throttle by 1/5/50 KB. + + + + + + + + + Main View Keys + + + + + -> + + View download. + + + + + ^s + + Start download. + + + + + ^d + + Stop an active download, or remove a stopped download. + + + + + ^r + + Initiate hash check of torrent. + + + + + backspace + + Add torrent using an URL or file path. Use + tab to view directory content and do + autocomplete. + + + + + l + + View log. Exit by pressing the spacebar. + + + + + + + + + Download View Keys + + + + + -> + + View torrent file list. Use the spacebar to change file + priorities. + + + + + 1 | 2 + + Adjust max uploads. + + + + + + 3 | 4 + + Adjust min peers. + + + + + 5 | 6 + + Adjust max peers. + + + + + o + + Display the tracker list. Cycle the trackers in a group + with the spacebar. + + + + + p + + View peer and torrent information. + + + + + t | T + + Initiate tracker request. Use capital T to force the + request, ignoring the "min interval". + + + + + + + + + + + + OPTIONS + + + + + -b a.b.c.d + + Bind listening socket and outgoing connections to this + network interface address. + + + + + -d directory + + Set the default download directory. Defaults to "./". + + + + + -h + + Display help and exit. + + + + + -i a.b.c.d + + Set the address reported to the tracker. + + + + + -o key1=opt1,... + + Set any number of options, see the + SETTINGS section. The options given here + override the resource files. + + + + + -p a-b + + Try to open a listening port in the range + a up to and including + b. + + + + + -s directory + + Session management will be enabled and the torrent files for + all open downloads will be stored in this directory. Only + one instance of rtorrent should be used with each session + directory, though at the moment no locking is done. + + + + + + + + + + GENERAL SETTINGS + + + + + + + max_peers = value + + Set the maximum number of peers to allow in each download. + + + + + min_peers = value + + Set the minimum number of peers to try to connect to in each + download. + + + + + max_uploads = value + + Set the maximum number of simultanious uploads per download. + + + + + download_rate = KB + + Set the maximum global download rate. + + + + + upload_rate = kb + + Set the maximum global upload rate. + + + + + bind = a.b.c.d + + Bind listening socket and outgoing connections to this + network interface address. + + + + + ip = a.b.c.d + + Set the address reported to the tracker. + + + + + port = a-b + + Try to open a listening port in the range + a up to and including + b. + + + + + check_hash = yes | no + + Perform hash check on finished downloads. + + + + + directory = directory + + Set the default download directory. Defaults to "./". + + + + + session = directory + + Session management will be enabled and the torrent files for + all open downloads will be stored in this directory. Only + one instance of rtorrent should be used with each session + directory, though at the moment no locking is done. + + + + + + + + + + ADVANCED SETTINGS + + This list contains settings normal users shouldn't need to touch. + + + + + + hash_read_ahead = MB + + Configure how far ahead we ask the kernel to read when doing + hash checking. The hash checker uses madvise(..., + MADV_WILLNEED) for the requests. + + + + + max_open_files = value + + Number of files to simultaniously keep open. Libtorrent + dynamicly opens and closes files when mapping files to + memory. + + + + + tracker_dump = yes | no + + Dump data received from trackers to the files + "./tracker_dump.*". + + + + + + + + + + AUTHORS + + + Jari "Rakshasa" Sundell jaris@ifi.uio.no + + + + + + diff --git a/doc/rtorrent.rc b/doc/rtorrent.rc index 80a6be4d..fc6008de 100644 --- a/doc/rtorrent.rc +++ b/doc/rtorrent.rc @@ -1,5 +1,6 @@ # This is an example resource file for rTorrent. Copy to -# ~/.rtorrent.rc and enable/modify the options as needed. +# ~/.rtorrent.rc and enable/modify the options as needed. Remember to +# uncomment the options you wish to enable. # Minumum amount of peers to connect per torrent, if available. #min_peers = 40 diff --git a/src/main.cc b/src/main.cc index 532e2060..c6b908bd 100644 --- a/src/main.cc +++ b/src/main.cc @@ -118,21 +118,22 @@ parse_options(ui::Control* c, OptionHandler* optionHandler, int argc, char** arg void initialize_option_handler(ui::Control* c, OptionHandler* optionHandler) { optionHandler->insert("max_peers", new OptionHandlerInt(c, &apply_download_max_peers, &validate_download_peers)); - optionHandler->insert("max_uploads", new OptionHandlerInt(c, &apply_download_max_uploads, &validate_download_peers)); optionHandler->insert("min_peers", new OptionHandlerInt(c, &apply_download_min_peers, &validate_download_peers)); + optionHandler->insert("max_uploads", new OptionHandlerInt(c, &apply_download_max_uploads, &validate_download_peers)); optionHandler->insert("download_rate", new OptionHandlerInt(c, &apply_global_download_rate, &validate_rate)); - optionHandler->insert("hash_read_ahead", new OptionHandlerInt(c, &apply_hash_read_ahead, &validate_read_ahead)); - optionHandler->insert("max_open_files", new OptionHandlerInt(c, &apply_max_open_files, &validate_fd)); optionHandler->insert("upload_rate", new OptionHandlerInt(c, &apply_global_upload_rate, &validate_rate)); - optionHandler->insert("check_hash", new OptionHandlerString(c, &apply_check_hash, &validate_yes_no)); - optionHandler->insert("directory", new OptionHandlerString(c, &apply_download_directory, &validate_directory)); - optionHandler->insert("tracker_dump", new OptionHandlerString(c, &apply_tracker_dump, &validate_yes_no)); - optionHandler->insert("bind", new OptionHandlerString(c, &apply_bind, &validate_ip)); optionHandler->insert("ip", new OptionHandlerString(c, &apply_ip, &validate_ip)); optionHandler->insert("port", new OptionHandlerString(c, &apply_port_range, &validate_port_range)); + + optionHandler->insert("check_hash", new OptionHandlerString(c, &apply_check_hash, &validate_yes_no)); + optionHandler->insert("directory", new OptionHandlerString(c, &apply_download_directory, &validate_directory)); + + optionHandler->insert("hash_read_ahead", new OptionHandlerInt(c, &apply_hash_read_ahead, &validate_read_ahead)); + optionHandler->insert("max_open_files", new OptionHandlerInt(c, &apply_max_open_files, &validate_fd)); + optionHandler->insert("tracker_dump", new OptionHandlerString(c, &apply_tracker_dump, &validate_yes_no)); } void diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index ee7bd7cf..5d5a200c 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -76,7 +76,7 @@ DownloadList::DownloadList(Control* c) : } DownloadList::~DownloadList() { - if (m_window != m_control->get_display().end()) + if (is_active()) throw std::logic_error("ui::DownloadList::~DownloadList() called on an active object"); std::for_each(m_uiArray, m_uiArray + DISPLAY_MAX_SIZE, rak::call_delete()); @@ -93,7 +93,7 @@ DownloadList::~DownloadList() { void DownloadList::activate() { - if (m_window != m_control->get_display().end()) + if (is_active()) throw std::logic_error("ui::Download::activate() called on an already activated object"); utils::taskScheduler.insert(&m_taskUpdate, utils::Timer::cache() + 1000000); @@ -115,7 +115,7 @@ DownloadList::activate() { void DownloadList::disable() { - if (m_window == m_control->get_display().end()) + if (!is_active()) throw std::logic_error("ui::Download::disable() called on an already disabled object"); disable_display(); @@ -141,7 +141,7 @@ DownloadList::disable() { void DownloadList::activate_display(Display d) { - if (m_window == m_control->get_display().end()) + if (!is_active()) throw std::logic_error("ui::DownloadList::activate_display(...) could not find previous display iterator"); if (d >= DISPLAY_MAX_SIZE) diff --git a/src/ui/download_list.h b/src/ui/download_list.h index f4a48b16..1e1716ea 100644 --- a/src/ui/download_list.h +++ b/src/ui/download_list.h @@ -77,6 +77,8 @@ public: input::Bindings& get_bindings() { return *m_bindings; } + bool is_active() const { return m_window != m_control->get_display().end(); } + void activate(); void disable(); diff --git a/src/ui/root.cc b/src/ui/root.cc index 42da4ad4..36eb4432 100644 --- a/src/ui/root.cc +++ b/src/ui/root.cc @@ -43,6 +43,9 @@ Root::init() { void Root::cleanup() { + if (m_downloadList->is_active()) + m_downloadList->disable(); + delete m_downloadList; m_control->get_input().erase(&m_bindings);