FileDocCategorySizeDatePackage
TorrentStart.javaAPI DocAzureus 3.0.3.42861Mon Mar 13 07:05:42 GMT 2006org.gudy.azureus2.ui.console.commands

TorrentStart

public class TorrentStart extends TorrentCommand
console command to start a torrent. extracted from the Torrent class written by tobias

Fields Summary
private boolean
startNow
Constructors Summary
public TorrentStart()

		super( new String[] { "start" , "s" }, "Starting" );
	
Methods Summary
public voidexecute(java.lang.String commandName, org.gudy.azureus2.ui.console.ConsoleInput console, java.util.List args)

		startNow = false;
		Vector newargs = new Vector(args);
		if (!newargs.isEmpty() && newargs.contains("now") ) {
			newargs.removeElement("now");
			startNow = true;
		}
		super.execute(commandName, console, args);
	
public java.lang.StringgetCommandDescriptions()

		return "start (<torrentoptions>) \ts\tStart torrent(s).";
	
public java.lang.StringgetHelpExtra()

		return ("<torrentoptions> can be one of:\n"+
		"<#>\t\tNumber of a torrent. You have to use 'show torrents' first. as the number is taken from there.\n"+
		"all\t\tCommand is applied to all torrents\n"+
		"hash <hash>\tApplied to torrent with the hash <hash> as given in the xml output or extended torrent info ('show <#>').");
	
protected booleanperformCommand(org.gudy.azureus2.ui.console.ConsoleInput ci, org.gudy.azureus2.core3.download.DownloadManager dm, java.util.List args)

		try {
			int	state = dm.getState();
			
			if ( state != DownloadManager.STATE_STOPPED ){
				
				ci.out.println( "Torrent isn't stopped" );
				
				return( false );
			}
			
			if ( startNow ){
				
				ci.out.println( "'now' option has been deprecated, use forcestart" );
			}
			
			dm.stopIt( DownloadManager.STATE_QUEUED, false, false );
			
		} catch (Exception e) {
			e.printStackTrace(ci.out);
			return false;
		}
		return true;