mirror of https://github.com/aria2/aria2
Added --force-save option.
--force-save option saves download with --save-session option even if the download is completed or removed. This may be useful to save BitTorrent seeding which is recognized as completed state. The default value is false.pull/34/head
parent
2ee4361848
commit
e0dcb942b2
|
@ -370,6 +370,19 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
|
|||
op->setChangeOptionForReserved(true);
|
||||
handlers.push_back(op);
|
||||
}
|
||||
{
|
||||
OptionHandler* op(new BooleanOptionHandler
|
||||
(PREF_FORCE_SAVE,
|
||||
TEXT_FORCE_SAVE,
|
||||
A2_V_FALSE,
|
||||
OptionHandler::OPT_ARG));
|
||||
op->addTag(TAG_ADVANCED);
|
||||
op->setInitialOption(true);
|
||||
op->setChangeOption(true);
|
||||
op->setChangeGlobalOption(true);
|
||||
op->setChangeOptionForReserved(true);
|
||||
handlers.push_back(op);
|
||||
}
|
||||
{
|
||||
OptionHandler* op(new BooleanOptionHandler
|
||||
(PREF_FORCE_SEQUENTIAL,
|
||||
|
|
|
@ -159,7 +159,13 @@ bool SessionSerializer::save(BufferedFile& fp) const
|
|||
results.begin(), eoi = results.end(); itr != eoi; ++itr) {
|
||||
if((*itr)->result == error_code::FINISHED ||
|
||||
(*itr)->result == error_code::REMOVED) {
|
||||
continue;
|
||||
if((*itr)->option->getAsBool(PREF_FORCE_SAVE)) {
|
||||
if(!writeDownloadResult(fp, metainfoCache, *itr)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if((*itr)->result == error_code::IN_PROGRESS) {
|
||||
if(saveInProgress_) {
|
||||
if(!writeDownloadResult(fp, metainfoCache, *itr)) {
|
||||
|
|
|
@ -336,6 +336,8 @@ const Pref* PREF_CHECKSUM = makePref("checksum");
|
|||
const Pref* PREF_STOP_WITH_PROCESS = makePref("stop-with-process");
|
||||
// value: true | false
|
||||
const Pref* PREF_ENABLE_MMAP = makePref("enable-mmap");
|
||||
// value: true | false
|
||||
const Pref* PREF_FORCE_SAVE = makePref("force-save");
|
||||
|
||||
/**
|
||||
* FTP related preferences
|
||||
|
|
|
@ -279,6 +279,8 @@ extern const Pref* PREF_CHECKSUM;
|
|||
extern const Pref* PREF_STOP_WITH_PROCESS;
|
||||
// value: true | false
|
||||
extern const Pref* PREF_ENABLE_MMAP;
|
||||
// value: true | false
|
||||
extern const Pref* PREF_FORCE_SAVE;
|
||||
|
||||
/**
|
||||
* FTP related preferences
|
||||
|
|
|
@ -909,3 +909,8 @@
|
|||
" downloads added by aria2.addTorrent or\n" \
|
||||
" aria2.addMetalink will not be saved by\n" \
|
||||
" --save-session option.")
|
||||
#define TEXT_FORCE_SAVE \
|
||||
_(" --force-save[=true|false] Save download with --save-session option even\n" \
|
||||
" if the download is completed or removed. This\n" \
|
||||
" may be useful to save BitTorrent seeding which\n" \
|
||||
" is recognized as completed state.")
|
||||
|
|
Loading…
Reference in New Issue