org.stanwood.media.actions.command
Class ExecuteSystemCommandAction

java.lang.Object
  extended by org.stanwood.media.actions.AbstractAction
      extended by org.stanwood.media.actions.command.ExecuteSystemCommandAction
All Implemented Interfaces:
IAction, IExtension

public class ExecuteSystemCommandAction
extends AbstractAction

This action is used execute a system command upon media files and directories

This action supports the following parameters:

Parameters can also have variable in them. These can be any of the pattern variables, as well as the following special variables:


Constructor Summary
ExecuteSystemCommandAction()
           
 
Method Summary
protected  void executeCommand(java.lang.String cmd, java.io.File file, MediaDirectory dir, IVideo video)
           
 void perform(MediaDirectory dir, IEpisode episode, java.io.File mediaFile, IActionEventHandler actionEventHandler)
          This will execute the command in the parameter on the mediaFile if the parameter is set.
 void perform(MediaDirectory dir, IFilm film, java.io.File mediaFile, java.lang.Integer part, IActionEventHandler actionEventHandler)
          This will execute the command in the parameter on the mediaFile if the parameter is set.
 void performOnDirectory(MediaDirectory dir, java.io.File mediaDir, IActionEventHandler actionEventHandler)
          This will execute the command in the parameter on the directory if the parameter is set.
protected  void sendEvents(IActionEventHandler actionEventHandler, java.io.File mediaFile)
           
 void setParameter(java.lang.String key, java.lang.String value)
          This method is sued to set parameters.
 
Methods inherited from class org.stanwood.media.actions.AbstractAction
finished, init, isTestMode, resolvePatterns, setTestMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecuteSystemCommandAction

public ExecuteSystemCommandAction()
Method Detail

performOnDirectory

public void performOnDirectory(MediaDirectory dir,
                               java.io.File mediaDir,
                               IActionEventHandler actionEventHandler)
                        throws ActionException
This will execute the command in the parameter on the directory if the parameter is set.

Specified by:
performOnDirectory in interface IAction
Overrides:
performOnDirectory in class AbstractAction
Parameters:
dir - The media directory
mediaDir - The directory the action is to perform on
actionEventHandler - Used to notify the action performer about changes
Throws:
ActionException - Thrown if their is a problem with the action

executeCommand

protected void executeCommand(java.lang.String cmd,
                              java.io.File file,
                              MediaDirectory dir,
                              IVideo video)
                       throws ActionException
Throws:
ActionException

sendEvents

protected void sendEvents(IActionEventHandler actionEventHandler,
                          java.io.File mediaFile)
                   throws ActionException
Throws:
ActionException

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
                  throws ActionException
This method is sued to set parameters. This action supports the following parameters:
  • commandOnFile - A command to execute on finding acceptable media files
  • commandOnDirectory - A command to execute on finding acceptable directories within the media directory
  • extensions - A comma separated list of media file extensions to accept
  • newFile - If this command creates a new file, then the name should be in this parameter
  • deletedFile - If this command deletes a new file, then the name should be in this parameter
  • abortIfFileExists - The name of a file, that if it exists, then this action will not perform

Parameters:
key - The parameter key
value - The parameter value
Throws:
ActionException - Thrown if a known key is given

perform

public void perform(MediaDirectory dir,
                    IEpisode episode,
                    java.io.File mediaFile,
                    IActionEventHandler actionEventHandler)
             throws ActionException
This will execute the command in the parameter on the mediaFile if the parameter is set.

Parameters:
episode - The episode information
mediaFile - The media file
dir - File media directory the files belongs to
actionEventHandler - Used to notify the action performer about changes
Throws:
ActionException - Thrown if their is a problem with the action

perform

public void perform(MediaDirectory dir,
                    IFilm film,
                    java.io.File mediaFile,
                    java.lang.Integer part,
                    IActionEventHandler actionEventHandler)
             throws ActionException
This will execute the command in the parameter on the mediaFile if the parameter is set.

Parameters:
film - The film information
part - The part number
mediaFile - The media file
dir - File media directory the files belongs to
actionEventHandler - Used to notify the action performer about changes
Throws:
ActionException - Thrown if their is a problem with the action