Merge branch 'SSSSeb-seed'

pull/709/head
Tatsuhiro Tsujikawa 2016-07-18 17:42:11 +09:00
commit 1ab2b99692
5 changed files with 9 additions and 7 deletions

View File

@ -939,7 +939,8 @@ BitTorrent Specific Options
.. option:: --seed-time=<MINUTES> .. option:: --seed-time=<MINUTES>
Specify seeding time in minutes. Also see the :option:`--seed-ratio` option. Specify seeding time in (fractional) minutes. Also see the
:option:`--seed-ratio` option.
.. note:: .. note::

View File

@ -157,8 +157,9 @@ void BtSetup::setup(std::vector<std::unique_ptr<Command>>& commands,
if (!metadataGetMode) { if (!metadataGetMode) {
auto unionCri = make_unique<UnionSeedCriteria>(); auto unionCri = make_unique<UnionSeedCriteria>();
if (option->defined(PREF_SEED_TIME)) { if (option->defined(PREF_SEED_TIME)) {
unionCri->addSeedCriteria(make_unique<TimeSeedCriteria>( unionCri->addSeedCriteria(
std::chrono::seconds(option->getAsInt(PREF_SEED_TIME) * 60))); make_unique<TimeSeedCriteria>(std::chrono::seconds(
static_cast<int>(option->getAsDouble(PREF_SEED_TIME) * 60))));
} }
{ {
double ratio = option->getAsDouble(PREF_SEED_RATIO); double ratio = option->getAsDouble(PREF_SEED_RATIO);

View File

@ -1799,7 +1799,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
handlers.push_back(op); handlers.push_back(op);
} }
{ {
OptionHandler* op(new NumberOptionHandler(PREF_SEED_TIME, TEXT_SEED_TIME, OptionHandler* op(new FloatNumberOptionHandler(PREF_SEED_TIME, TEXT_SEED_TIME,
NO_DEFAULT_VALUE, 0)); NO_DEFAULT_VALUE, 0));
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);

View File

@ -420,7 +420,7 @@ extern PrefPtr PREF_LISTEN_PORT;
extern PrefPtr PREF_FOLLOW_TORRENT; extern PrefPtr PREF_FOLLOW_TORRENT;
// values: 1*digit *( (,|-) 1*digit) // values: 1*digit *( (,|-) 1*digit)
extern PrefPtr PREF_SELECT_FILE; extern PrefPtr PREF_SELECT_FILE;
// values: 1*digit // values: 1*digit ['.' [ 1*digit ] ]
extern PrefPtr PREF_SEED_TIME; extern PrefPtr PREF_SEED_TIME;
// values: 1*digit ['.' [ 1*digit ] ] // values: 1*digit ['.' [ 1*digit ] ]
extern PrefPtr PREF_SEED_RATIO; extern PrefPtr PREF_SEED_RATIO;

View File

@ -313,8 +313,8 @@
" To limit the overall upload speed, use\n" \ " To limit the overall upload speed, use\n" \
" --max-overall-upload-limit option.") " --max-overall-upload-limit option.")
#define TEXT_SEED_TIME \ #define TEXT_SEED_TIME \
_(" --seed-time=MINUTES Specify seeding time in minutes. Also see the\n" \ _(" --seed-time=MINUTES Specify seeding time in (fractional) minutes.\n" \
" --seed-ratio option.") " Also see the --seed-ratio option.")
#define TEXT_SEED_RATIO \ #define TEXT_SEED_RATIO \
_(" --seed-ratio=RATIO Specify share ratio. Seed completed torrents\n" \ _(" --seed-ratio=RATIO Specify share ratio. Seed completed torrents\n" \
" until share ratio reaches RATIO.\n" \ " until share ratio reaches RATIO.\n" \