* Added man page entries for view_* and session_save.

* Moved around resume save so it doesn't bork on completed last hash
check.

* torrent::Download::hash_resume_clear() no longer removes priority
and mtime information, only the bitfield.

* Added a quick hack that allows libtorrent to split large files. The
parameter needs to be set in the source, no API available yet.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@681 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-05-03 18:59:07 +00:00
parent f01289ef12
commit 0620ea88a7
4 changed files with 115 additions and 19 deletions
+96 -6
View File
@@ -119,6 +119,15 @@
</para></listitem>
</varlistentry>
<varlistentry>
<term>1 - 6</term>
<listitem><para>
Change view.
</para></listitem>
</varlistentry>
<varlistentry>
<term>^s</term>
<listitem><para>
@@ -269,7 +278,7 @@ Disconnect peer.
<term>*</term>
<listitem><para>
Choke/Snubb peer.
Choke/Snub peer.
</para></listitem>
</varlistentry>
@@ -548,8 +557,8 @@ deleted, the association is then cleared.
<term>load_start = <replaceable>file</replaceable></term>
<listitem><para>
Load and possibly start a file, or possibly mutiple files by using the
wildcard "*". This is meant for use with
Load and possibly start a file, or possibly multiple files by using the
wild-card "*". This is meant for use with
<emphasis>schedule</emphasis>, though ensure that the
<emphasis>start</emphasis> is non-zero. The loaded file will be tied
to the filename provided.
@@ -573,6 +582,78 @@ torrent::input_error exception on bad input.
</refsect1>
<refsect1>
<title>DISPLAY SETTINGS</title>
<para>
Display related settings.
</para>
<variablelist>
<varlistentry>
<term>view_add = <replaceable>name</replaceable></term>
<listitem><para>
Create a new view.
</para></listitem>
</varlistentry>
<varlistentry>
<term>view_sort = <replaceable>name</replaceable></term>
<term>view_sort = <replaceable>name</replaceable>,<replaceable>seconds</replaceable></term>
<listitem><para>
Sort a view according the the criteria set by
<emphasis>view_sort_current</emphasis>. If the optional argument is
supplied, the view is not sorted if a change happened during the last
<emphasis>seconds</emphasis>. This command is meant to be used with
<emphasis>schedule</emphasis>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>view_sort_new = <replaceable>name</replaceable>,<replaceable>...</replaceable></term>
<term>view_sort_current = <replaceable>name</replaceable>,<replaceable>...</replaceable></term>
<listitem><para>
Set the sorting criteria for when new elements inserted or
<emphasis>view_sort</emphasis> is called. The list can contain any
number of criteria, including zero, from the following:
</para><para>
<emphasis>name</emphasis>, <emphasis>name_reverse</emphasis>,
<emphasis>stopped</emphasis>, <emphasis>started</emphasis>,
<emphasis>complete</emphasis>, <emphasis>incomplete</emphasis>,
<emphasis>state_changed</emphasis>,
<emphasis>state_changed_reverse</emphasis>
</para></listitem>
</varlistentry>
<varlistentry>
<term>view_filter = <replaceable>name</replaceable>,<replaceable>...</replaceable></term>
<listitem><para>
Set a list of filter to apply when new new downloads are added and
when <emphasis>view_sort</emphasis> gets called. All filters must
match for the download to be included.
</para><para>
<emphasis>stopped</emphasis>, <emphasis>started</emphasis>,
<emphasis>complete</emphasis>, <emphasis>incomplete</emphasis>,
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>ADVANCED SETTINGS</title>
@@ -659,8 +740,8 @@ Changes the working directory of the process using
<term>session_on_completion = <replaceable>yes</replaceable></term>
<listitem><para>
Controls whetever the session torrent is updated when a torrent
finishes. By default on.
Controls if the session torrent is saved when a torrent finishes. By
default on.
</para></listitem>
</varlistentry>
@@ -669,7 +750,16 @@ finishes. By default on.
<term>session_lock = <replaceable>yes</replaceable></term>
<listitem><para>
Controls whetever a lock file is created in the session directory.
Controls if a lock file is created in the session directory on startup.
</para></listitem>
</varlistentry>
<varlistentry>
<term>session_save = </term>
<listitem><para>
Save the session files for all downloads.
</para></listitem>
</varlistentry>
+10 -7
View File
@@ -339,10 +339,7 @@ DownloadList::check_hash_throw(Download* download) {
close_throw(download);
download->download()->hash_resume_clear();
open_throw(download);
download->download()->hash_resume_save();
// If any more stuff is added here, make sure resume etc are still
// correct.
@@ -353,7 +350,9 @@ void
DownloadList::hash_done(Download* download) {
check_contains(download);
if (!download->download()->is_hash_checked() || download->download()->is_hash_checking())
if (!download->download()->is_hash_checked() ||
download->download()->is_hash_checking() ||
download->download()->is_active())
throw torrent::internal_error("DownloadList::hash_done(...) download in invalid state.");
// Need to find some sane conditional here. Can we check the total
@@ -375,6 +374,10 @@ DownloadList::hash_done(Download* download) {
if (download->is_done())
download->variable()->set("complete", (int64_t)1);
// Save resume data so we update time-stamps and priorities if
// they were invalid/changed when loading.
download->download()->hash_resume_save();
if (download->variable()->get_value("state") == 1)
resume(download);
@@ -432,12 +435,12 @@ DownloadList::confirm_finished(Download* download) {
download->download()->tracker_list().send_completed();
download->download()->hash_resume_save();
// Do this before the slots are called in case one of them closes
// the download.
if (!download->is_active() && control->variable()->get_value("session_on_completion") == 1)
if (!download->is_active() && control->variable()->get_value("session_on_completion") == 1) {
download->download()->hash_resume_save();
control->core()->download_store()->save(download);
}
std::for_each(m_slotMapFinished.begin(), m_slotMapFinished.end(), download_list_call(download));
}
+8 -1
View File
@@ -48,6 +48,13 @@
namespace core {
class ViewSortFalse : public ViewSort {
public:
virtual bool operator () (Download* d1, Download* d2) const {
return false;
}
};
class ViewSortName : public ViewSort {
public:
virtual bool operator () (Download* d1, Download* d2) const {
@@ -117,7 +124,7 @@ ViewManager::ViewManager(DownloadList* dl) :
m_list(dl) {
// m_sort["first"] = new ViewSortNot(new ViewSort());
// m_sort["last"] = new ViewSort();
m_sort["last"] = new ViewSortFalse();
m_sort["name"] = new ViewSortName();
m_sort["name_reverse"] = new ViewSortReverse(new ViewSortName());
+1 -5
View File
@@ -165,6 +165,7 @@ main(int argc, char** argv) {
// Currently not doing any sorting on main.
control->variable()->process_command("view_add = main");
//control->variable()->process_command("view_sort_current = name,started,name");
control->variable()->process_command("view_add = name");
control->variable()->process_command("view_sort_new = name,name");
@@ -207,11 +208,6 @@ main(int argc, char** argv) {
// control->variable()->process_command("schedule = scheduler,10,10,download_scheduler=");
// Move env and go through "try_import".
// if (!control->variable()->process_file("~/.rtorrent.rc"))
// control->core()->get_log_important().push_front("Could not load \"~/.rtorrent.rc\".");
// Complain.
control->variable()->process_command("try_import = ~/.rtorrent.rc");
int firstArg = parse_options(control, argc, argv);