Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Script:Script

chocolateboy edited this page Dec 23, 2010 · 3 revisions

A script block is the top-level of a script. It contains one or more profiles.

Example:

script {
    profile('Empty Profile') { }
}

Methods

profile

Define a profile. See the Profile page for more details.

Variables

The following variables are available within PMSEncoder scripts. Each variable name is followed by its scope (i.e. the topmost block in which it is defined) in parentheses.

$ARGS (Profile)

The list of transcoder args for this request. By default this is a copy of $DEFAULT_TRANSCODER_ARGS.

$DEFAULT_TRANSCODER_ARGS (Script)

This is a list of the default transcoder arguments. The current value is defined in the [[builtin pmsencoder.conf|http://github.com/chocolateboy/pmsencoder/blob/plugin/src/main/resources/pmsencoder.groovy]] as :

    def nbcores = $PMS.getConfiguration().getNumberOfCpuCores()

    // the default MEncoder args - these can be redefined in a user script
    $DEFAULT_MENCODER_ARGS = [
        '-prefer-ipv4',
        '-oac', 'lavc',
        '-of', 'lavf',
        '-lavfopts', 'format=dvd',
        '-ovc', 'lavc',
        '-lavcopts', "vcodec=mpeg2video:vbitrate=4096:threads=${nbcores}:acodec=ac3:abitrate=128",
        '-ofps', '25',
        '-cache', '16384', // default cache size; default minimum percentage is 20%
        '-vf', 'harddup'
    ]
Example

Globally double the cache size:

script {
    $DEFAULT_TRANSCODER_ARGS -= [ '-cache', '16384' ]
    $DEFAULT_TRANSCODER_ARGS += [ '-cache', '32768' ]
    // ...
}

$MATCHES

$PMS (Script)

This is the PMS singleton. See the PMS documentation/source for available methods.

Example:

script {
    def nbcores = $PMS.getConfiguration().getNumberOfCpuCores()
    
    profile ('YouTube Extreme HD') {
        pattern {
            match { nbcores > 4 }
        }

        action { ... }
    }
}

$URI (Profile)

The URI of the current web page or video. This is the videostream URI from WEB.conf or the enclosure URI from the Web feed.

Example
script {
    profile ('Example') {
        pattern {
            match { $URI == 'http://www.example.com' }
        }

        action { ... }
    }
}

$YOUTUBE_ACCEPT (Script)

A list of integers corresponding to YouTube formats (full list here).

Example