Changeset 6222


Ignore:
Timestamp:
Jun 18, 2008, 10:01:15 PM (13 years ago)
Author:
charles
Message:

senseless RPC changes

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/remote.c

    r6213 r6222  
    349349    CURL * curl;
    350350    struct evbuffer * buf = evbuffer_new( );
    351     char * url = tr_strdup_printf( "http://%s:%d/transmission", host, port );
     351    char * url = tr_strdup_printf( "http://%s:%d/transmission/rpc", host, port );
    352352
    353353    curl = curl_easy_init( );
  • trunk/doc/rpc-spec.txt

    r6214 r6222  
    22222.1.  Requests
    2323
    24    Requests supports three keys:
     24   Requests support three keys:
    2525
    2626   (1) A required "method" string telling the name of the method to invoke
     
    8181   string                     | value type & description
    8282   ---------------------------+-------------------------------------------------
    83    "files-wanted"             | array      indices of one or more file to download
    84    "files-unwanted"           | array      indices of one or more file to not download
    85    "ids"                      | array      which torrent(s) to set, described in 3.1
     83   "files-wanted"             | array      indices of file(s) to download
     84   "files-unwanted"           | array      indices of file(s) to not download
     85   "ids"                      | array      torrent list, as described in 3.1
    8686   "peer-limit"               | number     maximum number of peers
    87    "priority-high"            | array      indices of one or more high-priority files
    88    "priority-low"             | array      indices of one or more low-priority files
    89    "priority-normal"          | array      indices of one or more normal-priority files
     87   "priority-high"            | array      indices of high-priority file(s)
     88   "priority-low"             | array      indices of low-priority file(s)
     89   "priority-normal"          | array      indices of normal-priority file(s)
    9090   "speed-limit-down"         | number     maximum download speed (in KiB/s)
    9191   "speed-limit-down-enabled" | 'boolean'  true if the download speed is limited
     
    295295                       fields for id, name, and hashString.
    296296
    297 4.   Session Status Requests
     297
     2984.   Session Requests
    298299
    2993004.1.  Session Arguments
     
    312313   "speed-limit-up-enabled"   | 'boolean'  true means enabled
    313314
    314 4.2.  Mutators
     3154.1.1.  Mutators
    315316
    316317   Method name: "session-set"
     
    318319   Response arguments: none
    319320
    320 4.2.  Accessors
     3214.1.2.  Accessors
    321322
    322323   Method name: "session-get"
     
    324325   Response arguments: all of 4.1's arguments
    325326
     3274.2.  Session Statistics
     328
     329   Method name: "session-stats"
     330
     331   Request arguments: none
     332
     333   Response arguments:
     334
     335   string                     | value type
     336   ---------------------------+-------------------------------------------------
     337   "activeTorrentCount"       | number
     338   "downloadSpeed"            | number
     339   "pausedTorrentCount"       | number
     340   "torrentCount"             | number
     341   "uploadSpeed"              | number
     342   
     343
  • trunk/libtransmission/rpc-server.c

    r6139 r6222  
    153153        server->ctx = shttpd_init( );
    154154        snprintf( ports, sizeof( ports ), "%d", server->port );
    155         shttpd_register_uri( server->ctx, "/transmission", handle_rpc, server );
     155        shttpd_register_uri( server->ctx, "/transmission/rpc", handle_rpc, server );
    156156        shttpd_set_option( server->ctx, "ports", ports );
    157157        shttpd_set_option( server->ctx, "dir_list", "0" );
     
    163163        }
    164164        if( server->isPasswordEnabled ) {
    165             char * buf = tr_strdup_printf( "/transmission=%s", passwd );
     165            char * buf = tr_strdup_printf( "/transmission/rpc=%s", passwd );
    166166            shttpd_set_option( server->ctx, "protect", buf );
    167167            tr_free( buf );
  • trunk/libtransmission/rpc.c

    r6213 r6222  
    249249        tr_bencDictAddInt( d, "peersGettingFromUs", st->peersGettingFromUs );
    250250        tr_bencDictAddInt( d, "peersSendingToUs", st->peersSendingToUs );
    251         tr_bencDictAddDouble( d, "rateDownload", st->rateDownload );
    252         tr_bencDictAddDouble( d, "rateUpload", st->rateUpload );
     251        tr_bencDictAddInt( d, "rateDownload", (int)(st->rateDownload*1024) );
     252        tr_bencDictAddInt( d, "rateUpload", (int)(st->rateUpload*1024) );
    253253        tr_bencDictAddDouble( d, "recheckProgress", st->recheckProgress );
    254254        tr_bencDictAddInt( d, "status", st->status );
     
    556556
    557557static const char*
     558sessionStats( tr_handle * h, tr_benc * args_in UNUSED, tr_benc * args_out )
     559{
     560    tr_benc * d = tr_bencDictAddDict( args_out, "session-stats", 10 );
     561    tr_torrent * tor = NULL;
     562    float up, down;
     563    int running = 0;
     564    int total = 0;
     565
     566    tr_sessionGetSpeed( h, &down, &up );
     567    while(( tor = tr_torrentNext( h, tor ))) {
     568        ++total;
     569        if( tor->isRunning )
     570            ++running;
     571    }
     572       
     573    tr_bencDictAddInt( d, "activeTorrentCount", running );
     574    tr_bencDictAddInt( d, "downloadSpeed", (int)(down*1024) );
     575    tr_bencDictAddInt( d, "pausedTorrentCount", total-running );
     576    tr_bencDictAddInt( d, "torrentCount", total );
     577    tr_bencDictAddInt( d, "uploadSpeed", (int)(up*1024) );
     578    return NULL;
     579}
     580
     581static const char*
    558582sessionGet( tr_handle * h, tr_benc * args_in UNUSED, tr_benc * args_out )
    559583{
     
    603627    { "session-get", sessionGet },
    604628    { "session-set", sessionSet },
     629    { "session-stats", sessionStats },
    605630    { "torrent-add", torrentAdd },
    606631    { "torrent-get", torrentGet },
Note: See TracChangeset for help on using the changeset viewer.