mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Group setting torrents download limit
This commit is contained in:
parent
cf55751fbe
commit
902db2b938
5 changed files with 40 additions and 33 deletions
|
@ -95,9 +95,9 @@ QMap<QString, QMap<QString, WebApplication::Action> > WebApplication::initialize
|
|||
ADD_ACTION(command, setGlobalUpLimit);
|
||||
ADD_ACTION(command, setGlobalDlLimit);
|
||||
ADD_ACTION(command, getTorrentsUpLimit);
|
||||
ADD_ACTION(command, getTorrentDlLimit);
|
||||
ADD_ACTION(command, getTorrentsDlLimit);
|
||||
ADD_ACTION(command, setTorrentsUpLimit);
|
||||
ADD_ACTION(command, setTorrentDlLimit);
|
||||
ADD_ACTION(command, setTorrentsDlLimit);
|
||||
ADD_ACTION(command, alternativeSpeedLimitsEnabled);
|
||||
ADD_ACTION(command, toggleAlternativeSpeedLimits);
|
||||
ADD_ACTION(command, toggleSequentialDownload);
|
||||
|
@ -462,15 +462,12 @@ void WebApplication::action_command_getTorrentsUpLimit()
|
|||
print(btjson::getTorrentsRatesLimits(hashes, false), Http::CONTENT_TYPE_JS);
|
||||
}
|
||||
|
||||
void WebApplication::action_command_getTorrentDlLimit()
|
||||
void WebApplication::action_command_getTorrentsDlLimit()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
CHECK_PARAMETERS("hash");
|
||||
QString hash = request().posts["hash"];
|
||||
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
|
||||
|
||||
if (h.is_valid())
|
||||
print(QByteArray::number(h.download_limit()));
|
||||
CHECK_PARAMETERS("hashes");
|
||||
QStringList hashes = request().posts["hashes"].split("|");
|
||||
print(btjson::getTorrentsRatesLimits(hashes, true), Http::CONTENT_TYPE_JS);
|
||||
}
|
||||
|
||||
void WebApplication::action_command_setTorrentsUpLimit()
|
||||
|
@ -490,17 +487,21 @@ void WebApplication::action_command_setTorrentsUpLimit()
|
|||
}
|
||||
}
|
||||
|
||||
void WebApplication::action_command_setTorrentDlLimit()
|
||||
void WebApplication::action_command_setTorrentsDlLimit()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
CHECK_PARAMETERS("hash" << "limit");
|
||||
QString hash = request().posts["hash"];
|
||||
qlonglong limit = request().posts["limit"].toLongLong();
|
||||
if (limit == 0) limit = -1;
|
||||
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
|
||||
CHECK_PARAMETERS("hashes" << "limit");
|
||||
|
||||
if (h.is_valid())
|
||||
qlonglong limit = request().posts["limit"].toLongLong();
|
||||
if (limit == 0)
|
||||
limit = -1;
|
||||
|
||||
QStringList hashes = request().posts["hashes"].split("|");
|
||||
foreach (const QString &hash, hashes) {
|
||||
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
|
||||
if (h.is_valid())
|
||||
h.set_download_limit(limit);
|
||||
}
|
||||
}
|
||||
|
||||
void WebApplication::action_command_toggleAlternativeSpeedLimits()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue