From ff435704fd4fadbf50601454d3a68c6f15d18a87 Mon Sep 17 00:00:00 2001 From: darko Date: Fri, 26 Feb 2016 20:39:23 +0100 Subject: [PATCH] Added options for setting subtitle font scale and color. --- README.md | 6 +++++- index.js | 4 +++- plugins/subtitles.js | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 417fc5a..10de563 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,10 @@ the MDNS scan. * `--subtitles ` This can be a path or URL to a vtt or srt file that contains subtitles. +* `--subtitle-scale 1.5` Scaling factor for the size of the subtitle font. Default is 1.0. + +* `--subtitle-color #FFFFFFFF` Foreground RGBA color of the subtitle font. + * `--myip 192.168.1.8` Your main IP address \(useful if you have multiple network adapters) * `--quiet` Hide the player timeline. @@ -105,7 +109,7 @@ Some problems have already been addressed in our wiki https://github.com/xat/cas `npm install castnow -g` -### contributers +### contributors * [tooryx](https://github.com/tooryx) * [przemyslawpluta](https://github.com/przemyslawpluta) diff --git a/index.js b/index.js index 0fe981d..e709820 100644 --- a/index.js +++ b/index.js @@ -31,6 +31,8 @@ if (opts.help) { '--device The name of the Chromecast device that should be used', '--address The IP address or hostname of your Chromecast device', '--subtitles Path or URL to an SRT or VTT file', + '--subtitle-scale Subtitle font scale', + '--subtitle-color Subtitle font RGBA color', '--myip Your local IP address', '--quiet No output', '--peerflix-* Pass options to peerflix', @@ -293,7 +295,7 @@ player.use(function(ctx, next) { if (ctx.mode !== 'launch') return next(); ctx.options = xtend(ctx.options, ctx.options.playlist[0]); var file = ctx.options.playlist.shift(); - if (ctx.options.loop) ctx.options.playlist.push(file) + if (ctx.options.loop) ctx.options.playlist.push(file); next(); }); diff --git a/plugins/subtitles.js b/plugins/subtitles.js index af5d3c5..ad6df69 100644 --- a/plugins/subtitles.js +++ b/plugins/subtitles.js @@ -31,10 +31,10 @@ var attachSubtitles = function(ctx) { } ctx.options.playlist[0].media.textTrackStyle = { backgroundColor: '#00000000', - foregroundColor: '#FFFF00FF', + foregroundColor: ctx.options['subtitle-color'] || '#FFFF00FF', edgeType: 'OUTLINE', edgeColor: '#000000FF', - fontScale: 1, + fontScale: ctx.options['subtitle-scale'], fontStyle: 'NORMAL', fontFamily: 'Droid Sans', fontGenericFamily: 'SANS_SERIF',