Add support for the 'defaultCustomArguments' external player mapping field (#1415)

* feat(store/utils): add support for the `defaultCustomArguments` external player mapping field
improve(store/utils): move custom arguments evaluation to the top in `openInExternalPlayer`
improve(components/external-player-settings): conditionally append the default custom arguments to the tooltip

Signed-off-by: Randshot <randshot@norealm.xyz>

* fix(components/external-player-settings): fix lint error
chore(components/external-player-settings): remove unnecessary console log

Signed-off-by: Randshot <randshot@norealm.xyz>

* chore(static/external-player-map): add new `defaultCustomArguments` field to vlc map

Signed-off-by: Randshot <randshot@norealm.xyz>
This commit is contained in:
kuhaku 2021-10-07 06:29:43 +00:00 committed by GitHub
parent dad3f2b8d6
commit 3cf18b9f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 7 deletions

View File

@ -40,6 +40,18 @@ export default Vue.extend({
},
externalPlayerCustomArgs: function () {
return this.$store.getters.getExternalPlayerCustomArgs
},
externalPlayerCustomArgsTooltip: function () {
const tooltip = this.$t('Tooltips.External Player Settings.Custom External Player Arguments')
const cmdArgs = this.$store.getters.getExternalPlayerCmdArguments[this.externalPlayer]
if (cmdArgs && typeof cmdArgs.defaultCustomArguments === 'string' && cmdArgs.defaultCustomArguments !== '') {
const defaultArgs = this.$t('Tooltips.External Player Settings.DefaultCustomArgumentsTemplate')
.replace('$', cmdArgs.defaultCustomArguments)
return `${tooltip} ${defaultArgs}`
}
return tooltip
}
},
methods: {

View File

@ -44,7 +44,7 @@
:show-action-button="false"
:show-label="true"
:value="externalPlayerCustomArgs"
:tooltip="$t('Tooltips.External Player Settings.Custom External Player Arguments')"
:tooltip="externalPlayerCustomArgsTooltip"
@input="updateExternalPlayerCustomArgs"
/>
</ft-flex-box>

View File

@ -674,6 +674,16 @@ const actions = {
const ignoreWarnings = rootState.settings.externalPlayerIgnoreWarnings
const customArgs = rootState.settings.externalPlayerCustomArgs
// Append custom user-defined arguments,
// or use the default ones specified for the external player.
if (typeof customArgs === 'string' && customArgs !== '') {
const custom = customArgs.split(';')
args.push(...custom)
} else if (typeof cmdArgs.defaultCustomArguments === 'string' && cmdArgs.defaultCustomArguments !== '') {
const defaultCustomArguments = cmdArgs.defaultCustomArguments.split(';')
args.push(...defaultCustomArguments)
}
if (payload.watchProgress > 0) {
if (typeof cmdArgs.startOffset === 'string') {
args.push(`${cmdArgs.startOffset}${payload.watchProgress}`)
@ -776,12 +786,6 @@ const actions = {
}
}
// Append custom user-defined arguments
if (customArgs !== null) {
const custom = customArgs.split(';')
args.push(...custom)
}
const openingToast = payload.strings.OpeningTemplate
.replace('$', payload.playlistId === null || payload.playlistId === ''
? payload.strings.video

View File

@ -9,6 +9,7 @@
"value": "mpv",
"cmdArguments": {
"defaultExecutable": "mpv",
"defaultCustomArguments": null,
"supportsYtdlProtocol": true,
"videoUrl": "",
"playlistUrl": "",
@ -25,6 +26,7 @@
"value": "vlc",
"cmdArguments": {
"defaultExecutable": "vlc",
"defaultCustomArguments": null,
"supportsYtdlProtocol": false,
"videoUrl": "",
"playlistUrl": null,

View File

@ -653,6 +653,8 @@ Tooltips:
the current action (e.g. reversing playlists, etc.).
Custom External Player Arguments: Any custom command line arguments, separated by semicolons (';'),
you want to be passed to the external player.
# $ is replaced with the default custom arguments for the current player, if defined.
DefaultCustomArgumentsTemplate: '(Default: ''$'')'
Subscription Settings:
Fetch Feeds from RSS: When enabled, FreeTube will use RSS instead of its default
method for grabbing your subscription feed. RSS is faster and prevents IP blocking,

View File

@ -724,6 +724,8 @@ Tooltips:
support the current action (e.g. reversing playlists, etc.).
Custom External Player Arguments: Any custom command line arguments, separated
by semicolons (';'), you want to be passed to the external player.
# $ is replaced with the default custom arguments for the current player, if defined.
DefaultCustomArgumentsTemplate: '(Default: ''$'')'
Privacy Settings:
Remove Video Meta Files: When enabled, FreeTube automatically deletes meta files
created during video playback, when the watch page is closed.