Skip to content

[Feature Request]: Prevent options being passed to external player's command #4493

@mooreye

Description

@mooreye

Guidelines

  • I have searched the issue tracker for open and closed issues that are similar to the feature request I want to file, without success.
  • I have searched the documentation for information that matches the description of the feature request I want to file, without success.
  • This issue contains only one feature request.

Problem Description

Currently Freetube passes options like --speed=… or --start=… to external player (mpv in this case). It would be nice to have the ability to ignore them and just pass the video URL.

Proposed Solution

I currently use the following wrapper script to mpv to achieve this, and point external player in settings to it:

#!/usr/bin/bash

set -e
set -uo pipefail

# mpv with non-option arguments only (workaround to ignore playback-affecting options)
literal=0
arguments=()
for arg in "$@"; do
    if [[ $literal == 1 ]]; then
        arguments+=("$arg")
    elif [[ $arg == -- ]]; then
        literal=1
    elif [[ $arg =~ ^- ]]; then
        :
    else
        arguments+=("$arg")
    fi
done

exec mpv "${arguments[@]}"

Alternatives Considered

none

Issue Labels

improvement to existing feature

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions