mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 13:12:32 +00:00
* Added "working_directory" option that calls chdir.
* Added "session_on_completion" option which saves the session torrent when a download finishes. * Handle SIGTERM gracefully, saving session torrents etc. * Implemented session directory lockfile, use "session_lock" option to disable. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@629 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <cstdlib>
|
||||
#include <time.h>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
#include "command_scheduler.h"
|
||||
@@ -114,6 +115,27 @@ CommandScheduler::call_item(value_type item) {
|
||||
item->enable(next);
|
||||
}
|
||||
|
||||
void
|
||||
CommandScheduler::parse(const std::string& arg) {
|
||||
char key[21];
|
||||
char bufAbsolute[21];
|
||||
char bufInterval[21];
|
||||
char command[2048];
|
||||
|
||||
if (std::sscanf(arg.c_str(), "%20[^,],%20[^,],%20[^,],%2047[^\n]", key, bufAbsolute, bufInterval, command) != 4)
|
||||
throw torrent::input_error("Invalid arguments to command.");
|
||||
|
||||
uint32_t absolute = parse_absolute(bufAbsolute);
|
||||
uint32_t interval = parse_interval(bufInterval);
|
||||
|
||||
CommandSchedulerItem* item = *insert(rak::trim(std::string(key)));
|
||||
|
||||
item->set_command(rak::trim(std::string(command)));
|
||||
item->set_interval(interval);
|
||||
|
||||
item->enable((cachedTime + rak::timer(absolute) * 1000000).round_seconds());
|
||||
}
|
||||
|
||||
uint32_t
|
||||
CommandScheduler::parse_absolute(const char* str) {
|
||||
Time result = parse_time(str);
|
||||
|
||||
Reference in New Issue
Block a user