-.Dd May 19, 2008
+.Dd July 21, 2008
.Dt TRANSMISSION-DAEMON 1
.Sh NAME
.Fl h
.Nm
.Op Fl a Ar (+|-)x.x.x.x[/x],...
-.Op Fl b
-.Op Fl B
+.Op Fl b | B
.Op Fl f
.Op Fl g Ar directory
.Op Fl h
.Op Fl p Ar port
-.Op Fl t
-.Op Fl T
+.Op Fl t | T
.Op Fl u Ar username
.Op Fl v Ar password
.Op Fl w Ar download-dir
.Sh DESCRIPTION
.Nm
is a daemon-based Transmission session that can be controlled
-via RPC commands from
-.Xr transmission-remote 1
-or
-.Xr Clutch 1 .
-.Pp
-The options are as follows:
+via RPC commands from transmission's web interface or
+.Xr transmission-remote 1 .
+
+.Sh OPTIONS
.Bl -tag -width Ds
.It Fl a Fl -acl Ar (+|-)x.x.x.x[/x],...
-.Dd May 20, 2008
+.Dd July 21, 2008
.Dt TRANSMISSION-REMOTE 1
.Os
.Sh NAME
.Op Ar host:port | host | port
.Op Fl a Ar torrent-files
.Op Fl b
-.Op Fl d Ar number
-.Op Fl D
-.Op Fl er
-.Op Fl ep
-.Op Fl et
+.Op Fl d Ar number | Fl D
+.Op Fl er | ep | et
.Op Fl f
.Op Fl g Ar files
.Op Fl G Ar files
.Op Fl h
.Op Fl i
.Op Fl l
-.Op Fl m
-.Op Fl M
+.Op Fl m | M
.Op Fl n Ar user:pass
.Op Fl p Ar port
.Op Fl ph Ar files
.Op Fl pl Ar files
.Op Fl pn Ar files
.Op Fl r
-.Op Fl s
-.Op Fl S
+.Op Fl s | S
.Op Fl t Ar all | Ar id | Ar hash
-.Op Fl u Ar number
-.Op Fl U
+.Op Fl u Ar number | Fl U
.Op Fl v
.Op Fl w Ar download-dir
-.Op Fl x
-.Op Fl X
+.Op Fl x | X
.Ek
.Sh DESCRIPTION
.Nm
.Nm
connects to the transmission session at localhost:9091.
Other sessions can be controlled by specifying a different host and/or port.
-.Pp
-The options are as follows:
+
+.Sh OPTIONS
.Bl -tag -width Ds
-.It Fl a Fl -add Ar torrent-file
-Add metainfo
-.Ar torrent-file(s) .
+.It Fl a Fl -add Ar torrent-file(s)
+Add
+.Ar torrent-file(s)
+into transmission.
.It Fl b Fl -debug
Enable debugging mode.
.It Fl f Fl -files
Get a file list for the current torrent(s)
-.It Fl g Fl -get Ar files
+.It Fl g Fl -get Ar all | file-index | files
Mark file(s) for download.
-.Ar files
-can be a file index, or a comma-separated list of file indices, or the literal
.Ar all
-for all files in the torrent.
+marks all all of the torrent's files for downloading,
+.Ar file-index
+adds a single file to the download list, and
+.Ar files
+adds multiple files to the download list,
+such as "-g1,3-5" to add files #1, #3, #4, and #5 to the download list.
-.It Fl g Fl -no-get Ar files
-Mark file(s) for not downloading
+.It Fl G Fl -no-get Ar all | file-index | files
+Mark file(s) for not downloading.
.It Fl h Fl -help
Print command-line option descriptions.
.Ar port
for use when listening for incoming peer connections
-.It Fl ph Fl -priority-high Ar files
-Mark
-.Ar files
-as high priority.
-.Ar files
-can be a file index, or a comma-separated list of file indices, or the literal
+.It Fl pn Fl -priority-normal Ar all | file-index | files
+Mark file(s) as normal priority.
.Ar all
-for all files in the torrent.
-
-.It Fl pl Fl -priority-low Ar files
-Mark
+marks all of the torrent's files as normal priority,
+.Ar file-index
+sets a single file's priority as normal, and
.Ar files
-as low priority
+sets multiple files' priorities as normal,
+such as "-pn1,3-5" to normalize files #1, #3, #4, and #5.
-.It Fl pn Fl -priority-normal Ar files
-Mark
-.Ar files
-as normal priority
+.It Fl ph Fl -priority-high Ar all | file-index | files
+Mark file(s) as high priority.
+
+.It Fl pl Fl -priority-low Ar all | file-index | files
+Mark file(s) as low priority.
.It Fl r Fl -remove
Remove the current torrent(s). This does not delete the downloaded data.
.Ar id
or
.Ar hash .
-To set more than one current torrent, joined their ids or hashes together in a comma-delimited list,
-such as "-t1,2,3"
+To set more than one current torrent, join their ids or hashes together in a list,
+such as "-t2,4,6-8" to operate on the torrents whose IDs are 2, 4, 6, 7, and 8.
.It Fl u Fl -uplimit Ar limit
Limit the upload speed to
.El
.Sh EXAMPLES
+Set download and upload limits to 100 KiB/sec and 20 KiB/sec:
+.Bd -literal -offset indent
+$ transmission-remote -d100 -u20
+$ transmission-remote --downlimit=100 --uplimit=20
+.Ed
+
List all torrents' IDs and states:
.Bd -literal -offset indent
$ transmission-remote -l
$ transmission-remote -t1 -i"
.Ed
+Get a list of a torrent's files:
+.Bd -literal -offset indent
+$ transmission-remote -t1 -l"
+.Ed
+
Download only its second and fourth files:
.Bd -literal -offset indent
$ transmission-remote -t1 -Gall -g2,4"
$ transmission-remote -tall -pnall"
.Ed
-Set download and upload limits to 100 KiB/sec and 20 KiB/sec:
-.Bd -literal -offset indent
-$ transmission-remote -d100 -u20
-$ transmission-remote --downlimit=100 --uplimit=20
-.Bd -literal -offset indent
-
.Sh AUTHORS
.An -nosplit
.An Charles Kerr ,
metainfo file (usually with the .torrent file extension) and a central
tracker to distribute file data amongst a group of peers. For more
information on the BitTorrent protocol see http://www.bittorrent.org/
-.Pp
-The options are as follows:
+.Sh OPTIONS
.Bl -tag -width Ds
.It Fl ? Fl -help
Show help options
#include <stdio.h> /* fprintf */
#include <string.h> /* strcmp */
#include "transmission.h"
+#include "bencode.h"
+#include "rpc.h"
#include "utils.h"
#define VERBOSE 0
{
int ok;
char * str = cidrize( in );
-/* fprintf( stderr, "in [%s] out [%s] should be [%s]\n", in, str, expected ); */
+/* fprintf( stderr, "in [%s] out [%s] expected [%s]\n", in, str, expected ); */
ok = expected ? !strcmp( expected, str ) : !str;
tr_free( str );
return ok;
check( testWildcard( "192.64.*.*", "192.64.0.0/16" ) );
check( testWildcard( "192.64.0.*", "192.64.0.0/24" ) );
check( testWildcard( "192.64.0.1", "192.64.0.1/32" ) );
- check( testWildcard( "+192.*.*.*,-192.64.*.*", "+192.0.0.0/8,-192.64.0.0/16" ) );
+ check( testWildcard( "+192.*.*.*,-192.64.*.*",
+ "+192.0.0.0/8,-192.64.0.0/16" ) );
err = tr_rpcTestACL( NULL, "+192.*.*.*", &errmsg );
check( !err );
return 0;
}
+static int
+test_list( void )
+{
+ int64_t i;
+ const char * str;
+ tr_benc top;
+
+ tr_rpc_parse_list_str( &top, "12", -1 );
+ check( tr_bencIsInt( &top ) );
+ check( tr_bencGetInt( &top, &i ) );
+ check( i == 12 );
+ tr_bencFree( &top );
+
+ tr_rpc_parse_list_str( &top, "12", 1 );
+ check( tr_bencIsInt( &top ) );
+ check( tr_bencGetInt( &top, &i ) );
+ check( i == 1 );
+ tr_bencFree( &top );
+
+ tr_rpc_parse_list_str( &top, "6,7", -1 );
+ check( tr_bencIsList( &top ) );
+ check( tr_bencListSize( &top ) == 2 );
+ check( tr_bencGetInt( tr_bencListChild( &top, 0 ), &i ) );
+ check( i == 6 );
+ check( tr_bencGetInt( tr_bencListChild( &top, 1 ), &i ) );
+ check( i == 7 );
+ tr_bencFree( &top );
+
+ tr_rpc_parse_list_str( &top, "asdf", -1 );
+ check( tr_bencIsString( &top ) );
+ check( tr_bencGetStr( &top, &str ) );
+ check( !strcmp( str, "asdf" ) );
+ tr_bencFree( &top );
+
+ tr_rpc_parse_list_str( &top, "1,3-5", -1 );
+ check( tr_bencIsList( &top ) );
+ check( tr_bencListSize( &top ) == 4 );
+ check( tr_bencGetInt( tr_bencListChild( &top, 0 ), &i ) );
+ check( i == 1 );
+ check( tr_bencGetInt( tr_bencListChild( &top, 1 ), &i ) );
+ check( i == 3 );
+ check( tr_bencGetInt( tr_bencListChild( &top, 2 ), &i ) );
+ check( i == 4 );
+ check( tr_bencGetInt( tr_bencListChild( &top, 3 ), &i ) );
+ check( i == 5 );
+ tr_bencFree( &top );
+
+ return 0;
+}
+
int
main( void )
{
if(( i = test_acl( )))
return i;
+ if(( i = test_list( )))
+ return i;
return 0;
}
return ret;
}
+static void
+addToken( tr_benc * list, const char * token, size_t len )
+{
+ char * p;
+ const char * end = token + len;
+ const long a = strtol( token, &p, 10 );
+ if( p == end )
+ tr_bencListAddInt( list, a );
+ else if( *p == '-' && isdigit(p[1]) ) {
+ const long b = strtol( p+1, &p, 10 );
+ if( ( p == end ) && ( b > a ) ) {
+ long i;
+ for( i=a; i<=b; ++i )
+ tr_bencListAddInt( list, i );
+ }
+ }
+}
+
/**
* Munge the URI into a usable form.
*
tr_bencInitList( setme, commaCount + 1 );
walk = str;
while( *walk ) {
- char * p;
- tr_bencListAddInt( setme, strtol( walk, &p, 10 ) );
+ const char * p = strchr( walk, ',' );
+ if( !p )
+ p = walk + strlen( walk );
+ addToken( setme, walk, p-walk );
if( *p!=',' )
break;
walk = p + 1;