mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-07 02:32:32 +00:00
* Added helper functions for splitting files in FileList.
* Added "split_file_size" and "split_suffix" options. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@815 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -751,6 +751,42 @@ Change the key-bindings.
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1>
|
||||
<title>FILE-SYSTEM SETTINGS</title>
|
||||
<para>
|
||||
File-system related settings.
|
||||
</para>
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>max_file_size = <replaceable>size</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the maximum size a file can have. Disable by
|
||||
passing <emphasis>-1</emphasis>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>split_file_size = <replaceable>size</replaceable></term>
|
||||
<listitem><para>
|
||||
Split files in a torrent larger than <emphasis>size</emphasis> into
|
||||
seperate files. Disable by passing <emphasis>-1</emphasis>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>split_suffix = <replaceable>string</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the suffix used on split files. Defaults
|
||||
to <emphasis>.part</emphasis>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1>
|
||||
<title>ADVANCED SETTINGS</title>
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/resume.h>
|
||||
#include <torrent/data/file_utils.h>
|
||||
|
||||
#include "utils/variable_generic.h"
|
||||
|
||||
@@ -193,11 +194,14 @@ DownloadFactory::receive_success() {
|
||||
if (control->variable()->get_value("max_file_size") > 0)
|
||||
download->variable()->set("max_file_size", control->variable()->get("max_file_size"));
|
||||
|
||||
// if (control->variable()->get_value("split_file_size") >= 0)
|
||||
// download->variable()->set("split_file_size", control->variable()->get("split_file_size"));
|
||||
|
||||
// if (!control->variable()->get_string("split_suffix").empty())
|
||||
// download->variable()->set("split_suffix", control->variable()->get("split_suffix"));
|
||||
// Check first if we already have these values set in the session
|
||||
// torrent, so that it is safe to change the values.
|
||||
//
|
||||
// Need to also catch the exceptions.
|
||||
if (control->variable()->get_value("split_file_size") >= 0)
|
||||
torrent::file_split_all(download->download()->file_list(),
|
||||
control->variable()->get_value("split_file_size"),
|
||||
control->variable()->get_string("split_suffix"));
|
||||
|
||||
if (!rtorrent->has_key_string("directory"))
|
||||
download->variable()->set("directory", m_variables.get("directory"));
|
||||
|
||||
@@ -521,7 +521,7 @@ initialize_option_handler(Control* c) {
|
||||
|
||||
variables->insert("max_file_size", new utils::VariableValue(-1));
|
||||
variables->insert("split_file_size", new utils::VariableValue(-1));
|
||||
variables->insert("split_suffix", new utils::VariableAny(""));
|
||||
variables->insert("split_suffix", new utils::VariableAny(".part"));
|
||||
|
||||
variables->insert("port_range", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_port_range, c)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user