mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 12:42:31 +00:00
* Fixed a regression that threw an exception for torrents with
empty directories. * When receiving zero length pieces, remove them from the request list. * Send the interested state before any requests as some clients, BitTornado 0.7.14 and uTorrent 0.3.0, disconnect if a request has been received while uninterested. * WITH_POSIX_FALLOCATE configure macro should check against "yes", not "no". * The new priority queue would cause arg torrents to load before session torrents in some cases. Fixed to perform the session torrent tasks before loading arg torrents. * Allow '*' wildcard in filenames when loading torrents. * Added load, load_run, stop_tied and remove_tied settings which can be used to scan a directory for new/removed torrents. These torrents are tied to the lifetime of the torrent file. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@616 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -37,17 +37,21 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <torrent/bencode.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/torrent.h>
|
||||
|
||||
#include "core/manager.h"
|
||||
#include "ui/root.h"
|
||||
#include "utils/directory.h"
|
||||
#include "utils/file_stat.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "option_handler_rules.h"
|
||||
@@ -218,6 +222,58 @@ apply_http_proxy(Control* m, const std::string& arg) {
|
||||
m->core()->get_poll_manager()->get_http_stack()->set_http_proxy(arg);
|
||||
}
|
||||
|
||||
void
|
||||
apply_load(Control* m, const std::string& arg) {
|
||||
m->core()->try_create_download_expand(arg, false, false, true);
|
||||
}
|
||||
|
||||
void
|
||||
apply_load_run(Control* m, const std::string& arg) {
|
||||
m->core()->try_create_download_expand(arg, true, false, true);
|
||||
}
|
||||
|
||||
void
|
||||
apply_stop_untied(Control* m, const std::string& arg) {
|
||||
core::Manager::DListItr itr = m->core()->get_download_list().begin();
|
||||
|
||||
while ((itr = std::find_if(itr, m->core()->get_download_list().end(),
|
||||
rak::on(std::mem_fun(&core::Download::tied_to_file), std::not1(std::mem_fun_ref(&std::string::empty)))))
|
||||
!= m->core()->get_download_list().end()) {
|
||||
utils::FileStat fs;
|
||||
|
||||
if (fs.update((*itr)->tied_to_file().c_str()) != 0) {
|
||||
(*itr)->set_tied_to_file(std::string());
|
||||
(*itr)->get_bencode().get_key("rtorrent").erase_key("tied");
|
||||
|
||||
m->core()->stop(*itr);
|
||||
}
|
||||
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
apply_remove_untied(Control* m, const std::string& arg) {
|
||||
core::Manager::DListItr itr = m->core()->get_download_list().begin();
|
||||
|
||||
while ((itr = std::find_if(itr, m->core()->get_download_list().end(),
|
||||
rak::on(std::mem_fun(&core::Download::tied_to_file), std::not1(std::mem_fun_ref(&std::string::empty)))))
|
||||
!= m->core()->get_download_list().end()) {
|
||||
utils::FileStat fs;
|
||||
|
||||
if (fs.update((*itr)->tied_to_file().c_str()) != 0) {
|
||||
(*itr)->set_tied_to_file(std::string());
|
||||
(*itr)->get_bencode().get_key("rtorrent").erase_key("tied");
|
||||
|
||||
m->core()->stop(*itr);
|
||||
itr = m->core()->erase(itr);
|
||||
|
||||
} else {
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
apply_session_directory(Control* m, const std::string& arg) {
|
||||
m->core()->get_download_store().use(arg);
|
||||
|
||||
Reference in New Issue
Block a user