Changeset 9420


Ignore:
Timestamp:
Oct 27, 2009, 9:30:00 PM (13 years ago)
Author:
charles
Message:

(trunk daemon) #2155: transmission-remote should allow per-torrent speeds

Location:
trunk/daemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/remote.c

    r9331 r9420  
    6363static tr_option opts[] =
    6464{
    65     { 'a', "add",                  "Add torrent files by filename or URL", "a",  0, NULL },
    66     { 970, "alt-speed",            "Use the alternate Limits", "as",  0, NULL },
    67     { 971, "no-alt-speed",         "Don't use the alternate Limits", "AS",  0, NULL },
    68     { 972, "alt-speed-downlimit",  "max alternate download speed (in KB/s)", "asd",  1, "<speed>" },
    69     { 973, "alt-speed-uplimit",    "max alternate upload speed (in KB/s)", "asu",  1, "<speed>" },
    70     { 974, "alt-speed-scheduler",  "Use the scheduled on/off times", "asc",  0, NULL },
     65    { 'a', "add",                   "Add torrent files by filename or URL", "a",  0, NULL },
     66    { 970, "alt-speed",             "Use the alternate Limits", "as",  0, NULL },
     67    { 971, "no-alt-speed",          "Don't use the alternate Limits", "AS",  0, NULL },
     68    { 972, "alt-speed-downlimit",   "max alternate download speed (in KB/s)", "asd",  1, "<speed>" },
     69    { 973, "alt-speed-uplimit",     "max alternate upload speed (in KB/s)", "asu",  1, "<speed>" },
     70    { 974, "alt-speed-scheduler",   "Use the scheduled on/off times", "asc",  0, NULL },
    7171    { 975, "no-alt-speed-scheduler","Don't use the scheduled on/off times", "ASC",  0, NULL },
    72     { 976, "alt-speed-time-begin", "Time to start using the alt speed limits (in hhmm)", NULL,  1, "<time>" },
    73     { 977, "alt-speed-time-end",   "Time to stop using the alt speed limits (in hhmm)", NULL,  1, "<time>" },
    74     { 978, "alt-speed-days",       "Numbers for any/all days of the week - eg. \"1-7\"", NULL,  1, "<days>" },
    75     { 'c', "incomplete-dir",       "Where to store new torrents until they're complete", "c", 1, "<dir>" },
    76     { 'C', "no-incomplete-dir",    "Don't store incomplete torrents in a different location", "C", 0, NULL },
    77     { 'b', "debug",                "Print debugging information", "b",  0, NULL },
    78     { 'd', "downlimit",            "Set the maximum global download speed in KB/s", "d",  1, "<speed>" },
    79     { 'D', "no-downlimit",         "Don't limit the global download speed", "D",  0, NULL },
    80     { 910, "encryption-required",  "Encrypt all peer connections", "er", 0, NULL },
    81     { 911, "encryption-preferred", "Prefer encrypted peer connections", "ep", 0, NULL },
    82     { 912, "encryption-tolerated", "Prefer unencrypted peer connections", "et", 0, NULL },
    83     { 'f', "files",                "List the current torrent(s)' files", "f",  0, NULL },
    84     { 'g', "get",                  "Mark files for download", "g",  1, "<files>" },
    85     { 'G', "no-get",               "Mark files for not downloading", "G",  1, "<files>" },
    86     { 'i', "info",                 "Show the current torrent(s)' details", "i",  0, NULL },
    87     { 920, "session-info",         "Show the session's details", "si", 0, NULL },
    88     { 921, "session-stats",        "Show the session's statistics", "st", 0, NULL },
    89     { 'l', "list",                 "List all torrents", "l",  0, NULL },
    90     { 960, "move",                 "Move current torrent's data to a new folder", NULL, 1, "<path>" },
    91     { 961, "find",                 "Tell Transmission where to find a torrent's data", NULL, 1, "<path>" },
    92     { 'm', "portmap",              "Enable portmapping via NAT-PMP or UPnP", "m",  0, NULL },
    93     { 'M', "no-portmap",           "Disable portmapping", "M",  0, NULL },
    94     { 'n', "auth",                 "Set authentication info", "n",  1, "<username:password>" },
    95     { 'N', "netrc",                "Set authentication info from a .netrc file", "N",  1, "<filename>" },
    96     { 'o', "dht",                  "Enable distributed hash tables (DHT)", "o", 0, NULL },
    97     { 'O', "no-dht",               "Disable distributed hash tables (DHT)", "O", 0, NULL },
    98     { 'p', "port",                 "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "<port>" },
    99     { 'P', "random-port",          "Random port for incomping peers", "P", 0, NULL },
    100     { 900, "priority-high",        "Set the files' priorities as high", "ph", 1, "<files>" },
    101     { 901, "priority-normal",      "Set the files' priorities as normal", "pn", 1, "<files>" },
    102     { 902, "priority-low",         "Set the files' priorities as low", "pl", 1, "<files>" },
    103     { 'r', "remove",               "Remove the current torrent(s)", "r",  0, NULL },
    104     { 930, "peers",                "Set the current torrent(s)' maximum number of peers each", "pr", 1, "<max>" },
    105     { 931, "global-peers",         "Set the global maximum number of peers", "gpr", 1, "<max>" },
    106     { 'R', "remove-and-delete",    "Remove the current torrent(s) and delete local data", NULL, 0, NULL },
    107     { 950, "seedratio",            "Let the current torrent(s) seed until a specific ratio", "sr", 1, "ratio" },
    108     { 951, "seedratio-default",    "Let the current torrent(s) use the global seedratio settings", "srd", 0, NULL },
    109     { 952, "no-seedratio",         "Let the current torrent(s) seed regardless of ratio", "SR", 0, NULL },
    110     { 953, "global-seedratio",     "All torrents, unless overridden by a per-torrent setting, should seed until a specific ratio", "gsr", 1, "ratio" },
    111     { 954, "no-global-seedratio",  "All torrents, unless overridden by a per-torrent setting, should seed regardless of ratio", "GSR", 0, NULL },
    112     { 's', "start",                "Start the current torrent(s)", "s",  0, NULL },
    113     { 'S', "stop",                 "Stop the current torrent(s)", "S",  0, NULL },
    114     { 't', "torrent",              "Set the current torrent(s)", "t",  1, "<torrent>" },
    115     { 'u', "uplimit",              "Set the maximum global upload speed in KB/s", "u",  1, "<speed>" },
    116     { 'U', "no-uplimit",           "Don't limit the global upload speed", "U",  0, NULL },
    117     { 'v', "verify",               "Verify the current torrent(s)", "v",  0, NULL },
    118     { 'V', "version",              "Show version number and exit", "V", 0, NULL },
    119     { 'w', "download-dir",         "Set the default download folder", "w",  1, "<path>" },
    120     { 'x', "pex",                  "Enable peer exchange (PEX)", "x",  0, NULL },
    121     { 'X', "no-pex",               "Disable peer exchange (PEX)", "X",  0, NULL },
    122     { 940, "peer-info",            "List the current torrent(s)' peers", "pi",  0, NULL },
    123     {   0, NULL,                   NULL, NULL, 0, NULL }
     72    { 976, "alt-speed-time-begin",  "Time to start using the alt speed limits (in hhmm)", NULL,  1, "<time>" },
     73    { 977, "alt-speed-time-end",    "Time to stop using the alt speed limits (in hhmm)", NULL,  1, "<time>" },
     74    { 978, "alt-speed-days",        "Numbers for any/all days of the week - eg. \"1-7\"", NULL,  1, "<days>" },
     75    { 'c', "incomplete-dir",        "Where to store new torrents until they're complete", "c", 1, "<dir>" },
     76    { 'C', "no-incomplete-dir",     "Don't store incomplete torrents in a different location", "C", 0, NULL },
     77    { 'b', "debug",                 "Print debugging information", "b",  0, NULL },
     78    { 'd', "downlimit",             "Set the maximum global download speed in KB/s", "d",  1, "<speed>" },
     79    { 'D', "no-downlimit",          "Don't limit the global download speed", "D",  0, NULL },
     80    { 910, "encryption-required",   "Encrypt all peer connections", "er", 0, NULL },
     81    { 911, "encryption-preferred",  "Prefer encrypted peer connections", "ep", 0, NULL },
     82    { 912, "encryption-tolerated",  "Prefer unencrypted peer connections", "et", 0, NULL },
     83    { 'f', "files",                 "List the current torrent(s)' files", "f",  0, NULL },
     84    { 'g', "get",                   "Mark files for download", "g",  1, "<files>" },
     85    { 'G', "no-get",                "Mark files for not downloading", "G",  1, "<files>" },
     86    { 'i', "info",                  "Show the current torrent(s)' details", "i",  0, NULL },
     87    { 920, "session-info",          "Show the session's details", "si", 0, NULL },
     88    { 921, "session-stats",         "Show the session's statistics", "st", 0, NULL },
     89    { 'l', "list",                  "List all torrents", "l",  0, NULL },
     90    { 960, "move",                  "Move current torrent's data to a new folder", NULL, 1, "<path>" },
     91    { 961, "find",                  "Tell Transmission where to find a torrent's data", NULL, 1, "<path>" },
     92    { 'm', "portmap",               "Enable portmapping via NAT-PMP or UPnP", "m",  0, NULL },
     93    { 'M', "no-portmap",            "Disable portmapping", "M",  0, NULL },
     94    { 'n', "auth",                  "Set authentication info", "n",  1, "<username:password>" },
     95    { 'N', "netrc",                 "Set authentication info from a .netrc file", "N",  1, "<filename>" },
     96    { 'o', "dht",                   "Enable distributed hash tables (DHT)", "o", 0, NULL },
     97    { 'O', "no-dht",                "Disable distributed hash tables (DHT)", "O", 0, NULL },
     98    { 'p', "port",                  "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "<port>" },
     99    { 'P', "random-port",           "Random port for incomping peers", "P", 0, NULL },
     100    { 900, "priority-high",         "Set the files' priorities as high", "ph", 1, "<files>" },
     101    { 901, "priority-normal",       "Set the files' priorities as normal", "pn", 1, "<files>" },
     102    { 902, "priority-low",          "Set the files' priorities as low", "pl", 1, "<files>" },
     103    { 'r', "remove",                "Remove the current torrent(s)", "r",  0, NULL },
     104    { 930, "peers",                 "Set the current torrent(s)' maximum number of peers each", "pr", 1, "<max>" },
     105    { 931, "global-peers",          "Set the global maximum number of peers", "gpr", 1, "<max>" },
     106    { 'R', "remove-and-delete",     "Remove the current torrent(s) and delete local data", NULL, 0, NULL },
     107    { 950, "seedratio",             "Let the current torrent(s) seed until a specific ratio", "sr", 1, "ratio" },
     108    { 951, "seedratio-default",     "Let the current torrent(s) use the global seedratio settings", "srd", 0, NULL },
     109    { 952, "no-seedratio",          "Let the current torrent(s) seed regardless of ratio", "SR", 0, NULL },
     110    { 953, "global-seedratio",      "All torrents, unless overridden by a per-torrent setting, should seed until a specific ratio", "gsr", 1, "ratio" },
     111    { 954, "no-global-seedratio",   "All torrents, unless overridden by a per-torrent setting, should seed regardless of ratio", "GSR", 0, NULL },
     112    { 's', "start",                 "Start the current torrent(s)", "s",  0, NULL },
     113    { 'S', "stop",                  "Stop the current torrent(s)", "S",  0, NULL },
     114    { 't', "torrent",               "Set the current torrent(s)", "t",  1, "<torrent>" },
     115    { 980, "torrent-downlimit",     "Set the maximum download speed for the current torrent(s) in KB/s", "td",  1, "<speed>" },
     116    { 981, "no-torrent-downlimit",  "Don't limit the download speed for the current torrent(s)", "TD",  0, NULL },
     117    { 982, "torrent-uplimit",       "Set the maximum upload speed for the current torrent(s) in KB/s", "tu",  1, "<speed>" },
     118    { 983, "no-torrent-uplimit",    "Don't limit the upload speed for the current torrent(s)", "TU",  0, NULL },
     119    { 984, "honnor-session",        "Make the current torrent(s) honnor the session limits", "hl",  0, NULL },
     120    { 985, "no-honnor-session",     "Make the current torrent(s) not honnor the session limits", "HL",  0, NULL },
     121    { 'u', "uplimit",               "Set the maximum global upload speed in KB/s", "u",  1, "<speed>" },
     122    { 'U', "no-uplimit",            "Don't limit the global upload speed", "U",  0, NULL },
     123    { 'v', "verify",                "Verify the current torrent(s)", "v",  0, NULL },
     124    { 'V', "version",               "Show version number and exit", "V", 0, NULL },
     125    { 'w', "download-dir",          "Set the default download folder", "w",  1, "<path>" },
     126    { 'x', "pex",                   "Enable peer exchange (PEX)", "x",  0, NULL },
     127    { 'X', "no-pex",                "Disable peer exchange (PEX)", "X",  0, NULL },
     128    { 940, "peer-info",             "List the current torrent(s)' peers", "pi",  0, NULL },
     129    {   0, NULL,                    NULL, NULL, 0, NULL }
    124130};
    125131
     
    316322    "downloadDir",
    317323    "downloadedEver",
     324    "downloadLimit",
     325    "downloadLimited",
    318326    "error",
    319327    "errorString",
     
    322330    "haveUnchecked",
    323331    "haveValid",
     332    "honorsSessionLimits",
    324333    "id",
    325334    "isPrivate",
     
    329338    "peersGettingFromUs",
    330339    "peersSendingToUs",
     340    "peer-limit",
    331341    "pieceCount",
    332342    "pieceSize",
     
    340350    "trackerStats",
    341351    "uploadedEver",
     352    "uploadLimit",
     353    "uploadLimited",
    342354    "pieces",
    343355    "webseeds",
     
    439451                break;
    440452
    441             case 970:
    442                 tr_bencDictAddStr( &top, "method", "session-set" );
    443                 tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_ENABLED, TRUE );
    444                 break;
    445 
    446             case 971:
    447                 tr_bencDictAddStr( &top, "method", "session-set" );
    448                 tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_ENABLED, FALSE );
    449                 break;
    450 
    451             case 972:
    452                 tr_bencDictAddStr( &top, "method", "session-set" );
    453                 tr_bencDictAddInt( args, TR_PREFS_KEY_ALT_SPEED_DOWN, numarg( optarg ) );
    454                 break;
    455 
    456             case 973:
    457                 tr_bencDictAddStr( &top, "method", "session-set" );
    458                 tr_bencDictAddInt( args, TR_PREFS_KEY_ALT_SPEED_UP, numarg( optarg ) );
    459                 break;
    460 
    461             case 974:
    462                 tr_bencDictAddStr( &top, "method", "session-set" );
    463                 tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_TIME_ENABLED, TRUE );
    464                 break;
    465 
    466             case 975:
    467                 tr_bencDictAddStr( &top, "method", "session-set" );
    468                 tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_TIME_ENABLED, FALSE );
    469                 break;
    470 
    471             case 976:
    472                 tr_bencDictAddStr( &top, "method", "session-set" );
    473                 addTime( args, TR_PREFS_KEY_ALT_SPEED_TIME_BEGIN, optarg);
    474                 break;
    475 
    476             case 977:
    477                 tr_bencDictAddStr( &top, "method", "session-set" );
    478                 addTime( args, TR_PREFS_KEY_ALT_SPEED_TIME_END, optarg);
    479                 break;
    480 
    481             case 978:
    482                 tr_bencDictAddStr( &top, "method", "session-set" );
    483                 addDays( args, TR_PREFS_KEY_ALT_SPEED_TIME_DAY, optarg );
    484                 break;
    485 
    486453            case 'f':
    487454                tr_bencDictAddStr( &top, "method", "torrent-get" );
     
    736703                break;
    737704
     705            case 970:
     706                tr_bencDictAddStr( &top, "method", "session-set" );
     707                tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_ENABLED, TRUE );
     708                break;
     709               
     710            case 971:
     711                tr_bencDictAddStr( &top, "method", "session-set" );
     712                tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_ENABLED, FALSE );
     713                break;
     714               
     715            case 972:
     716                tr_bencDictAddStr( &top, "method", "session-set" );
     717                tr_bencDictAddInt( args, TR_PREFS_KEY_ALT_SPEED_DOWN, numarg( optarg ) );
     718                break;
     719               
     720            case 973:
     721                tr_bencDictAddStr( &top, "method", "session-set" );
     722                tr_bencDictAddInt( args, TR_PREFS_KEY_ALT_SPEED_UP, numarg( optarg ) );
     723                break;
     724               
     725            case 974:
     726                tr_bencDictAddStr( &top, "method", "session-set" );
     727                tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_TIME_ENABLED, TRUE );
     728                break;
     729               
     730            case 975:
     731                tr_bencDictAddStr( &top, "method", "session-set" );
     732                tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_TIME_ENABLED, FALSE );
     733                break;
     734               
     735            case 976:
     736                tr_bencDictAddStr( &top, "method", "session-set" );
     737                addTime( args, TR_PREFS_KEY_ALT_SPEED_TIME_BEGIN, optarg);
     738                break;
     739               
     740            case 977:
     741                tr_bencDictAddStr( &top, "method", "session-set" );               
     742                addTime( args, TR_PREFS_KEY_ALT_SPEED_TIME_END, optarg);
     743                break;
     744               
     745            case 978:
     746                tr_bencDictAddStr( &top, "method", "session-set" );
     747                addDays( args, TR_PREFS_KEY_ALT_SPEED_TIME_DAY, optarg );
     748                break;
     749               
     750            case 980:
     751                tr_bencDictAddStr( &top, "method", "torrent-set" );
     752                addIdArg( args, id );
     753                tr_bencDictAddInt( args, "downloadLimit", numarg( optarg ) );
     754                tr_bencDictAddBool( args, "downloadLimited", TRUE );
     755                break;
     756               
     757            case 981:
     758                tr_bencDictAddStr( &top, "method", "torrent-set" );
     759                addIdArg( args, id );
     760                tr_bencDictAddBool( args, "downloadLimited", FALSE );
     761                break;
     762               
     763            case 982:
     764                tr_bencDictAddStr( &top, "method", "torrent-set" );
     765                addIdArg( args, id );
     766                tr_bencDictAddInt( args, "uploadLimit", numarg( optarg ) );
     767                tr_bencDictAddBool( args, "uploadLimited", TRUE );
     768                break;
     769               
     770            case 983:
     771                tr_bencDictAddStr( &top, "method", "torrent-set" );
     772                addIdArg( args, id );
     773                tr_bencDictAddBool( args, "uploadLimited", FALSE );
     774                break;
     775               
     776            case 984:
     777                tr_bencDictAddStr( &top, "method", "torrent-set" );
     778                addIdArg( args, id );
     779                tr_bencDictAddBool( args, "honorsSessionLimits", TRUE );
     780                break;
     781               
     782            case 985:
     783                tr_bencDictAddStr( &top, "method", "torrent-set" );
     784                addIdArg( args, id );
     785                tr_bencDictAddBool( args, "honorsSessionLimits", FALSE );
     786                break;
     787               
    738788            case TR_OPT_ERR:
    739789                fprintf( stderr, "invalid option\n" );
     
    13911441            printf( "\n" );
    13921442
    1393             printf("PIECES\n  ");
     1443            printf( "LIMITS\n" );
     1444            if( tr_bencDictFindBool( t, "downloadLimited", &boolVal )
     1445                && tr_bencDictFindInt( t, "downloadLimit", &i ) )
     1446            {
     1447                printf( "  Download Limit: " );
     1448                if( boolVal )
     1449                    printf( "%" PRId64 " KB/s\n", i );
     1450                else
     1451                    printf( "Unlimited\n" );
     1452            }
     1453            if( tr_bencDictFindBool( t, "uploadLimited", &boolVal )
     1454                && tr_bencDictFindInt( t, "uploadLimit", &i ) )
     1455            {
     1456                printf( "  Upload Limit: " );
     1457                if( boolVal )
     1458                    printf( "%" PRId64 " KB/s\n", i );
     1459                else
     1460                    printf( "Unlimited\n" );
     1461            }
     1462            if( tr_bencDictFindBool( t, "honorsSessionLimits", &boolVal ) )
     1463                printf( "  Honors Session Limits: %s\n", ( boolVal ? "Yes" : "No" ) );
     1464            if( tr_bencDictFindInt ( t, "peer-limit", &i ) )
     1465                printf( "  Peer limit: %" PRId64 "\n", i );
     1466            printf( "\n" );
     1467
     1468            printf( "PIECES\n" );
    13941469            if( tr_bencDictFindRaw( t, "pieces", &raw, &rawlen ) && tr_bencDictFindInt( t, "pieceCount", &j ) ) {
    13951470                int len;
  • trunk/daemon/transmission-remote.1

    r9331 r9420  
    5050.Op Fl st
    5151.Op Fl t Ar all | Ar id | Ar hash
     52.Op Fl td Ar number
     53.Op Fl TD
     54.Op Fl tu Ar number
     55.Op Fl TU
     56.Op Fl hl
     57.Op Fl HL
    5258.Op Fl u Ar number | Fl U
    5359.Op Fl v
     
    213219To set more than one current torrent, join their ids or hashes together in a list,
    214220such as "\-t2,4,6-8" to operate on the torrents whose IDs are 2, 4, 6, 7, and 8.
     221.It Fl td Fl -torrent-downlimit Ar limit
     222Limit the current torrent(s) download speed to
     223.Ar limit
     224kilobytes per second.
     225.It Fl TD Fl -no-torrent-downlimit
     226Don't use the current torrent(s) download limit.
     227.It Fl tu Fl -torrent-uplimit Ar limit
     228Limit the current torrent(s) upload speed to
     229.Ar limit
     230kilobytes per second.
     231.It Fl TU Fl -no-torrent-uplimit
     232Don't use the current torrent(s) upload limit.
     233.It Fl hl Fl -honnor-session
     234Make the current torrent(s) honnor the session limits.
     235.It Fl HL Fl -no-honnor-session
     236Make the current torrent(s) not honnor the session limits.
    215237.It Fl u Fl -uplimit Ar limit
    216238Limit the global upload speed to
Note: See TracChangeset for help on using the changeset viewer.