Add --save-not-found option

pull/735/head
Nils Maier 2016-08-29 16:20:56 +02:00
parent 852e2db586
commit 414dd14dec
7 changed files with 32 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -1348,6 +1348,13 @@ Advanced Options
BitTorrent seeding which is recognized as completed state.
Default: ``false``
.. option:: --save-not-found[=true|false]
Save download with :option:`--save-session <--save-session>` option
even if the file was not found on the server. This option also saves
control file in that situations.
Default: ``true``
.. option:: --gid=<GID>
Set GID manually. aria2 identifies each download by the ID called

View File

@ -343,6 +343,17 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
op->setChangeOptionForReserved(true);
handlers.push_back(op);
}
{
OptionHandler* op(new BooleanOptionHandler(
PREF_SAVE_NOT_FOUND, TEXT_SAVE_NOT_FOUND, A2_V_TRUE,
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, TEXT_FORCE_SEQUENTIAL,

View File

@ -286,6 +286,10 @@ bool SessionSerializer::save(IOFile& fp) const
case error_code::IN_PROGRESS:
save = saveInProgress_;
break;
case error_code::RESOURCE_NOT_FOUND:
case error_code::MAX_FILE_NOT_FOUND:
save = saveError_ && dr->option->getAsBool(PREF_SAVE_NOT_FOUND);
break;
default:
save = saveError_;
break;

View File

@ -349,6 +349,8 @@ PrefPtr PREF_STOP_WITH_PROCESS = makePref("stop-with-process");
PrefPtr PREF_ENABLE_MMAP = makePref("enable-mmap");
// value: true | false
PrefPtr PREF_FORCE_SAVE = makePref("force-save");
// value: true | false
PrefPtr PREF_SAVE_NOT_FOUND = makePref("save-not-found");
// value: 1*digit
PrefPtr PREF_DISK_CACHE = makePref("disk-cache");
// value: string

View File

@ -302,6 +302,8 @@ extern PrefPtr PREF_STOP_WITH_PROCESS;
extern PrefPtr PREF_ENABLE_MMAP;
// value: true | false
extern PrefPtr PREF_FORCE_SAVE;
// value: true | false
extern PrefPtr PREF_SAVE_NOT_FOUND;
// value: 1*digit
extern PrefPtr PREF_DISK_CACHE;
// value: string

View File

@ -971,6 +971,11 @@
" situations. This may be useful to save\n" \
" BitTorrent seeding which is recognized as\n" \
" completed state.")
#define TEXT_SAVE_NOT_FOUND \
_(" --save-not-found[=true|false] Save download with --save-session option even\n" \
" if the file was not found on the server. This\n" \
" option also saves control file in that\n" \
" situations.")
#define TEXT_DISK_CACHE \
_(" --disk-cache=SIZE Enable disk cache. If SIZE is 0, the disk cache\n" \
" is disabled. This feature caches the downloaded\n" \