Ticket #671: ratioLimitRPC.patch

File ratioLimitRPC.patch, 3.0 KB (added by journey4712, 13 years ago)

rpc calls to go with ratio limit patch

  • libtransmission/rpc.c

     
    334334        tr_bencDictAddInt( d, key, (int)(st->rateDownload*1024) );
    335335    else if( !strcmp( key, "rateUpload" ) )
    336336        tr_bencDictAddInt( d, key, (int)(st->rateUpload*1024) );
     337    else if( !strcmp( key, "ratioLimit" ) )
     338        tr_bencDictAddDouble( d, key, tr_torrentGetRatioLimit( tor )  );
     339    else if( !strcmp( key, "ratioLimitMode" ) )
     340        tr_bencDictAddInt( d, key, tr_torrentGetRatioLimitActive( tor ) );
    337341    else if( !strcmp( key, "recheckProgress" ) )
    338342        tr_bencDictAddDouble( d, key, st->recheckProgress );
    339343    else if( !strcmp( key, "scrapeResponse" ) )
     
    479483    for( i=0; i<torrentCount; ++i )
    480484    {
    481485        int64_t tmp;
     486        double ratio;
    482487        tr_benc * files;
    483488        tr_torrent * tor = torrents[i];
    484489
     
    494499            setFilePriorities( tor, TR_PRI_LOW, files );
    495500        if( tr_bencDictFindList( args_in, "priority-normal", &files ) )
    496501            setFilePriorities( tor, TR_PRI_NORMAL, files );
     502        if( tr_bencDictFindInt( args_in, "ratio-limit-enabled", &tmp ) )
     503            tr_torrentSetRatioLimitActive( tor, tmp );
     504        if( tr_bencDictFindDouble( args_in, "ratio-limit", &ratio ) ) 
     505            tr_torrentSetRatioLimit( tor, ratio );
    497506        if( tr_bencDictFindInt( args_in, "speed-limit-down", &tmp ) )
    498507            tr_torrentSetSpeedLimit( tor, TR_DOWN, tmp );
    499508        if( tr_bencDictFindInt( args_in, "speed-limit-down-enabled", &tmp ) )
  • doc/rpc-spec.txt

     
    8989   "priority-high"            | array      indices of high-priority file(s)
    9090   "priority-low"             | array      indices of low-priority file(s)
    9191   "priority-normal"          | array      indices of normal-priority file(s)
     92   "ratio-limit-enable"       | 'boolean'  true if seeding is ratio limited
     93   "ratio-limit"              | double     seed until ratio
    9294   "speed-limit-down"         | number     maximum download speed (in K/s)
    9395   "speed-limit-down-enabled" | 'boolean'  true if the download speed is limited
    9496   "speed-limit-up"           | number     maximum upload speed (in K/s)
     
    158160   priorities             | array (see below)                    | n/a
    159161   rateDownload (B/s)     | number                               | tr_stat
    160162   rateUpload (B/s)       | number                               | tr_stat
     163   ratioLimit             | double                               | tr_torrent
     164   ratioLimitMode         | number                               | tr_torrent
    161165   recheckProgress        | number                               | tr_stat
    162166   scrapeResponse         | string                               | tr_stat
    163167   scrapeURL              | string                               | tr_stat