Changeset 10078


Ignore:
Timestamp:
Feb 2, 2010, 7:48:03 AM (13 years ago)
Author:
charles
Message:

(trunk libT) #2846 "Priority Selection in `Add' Window" -- added RPC hooks for doing this via remote client

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/rpc-spec.txt

    r10065 r10078  
    331331   Request arguments:
    332332
    333    key                | value type & description
    334    -------------------+-------------------------------------------------
    335    "download-dir"     | string      path to download the torrent to
    336    "filename"         | string      filename or URL of the .torrent file
    337    "metainfo"         | string      base64-encoded .torrent content
    338    "paused"           | boolean     if true, don't start the torrent
    339    "peer-limit"       | number      maximum number of peers
    340    "files-wanted"     | array       indices of file(s) to download
    341    "files-unwanted"   | array       indices of file(s) to not download
    342    "priority-high"    | array       indices of high-priority file(s)
    343    "priority-low"     | array       indices of low-priority file(s)
    344    "priority-normal"  | array       indices of normal-priority file(s)
     333   key                  | value type & description
     334   ---------------------+-------------------------------------------------
     335   "download-dir"       | string      path to download the torrent to
     336   "filename"           | string      filename or URL of the .torrent file
     337   "metainfo"           | string      base64-encoded .torrent content
     338   "paused"             | boolean     if true, don't start the torrent
     339   "peer-limit"         | number      maximum number of peers
     340   "bandwidthPriority"  | number      torrent's bandwidth tr_priority_t
     341   "files-wanted"       | array       indices of file(s) to download
     342   "files-unwanted"     | array       indices of file(s) to not download
     343   "priority-high"      | array       indices of high-priority file(s)
     344   "priority-low"       | array       indices of low-priority file(s)
     345   "priority-normal"    | array       indices of normal-priority file(s)
    345346
    346347   Either "filename" OR "metainfo" MUST be included.
     
    577578   8     | 1.90    | yes       | session-set    | new arg "rename-partial-files"
    578579         |         | yes       | session-get    | new arg "rename-partial-files"
    579 
     580         |         | yes       | torrent-add    | new arg "bandwidthPriority"
  • trunk/libtransmission/rpcimpl.c

    r10065 r10078  
    10621062            tr_ctorSetPeerLimit( ctor, TR_FORCE, i );
    10631063
     1064        if( tr_bencDictFindInt( args_in, "bandwidthPriority", &i ) )
     1065            tr_ctorSetBandwidthPriority( ctor, i );
     1066
    10641067        if( tr_bencDictFindList( args_in, "files-unwanted", &l ) ) {
    10651068            tr_file_index_t fileCount;
  • trunk/libtransmission/torrent-ctor.c

    r9979 r10078  
    3939    tr_bool                 doDelete;
    4040
     41    tr_priority_t           bandwidthPriority;
    4142    tr_bool                 isSet_metainfo;
    4243    tr_bool                 isSet_delete;
     
    426427***/
    427428
     429static tr_bool
     430isPriority( int i )
     431{
     432    return (i==TR_PRI_LOW) || (i==TR_PRI_NORMAL) || (i==TR_PRI_HIGH);
     433}
     434
     435void
     436tr_ctorSetBandwidthPriority( tr_ctor * ctor, tr_priority_t priority )
     437{
     438fprintf( stderr, "in tr_ctorSetPriority with %d\n", (int)priority );
     439    if( isPriority( priority ) )
     440        ctor->bandwidthPriority = priority;
     441}
     442
     443tr_priority_t
     444tr_ctorGetBandwidthPriority( const tr_ctor * ctor )
     445{
     446fprintf( stderr, "got priority with %d\n", (int)ctor->bandwidthPriority );
     447    return ctor->bandwidthPriority;
     448}
     449
     450/***
     451****
     452***/
     453
    428454tr_ctor*
    429455tr_ctorNew( const tr_session * session )
     
    432458
    433459    ctor->session = session;
     460    ctor->bandwidthPriority = TR_PRI_NORMAL;
    434461    tr_ctorSetPaused( ctor, TR_FALLBACK, FALSE );
    435462    if( session != NULL ) {
  • trunk/libtransmission/torrent.c

    r10072 r10078  
    635635    tor->bandwidth = tr_bandwidthNew( session, session->bandwidth );
    636636
     637    tor->bandwidth->priority = tr_ctorGetBandwidthPriority( ctor );
     638
    637639    tor->error = TR_STAT_OK;
    638640
  • trunk/libtransmission/transmission.h

    r10072 r10078  
    340340const char * tr_sessionGetDownloadDir( const tr_session * session );
    341341
     342
     343/**
     344 * @brief Set the torrent's bandwidth priority.
     345 */
     346void tr_ctorSetBandwidthPriority( tr_ctor * ctor, tr_priority_t priority );
     347
     348/**
     349 * @brief Get the torrent's bandwidth priority.
     350 */
     351tr_priority_t tr_ctorGetBandwidthPriority( const tr_ctor * ctor );
     352
     353
    342354/**
    343355 * @brief set the per-session incomplete download folder.
Note: See TracChangeset for help on using the changeset viewer.