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

Commit

Permalink
comment tweakage
Browse files Browse the repository at this point in the history
  • Loading branch information
chocolateboy committed Mar 1, 2011
1 parent 4bb6103 commit 3f6dd97
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 19 deletions.
4 changes: 4 additions & 0 deletions TODO.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,7 @@ transcoder = new NullTranscoder()
/// FIXME: MPlayer can't dump to stdout: http://lists.mplayerhq.hu/pipermail/mplayer-users/2006-April/059898.html

// need better vlc detection

// make the rtmp2pms functionality available via a web page (e.g. GitHub page) using JavaScript:
// i.e. enter 1) name/path 2) the command line 3) optional thumbnail URI and click to generate the WEB.conf
// line
8 changes: 1 addition & 7 deletions src/main/groovy/com/chocolatey/pmsencoder/Action.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ class Action {
Util.quoteURI(uri)
}

/*
1) get the URI pointed to by options['uri'] or command.getVar('$URI') (if it hasn't already been retrieved)
2) perform a regex match against the document
3) update the stash with any named captures
*/

// define a variable in the stash
// DSL method
void let(Map map) {
Expand Down Expand Up @@ -256,7 +250,7 @@ class Action {
// TODO support named captures
log.debug("replacing $search with $replace in $name")
def value = context[ index + 1 ]
// XXX bugfix: strings are immutable!
// XXX squashed bug: strings are immutable!
context[ index + 1 ] = value.replaceAll(search.toString(), replace.toString())
} else {
log.warn("can't replace $search with $replace in $name: target out of bounds")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ class ProfileDelegate {
scrape(regex, [:])
}

/*
1) get the URI pointed to by options['uri'] or command.getVar('$URI') (if it hasn't already been retrieved)
2) perform a regex match against the document
3) update the stash with any named captures
*/
public boolean scrape(Object regex, Map options) {
String uri = (options['uri'] == null) ? command.getVar('$URI') : options['uri'].toString()
String document = (options['source'] == null) ? cache[uri] : options['source'].toString()
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/scripts/BEGIN.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
begin {
// see https://secure.wikimedia.org/wikipedia/en/wiki/YouTube#Quality_and_codecs
IPAD_USER_AGENT = 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) ' +
'AppleWebKit/531.21.10 (KHTML, like Gecko) ' +
'Version/4.0.4 Mobile/7B334b Safari/531.21.10'
Expand All @@ -16,7 +15,7 @@ begin {
SOPCAST = pmsConf['sopcast.path']
SOPCAST_URI = pmsConf['sopcast.uri'] ?: 'http://127.0.0.1:8902/stream' // only used if SOPCAST is defined
VLC = pmsConf['vlc.path']
// see https://secure.wikimedia.org/wikipedia/en/wiki/YouTube#Quality_and_codecs
YOUTUBE_DL = pmsConf['youtube-dl.path']
// see https://secure.wikimedia.org/wikipedia/en/wiki/YouTube#Quality_and_codecs
YOUTUBE_DL_MAX_QUALITY = pmsConf['youtube-dl.max-quality'] ?: 22
}
9 changes: 5 additions & 4 deletions src/main/resources/scripts/INIT.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ init {
def mplayerLogLevel = $PMS.isWindows() ? 'all=1' : 'all=2'

/*
Matcher-level (global) lists of strings that provide provide useful default options
Matcher-level (global) lists of strings that provide useful default options
for ffmpeg (downloader/transcoder), mplayer (downloader) and mencoder (downloader, transcoder)
$DOWNLOADER = $MPLAYER:
Expand Down Expand Up @@ -47,7 +47,8 @@ init {
matcher-scoped (i.e. global): $FFMPEG, $FFMPEG_OUT, $MENCODER, and $MPLAYER are lists of strings,
but, as seen below, can be assigned strings (which are split on whitespace).
profile-scoped: $DOWNLOADER, $TRANSCODER, $OUTPUT and $HOOK are similar, but only have profile-scope
profile-scoped: $DOWNLOADER, $TRANSCODER, $OUTPUT and $HOOK are similar, but are only defined in the context
of a profile block.
*/

// default ffmpeg transcode command - all of these defaults can be (p)redefined in a userscript (e.g. BEGIN.groovy)
Expand All @@ -64,7 +65,7 @@ init {
// default mencoder transcode command
if (!$MENCODER) {
$MENCODER = [
'MENCODER', // XXX add support for mencoder-mt
'MENCODER', // TODO add support for mencoder-mt
'-msglevel', 'all=2',
'-quiet',
'-prefer-ipv4',
Expand Down Expand Up @@ -94,7 +95,7 @@ init {
youtube $YOUTUBE_ACCEPT - [ 37 ]
add '2304p':
add '3072p':
youtube([ 38 ] + $YOUTUBE_ACCEPT)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/scripts/eurogamer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ script {
$DOWNLOADER = $MPLAYER

downloader {
// -referrer requires a recent-ish MEncoder (from June 2010)
// -referrer requires a recent-ish MEncoder (>= June 2010)
set '-referrer': $URI
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/scripts/navix.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ init {
def value = pair.value

if (value)
value = URLDecoder.decode(pair.value)
value = URLDecoder.decode(value)

switch (name) {
case 'url':
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/scripts/rtmpdump.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
rtmpdump://channel?url=http%3A//example.com&-y=yvalue&-c=cvalue
rtmpdump://channel?-v&-r=http%3A//example.com&-y=yvalue&-W=Wvalue
-o is set automatically
-r or -rtmp is required
-r or --rtmp is required
boolean values can be set without a value e.g. rtmpdump://channel?url=http%3A//example.com&--live&--foo=bar
values *must* be URL-encoded
keys can be, but hyphens are not special characters, so they don't need to be
Expand All @@ -25,7 +25,7 @@ init {
def value = pair.value

if (value)
value = URLDecoder.decode(pair.value)
value = URLDecoder.decode(value)

switch (name) {
case 'url': // deprecated
Expand All @@ -45,10 +45,11 @@ init {
}

if (seenURL) {
// rtmpdump doesn't log to stdout, so no need to use -q on Windows
$DOWNLOADER = "$RTMPDUMP -o $DOWNLOADER_OUT -r ${$URI}"
$DOWNLOADER += rtmpdumpArgs
} else {
log.error("invalid rtmpdump:// URI: no url parameter supplied: ${$URI}")
log.error("invalid rtmpdump:// URI: no -r or --rtmp parameter supplied: ${$URI}")
}
}
}
Expand Down

0 comments on commit 3f6dd97

Please sign in to comment.