Package sage.api

Class TranscodeAPI


  • public class TranscodeAPI
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      TranscodeAPI()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void AddTranscodeFormat​(java.lang.String FormatName, java.lang.String FormatDetails)
      Adds the specified transcode format to the list of available formats
      int AddTranscodeJob​(sage.MediaFile SourceMediaFile, java.lang.String FormatName, java.io.File DestinationFile, boolean DeleteSourceAfterTranscode)
      Adds the specified job to the transcoder's queue.
      int AddTranscodeJob​(sage.MediaFile SourceMediaFile, java.lang.String FormatName, java.io.File DestinationFile, boolean DeleteSourceAfterTranscode, long ClipTimeStart, long ClipDuration)
      Adds the specified job to the transcoder's queue.
      boolean CancelTranscodeJob​(int JobID)
      Cancels the specified transcoding ob
      boolean CanFileBeTranscoded​(sage.MediaFile MediaFile)
      Returns true if the specified MediaFile can be transcoded, false otherwise.
      void ClearTranscodedJobs()
      Removes all of the completed transcode jobs from the transcoder queue
      java.lang.String GetTranscodeFormatDetails​(java.lang.String FormatName)
      Gets the format details for the specified format name
      java.lang.String[] GetTranscodeFormats()
      Gets the names of the different transcode formats
      long GetTranscodeJobClipDuration​(int JobID)
      Returns the clip duration for the specified transcode job
      long GetTranscodeJobClipStart​(int JobID)
      Returns the clip start time for the specified transcode job
      float GetTranscodeJobCompletePercent​(int JobID)
      Gets the percent complete (between 0 and 1 as a float) for a transcode job
      java.io.File GetTranscodeJobDestFile​(int JobID)
      Gets the destination file of the specified transcoding job
      java.lang.String GetTranscodeJobFormat​(int JobID)
      Gets the target format of the specified transcoding job
      java.lang.Integer[] GetTranscodeJobs()
      Returns a list of the job IDs for all the current jobs in the transcode queue.
      boolean GetTranscodeJobShouldKeepOriginal​(int JobID)
      Returns whether or not the specified transcoding job retains the original source file
      sage.MediaFile GetTranscodeJobSourceFile​(int JobID)
      Gets the source file of the specified transcoding job
      java.lang.String GetTranscodeJobStatus​(int JobID)
      Gets the status of the specified transcoding job
      void RemoveTranscodeFormat​(java.lang.String FormatName)
      Removed the specified transcode format to the list of available formats
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TranscodeAPI

        public TranscodeAPI()
    • Method Detail

      • GetTranscodeFormats

        public java.lang.String[] GetTranscodeFormats()
        Gets the names of the different transcode formats
        Returns:
        a list of the names of the different transcode formats
        Since:
        5.1
      • GetTranscodeFormatDetails

        public java.lang.String GetTranscodeFormatDetails​(java.lang.String FormatName)
        Gets the format details for the specified format name
        Parameters:
        FormatName - the name of the transcode format to get the parameter details for
        Returns:
        the full detail string that describes the specified transcode format
        Since:
        5.1
      • AddTranscodeFormat

        public void AddTranscodeFormat​(java.lang.String FormatName,
                                       java.lang.String FormatDetails)
        Adds the specified transcode format to the list of available formats
        Parameters:
        FormatName - the name of the new transcode format
        FormatDetails - the detailed property string for the new format
        Since:
        5.1
      • RemoveTranscodeFormat

        public void RemoveTranscodeFormat​(java.lang.String FormatName)
        Removed the specified transcode format to the list of available formats
        Parameters:
        FormatName - the name of the transcode format to remove
        Since:
        5.1
      • AddTranscodeJob

        public int AddTranscodeJob​(sage.MediaFile SourceMediaFile,
                                   java.lang.String FormatName,
                                   java.io.File DestinationFile,
                                   boolean DeleteSourceAfterTranscode)
        Adds the specified job to the transcoder's queue. Returns a Job ID# for future reference of it.
        Parameters:
        SourceMediaFile - the source file that is to be transcoded, if it consists of multiple segments, all segments will be transcoded
        FormatName - the name of the transcode format to use for this conversion
        DestinationFile - the target file path for the conversion or null if SageTV should automatically determine the filename of the target files, if a directory is given then SageTV auto-generates the filename in that directory
        DeleteSourceAfterTranscode - if true then the source media files are deleted when the transcoding is done, if false the source files are kept
        Returns:
        the job ID number to reference this transcode job
        Since:
        5.1
      • AddTranscodeJob

        public int AddTranscodeJob​(sage.MediaFile SourceMediaFile,
                                   java.lang.String FormatName,
                                   java.io.File DestinationFile,
                                   boolean DeleteSourceAfterTranscode,
                                   long ClipTimeStart,
                                   long ClipDuration)
        Adds the specified job to the transcoder's queue. Returns a Job ID# for future reference of it. This allows specification of the start time and duration for the media which allows extracting a 'clip' from a file.
        Parameters:
        SourceMediaFile - the source file that is to be transcoded, if it consists of multiple segments, all segments will be transcoded
        FormatName - the name of the transcode format to use for this conversion
        DestinationFile - the target file path for the conversion or null if SageTV should automatically determine the filename of the target files, if a directory is given then SageTV auto-generates the filename in that directory
        DeleteSourceAfterTranscode - if true then the source media files are deleted when the transcoding is done, if false the source files are kept
        ClipTimeStart - specifies the time in the file in seconds that the clip starts at (this number is relative to the beginning of the actual file)
        ClipDuration - specifies the duration of the clip in seconds to extract from the file (0 to convert until the end of the file)
        Returns:
        the job ID number to reference this transcode job
        Since:
        5.1
      • GetTranscodeJobStatus

        public java.lang.String GetTranscodeJobStatus​(int JobID)
        Gets the status of the specified transcoding job
        Parameters:
        JobID - the Job ID of the transcoding job to get the status of
        Returns:
        the status information for the specified transcoding job, will be one of: COMPLETED, TRANSCODING, WAITING TO START, or FAILED
        Since:
        5.1
      • CancelTranscodeJob

        public boolean CancelTranscodeJob​(int JobID)
        Cancels the specified transcoding ob
        Parameters:
        JobID - the Job ID of the transcoding job to cancel
        Returns:
        true if the job exists and was cancelled, false otherwise
        Since:
        5.1
      • GetTranscodeJobSourceFile

        public sage.MediaFile GetTranscodeJobSourceFile​(int JobID)
        Gets the source file of the specified transcoding job
        Parameters:
        JobID - the Job ID of the transcoding job to get the source file for
        Returns:
        the source file of the specified transcoding job
        Since:
        5.1
      • GetTranscodeJobDestFile

        public java.io.File GetTranscodeJobDestFile​(int JobID)
        Gets the destination file of the specified transcoding job
        Parameters:
        JobID - the Job ID of the transcoding job to get the destination file for
        Returns:
        the destination file of the specified transcoding job, or null if no destination file was specified
        Since:
        5.1
      • GetTranscodeJobShouldKeepOriginal

        public boolean GetTranscodeJobShouldKeepOriginal​(int JobID)
        Returns whether or not the specified transcoding job retains the original source file
        Parameters:
        JobID - the Job ID of the transcoding job to get the destination file for
        Returns:
        true if the specified transcoding job keeps its original file when done, false otherwise
        Since:
        5.1
      • GetTranscodeJobClipStart

        public long GetTranscodeJobClipStart​(int JobID)
        Returns the clip start time for the specified transcode job
        Parameters:
        JobID - the Job ID of the transcoding job to get the destination file for
        Returns:
        the clip start time for the specified transcode job, 0 if the start time is unspecified
        Since:
        5.1
      • GetTranscodeJobClipDuration

        public long GetTranscodeJobClipDuration​(int JobID)
        Returns the clip duration for the specified transcode job
        Parameters:
        JobID - the Job ID of the transcoding job to get the destination file for
        Returns:
        the clip duration for the specified transcode job, 0 if the entire file will be trancoded
        Since:
        5.1
      • GetTranscodeJobFormat

        public java.lang.String GetTranscodeJobFormat​(int JobID)
        Gets the target format of the specified transcoding job
        Parameters:
        JobID - the Job ID of the transcoding job to get the target format file for
        Returns:
        the target format of the specified transcoding job
        Since:
        5.1
      • ClearTranscodedJobs

        public void ClearTranscodedJobs()
        Removes all of the completed transcode jobs from the transcoder queue
        Since:
        5.1
      • GetTranscodeJobs

        public java.lang.Integer[] GetTranscodeJobs()
        Returns a list of the job IDs for all the current jobs in the transcode queue.
        Returns:
        the list of job IDs for all the current jobs in the transcode queue
        Since:
        5.1
      • CanFileBeTranscoded

        public boolean CanFileBeTranscoded​(sage.MediaFile MediaFile)
        Returns true if the specified MediaFile can be transcoded, false otherwise. Transcoding may be restricted by certain formats and also by DRM.
        Parameters:
        MediaFile - the MediaFile object
        Returns:
        true if the specified MediaFile can be transcoded, false otherwise
        Since:
        5.1
      • GetTranscodeJobCompletePercent

        public float GetTranscodeJobCompletePercent​(int JobID)
        Gets the percent complete (between 0 and 1 as a float) for a transcode job
        Parameters:
        JobID - the Job ID of the transcoding job to get the percent complete of
        Returns:
        the percent complete for the specified transcoding job
        Since:
        5.1