mirror of
https://github.com/transmission/transmission
synced 2025-01-03 05:25:52 +00:00
(trunk rpc) add "seed ratio" feature to RPC
This commit is contained in:
parent
adc5bec662
commit
d2d507725b
4 changed files with 45 additions and 1 deletions
|
@ -107,6 +107,8 @@
|
||||||
"priority-high" | array indices of high-priority file(s)
|
"priority-high" | array indices of high-priority file(s)
|
||||||
"priority-low" | array indices of low-priority file(s)
|
"priority-low" | array indices of low-priority file(s)
|
||||||
"priority-normal" | array indices of normal-priority file(s)
|
"priority-normal" | array indices of normal-priority file(s)
|
||||||
|
"seedRatioLimit" | 'double' session seeding ratio
|
||||||
|
"seedRatioLimited" | 'boolean' true if "seedRatioLimit" is honored
|
||||||
"uploadLimit" | number maximum upload speed (in K/s)
|
"uploadLimit" | number maximum upload speed (in K/s)
|
||||||
"uploadLimited" | 'boolean' true if "uploadLimit" is honored
|
"uploadLimited" | 'boolean' true if "uploadLimit" is honored
|
||||||
|
|
||||||
|
@ -184,6 +186,8 @@
|
||||||
scrapeResponse | string | tr_stat
|
scrapeResponse | string | tr_stat
|
||||||
scrapeURL | string | tr_stat
|
scrapeURL | string | tr_stat
|
||||||
seeders | number | tr_stat
|
seeders | number | tr_stat
|
||||||
|
seedRatioLimit | 'double' | tr_torrent
|
||||||
|
seedRatioMode | number | tr_ratiolimit
|
||||||
sizeWhenDone | number | tr_stat
|
sizeWhenDone | number | tr_stat
|
||||||
startDate | number | tr_stat
|
startDate | number | tr_stat
|
||||||
status | number | tr_stat
|
status | number | tr_stat
|
||||||
|
@ -438,7 +442,9 @@
|
||||||
| | yes | torrent-set | new arg "ratio"
|
| | yes | torrent-set | new arg "ratio"
|
||||||
| | yes | torrent-set | new arg "downloadLimited"
|
| | yes | torrent-set | new arg "downloadLimited"
|
||||||
| | yes | torrent-set | new arg "uploadLimited"
|
| | yes | torrent-set | new arg "uploadLimited"
|
||||||
| | yes | torrent-set | new arg "honorsSessionLImits"
|
| | yes | torrent-set | new arg "honorsSessionLimits"
|
||||||
|
| | yes | session-get | new arg "seedRatioLimit"
|
||||||
|
| | yes | session-get | new arg "seedRatioLimited"
|
||||||
| | yes | session-get | new arg "alt-speed-enabled"
|
| | yes | session-get | new arg "alt-speed-enabled"
|
||||||
| | yes | session-get | new arg "alt-speed-time-enabled"
|
| | yes | session-get | new arg "alt-speed-time-enabled"
|
||||||
| | yes | session-get | new arg "alt-speed-up"
|
| | yes | session-get | new arg "alt-speed-up"
|
||||||
|
@ -448,6 +454,8 @@
|
||||||
| | yes | session-get | new arg "blocklist-enabled"
|
| | yes | session-get | new arg "blocklist-enabled"
|
||||||
| | yes | session-get | new arg "blocklist-size"
|
| | yes | session-get | new arg "blocklist-size"
|
||||||
| | yes | session-get | new arg "peer-limit-per-torrent"
|
| | yes | session-get | new arg "peer-limit-per-torrent"
|
||||||
|
| | yes | torrent-get | new arg "seedRatioLimit"
|
||||||
|
| | yes | torrent-get | new arg "seedRatioMode"
|
||||||
| | yes | torrent-get | new ids option "recently-active"
|
| | yes | torrent-get | new ids option "recently-active"
|
||||||
| | yes | | new method "torrent-reannounce"
|
| | yes | | new method "torrent-reannounce"
|
||||||
| | NO | torrent-get | removed arg "downloadLimitMode"
|
| | NO | torrent-get | removed arg "downloadLimitMode"
|
||||||
|
|
|
@ -445,6 +445,15 @@ tr_bencDictFindInt( tr_benc * dict, const char * key, int64_t * setme )
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_bool
|
||||||
|
tr_bencDictFindBool( tr_benc * dict, const char * key, tr_bool * setme )
|
||||||
|
{
|
||||||
|
int64_t i = 0;
|
||||||
|
const tr_bool found = tr_bencDictFindInt( dict, key, &i );
|
||||||
|
*setme = i!=0;
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
tr_bool
|
tr_bool
|
||||||
tr_bencDictFindDouble( tr_benc * dict, const char * key, double * setme )
|
tr_bencDictFindDouble( tr_benc * dict, const char * key, double * setme )
|
||||||
{
|
{
|
||||||
|
@ -699,6 +708,14 @@ tr_bencDictAddInt( tr_benc * dict,
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_benc*
|
||||||
|
tr_bencDictAddBool( tr_benc * dict, const char * key, tr_bool val )
|
||||||
|
{
|
||||||
|
assert( tr_isBool( val ) );
|
||||||
|
|
||||||
|
return tr_bencDictAddInt( dict, key, val );
|
||||||
|
}
|
||||||
|
|
||||||
tr_benc*
|
tr_benc*
|
||||||
tr_bencDictAddStr( tr_benc * dict, const char * key, const char * val )
|
tr_bencDictAddStr( tr_benc * dict, const char * key, const char * val )
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,6 +130,8 @@ tr_benc * tr_bencDictAddDouble( tr_benc *, const char * key, double );
|
||||||
|
|
||||||
tr_benc * tr_bencDictAddInt( tr_benc *, const char * key, int64_t );
|
tr_benc * tr_bencDictAddInt( tr_benc *, const char * key, int64_t );
|
||||||
|
|
||||||
|
tr_benc * tr_bencDictAddBool( tr_benc *, const char * key, tr_bool );
|
||||||
|
|
||||||
tr_benc * tr_bencDictAddStr( tr_benc *, const char * key, const char * );
|
tr_benc * tr_bencDictAddStr( tr_benc *, const char * key, const char * );
|
||||||
|
|
||||||
tr_benc * tr_bencDictAddList( tr_benc *, const char * key, size_t reserve );
|
tr_benc * tr_bencDictAddList( tr_benc *, const char * key, size_t reserve );
|
||||||
|
@ -149,6 +151,8 @@ tr_bool tr_bencDictFindInt( tr_benc *, const char * key, int64_t * setme );
|
||||||
|
|
||||||
tr_bool tr_bencDictFindDouble( tr_benc *, const char * key, double * setme );
|
tr_bool tr_bencDictFindDouble( tr_benc *, const char * key, double * setme );
|
||||||
|
|
||||||
|
tr_bool tr_bencDictFindBool( tr_benc *, const char * key, tr_bool * setme );
|
||||||
|
|
||||||
tr_bool tr_bencDictFindStr( tr_benc *, const char * key, const char ** setme );
|
tr_bool tr_bencDictFindStr( tr_benc *, const char * key, const char ** setme );
|
||||||
|
|
||||||
tr_bool tr_bencDictFindRaw( tr_benc *, const char * key,
|
tr_bool tr_bencDictFindRaw( tr_benc *, const char * key,
|
||||||
|
|
|
@ -500,6 +500,10 @@ addField( const tr_torrent * tor,
|
||||||
tr_bencDictAddStr( d, key, st->scrapeURL );
|
tr_bencDictAddStr( d, key, st->scrapeURL );
|
||||||
else if( !strcmp( key, "seeders" ) )
|
else if( !strcmp( key, "seeders" ) )
|
||||||
tr_bencDictAddInt( d, key, st->seeders );
|
tr_bencDictAddInt( d, key, st->seeders );
|
||||||
|
else if( !strcmp( key, "seedRatioLimit" ) )
|
||||||
|
tr_bencDictAddDouble( d, key, tr_torrentGetRatioLimit( tor ) );
|
||||||
|
else if( !strcmp( key, "seedRatioMode" ) )
|
||||||
|
tr_bencDictAddInt( d, key, tr_torrentGetRatioMode( tor ) );
|
||||||
else if( !strcmp( key, "sizeWhenDone" ) )
|
else if( !strcmp( key, "sizeWhenDone" ) )
|
||||||
tr_bencDictAddInt( d, key, st->sizeWhenDone );
|
tr_bencDictAddInt( d, key, st->sizeWhenDone );
|
||||||
else if( !strcmp( key, "startDate" ) )
|
else if( !strcmp( key, "startDate" ) )
|
||||||
|
@ -699,6 +703,10 @@ torrentSet( tr_session * session,
|
||||||
tr_torrentSetRatioLimit( tor, d );
|
tr_torrentSetRatioLimit( tor, d );
|
||||||
if( tr_bencDictFindInt( args_in, "ratio-limit-mode", &tmp ) )
|
if( tr_bencDictFindInt( args_in, "ratio-limit-mode", &tmp ) )
|
||||||
tr_torrentSetRatioMode( tor, tmp );
|
tr_torrentSetRatioMode( tor, tmp );
|
||||||
|
if( tr_bencDictFindDouble( args_in, "seedRatioLimit", &d ) )
|
||||||
|
tr_torrentSetRatioLimit( tor, d );
|
||||||
|
if( tr_bencDictFindInt( args_in, "seedRatioMode", &tmp ) )
|
||||||
|
tr_torrentSetRatioMode( tor, tmp );
|
||||||
notify( session, TR_RPC_TORRENT_CHANGED, tor );
|
notify( session, TR_RPC_TORRENT_CHANGED, tor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,6 +862,7 @@ sessionSet( tr_session * session,
|
||||||
tr_benc * args_out UNUSED,
|
tr_benc * args_out UNUSED,
|
||||||
struct tr_rpc_idle_data * idle_data )
|
struct tr_rpc_idle_data * idle_data )
|
||||||
{
|
{
|
||||||
|
tr_bool b;
|
||||||
int64_t i;
|
int64_t i;
|
||||||
double d;
|
double d;
|
||||||
const char * str;
|
const char * str;
|
||||||
|
@ -886,6 +895,10 @@ sessionSet( tr_session * session,
|
||||||
tr_sessionSetPeerPort( session, i );
|
tr_sessionSetPeerPort( session, i );
|
||||||
if( tr_bencDictFindInt( args_in, TR_PREFS_KEY_PORT_FORWARDING, &i ) )
|
if( tr_bencDictFindInt( args_in, TR_PREFS_KEY_PORT_FORWARDING, &i ) )
|
||||||
tr_sessionSetPortForwardingEnabled( session, i );
|
tr_sessionSetPortForwardingEnabled( session, i );
|
||||||
|
if( tr_bencDictFindDouble( args_in, "seedRatioLimit", &d ) )
|
||||||
|
tr_sessionSetRatioLimit( session, d );
|
||||||
|
if( tr_bencDictFindBool( args_in, "seedRatioLimited", &b ) )
|
||||||
|
tr_sessionSetRatioLimited( session, b );
|
||||||
if( tr_bencDictFindInt( args_in, "speed-limit-down", &i ) )
|
if( tr_bencDictFindInt( args_in, "speed-limit-down", &i ) )
|
||||||
tr_sessionSetSpeedLimit( session, TR_DOWN, i );
|
tr_sessionSetSpeedLimit( session, TR_DOWN, i );
|
||||||
if( tr_bencDictFindInt( args_in, "speed-limit-down-enabled", &i ) )
|
if( tr_bencDictFindInt( args_in, "speed-limit-down-enabled", &i ) )
|
||||||
|
@ -986,6 +999,8 @@ sessionGet( tr_session * s,
|
||||||
tr_bencDictAddInt( d, TR_PREFS_KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) );
|
tr_bencDictAddInt( d, TR_PREFS_KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) );
|
||||||
tr_bencDictAddInt( d, "rpc-version", 4 );
|
tr_bencDictAddInt( d, "rpc-version", 4 );
|
||||||
tr_bencDictAddInt( d, "rpc-version-minimum", 1 );
|
tr_bencDictAddInt( d, "rpc-version-minimum", 1 );
|
||||||
|
tr_bencDictAddDouble( d, "seedRatioLimit", tr_sessionGetRatioLimit( s ) );
|
||||||
|
tr_bencDictAddBool( d, "seedRatioLimited", tr_sessionIsRatioLimited( s ) );
|
||||||
tr_bencDictAddInt( d, "speed-limit-up", tr_sessionGetSpeedLimit( s, TR_UP ) );
|
tr_bencDictAddInt( d, "speed-limit-up", tr_sessionGetSpeedLimit( s, TR_UP ) );
|
||||||
tr_bencDictAddInt( d, "speed-limit-up-enabled", tr_sessionIsSpeedLimited( s, TR_UP ) );
|
tr_bencDictAddInt( d, "speed-limit-up-enabled", tr_sessionIsSpeedLimited( s, TR_UP ) );
|
||||||
tr_bencDictAddInt( d, "speed-limit-down", tr_sessionGetSpeedLimit( s, TR_DOWN ) );
|
tr_bencDictAddInt( d, "speed-limit-down", tr_sessionGetSpeedLimit( s, TR_DOWN ) );
|
||||||
|
|
Loading…
Reference in a new issue