Provide config toggle to set 'audio' conversion on as default (#310)

* Provide config toggle to set 'audio' conversion on as default

* Fix git cherry pick mistake

* Update templates/index.tpl

Co-authored-by: Pierre Rudloff <contact@rudloff.pro>

* Add default audio config option to config.example

Co-authored-by: Pierre Rudloff <contact@rudloff.pro>
This commit is contained in:
bellington3 2020-09-29 22:07:20 +00:00 committed by GitHub
parent f9aab3c404
commit 2e8350ce1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View file

@ -140,6 +140,13 @@ class Config
*/ */
public $debug = false; public $debug = false;
/**
* Default to audio.
*
* @var bool
*/
public $defaultAudio = false;
/** /**
* Config constructor. * Config constructor.
* *

View file

@ -55,3 +55,6 @@ genericFormats:
# Enable debug mode. # Enable debug mode.
debug: false debug: false
# True to enable audio conversion mode by default
defaultAudio: false

View file

@ -20,7 +20,7 @@
{if $config->convert} {if $config->convert}
<div class="mp3 small-font"> <div class="mp3 small-font">
<div class="mp3-inner"> <div class="mp3-inner">
<input type="checkbox" id="audio" class="audio" name="audio"> <input type="checkbox" id="audio" class="audio" name="audio" {($config->defaultAudio) ? 'checked' : ''}>
<label for="audio"><span class="ui"></span> <label for="audio"><span class="ui"></span>
{t}Audio only (MP3){/t} {t}Audio only (MP3){/t}
</label> </label>

View file

@ -75,6 +75,7 @@ class ConfigTest extends BaseTest
$this->assertIsBool($config->uglyUrls); $this->assertIsBool($config->uglyUrls);
$this->assertIsBool($config->stream); $this->assertIsBool($config->stream);
$this->assertIsBool($config->remux); $this->assertIsBool($config->remux);
$this->assertIsBool($config->defaultAudio);
$this->assertIsInt($config->audioBitrate); $this->assertIsInt($config->audioBitrate);
} }