mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
play: Insert arguments anywhere (#1532)
This commit is contained in:
parent
ecf677ae41
commit
759c79c426
2 changed files with 18 additions and 1 deletions
|
|
@ -25,6 +25,10 @@ from beets import util
|
|||
from os.path import relpath
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
# Indicate where arguments should be inserted into the command string.
|
||||
# If this is missing, they're placed at the end.
|
||||
ARGS_MARKER = '$args'
|
||||
|
||||
|
||||
class PlayPlugin(BeetsPlugin):
|
||||
|
||||
|
|
@ -63,6 +67,9 @@ class PlayPlugin(BeetsPlugin):
|
|||
|
||||
# Add optional arguments to the player command.
|
||||
if opts.args:
|
||||
if ARGS_MARKER in command_str:
|
||||
command_str = command_str.replace(ARGS_MARKER, opts.args)
|
||||
else:
|
||||
command_str = "{} {}".format(command_str, opts.args)
|
||||
|
||||
# Perform search by album and add folders rather than tracks to
|
||||
|
|
|
|||
|
|
@ -66,3 +66,13 @@ to get beets to execute this command::
|
|||
mplayer -quiet -shuffle /path/to/playlist.m3u
|
||||
|
||||
instead of the default.
|
||||
|
||||
If you need to insert arguments somewhere other than the end of the
|
||||
``command`` string, use ``$args`` to indicate where to insert them. For
|
||||
example::
|
||||
|
||||
play:
|
||||
command: mpv $args --playlist
|
||||
|
||||
indicates that you need to insert extra arguments before specifying the
|
||||
playlist.
|
||||
|
|
|
|||
Loading…
Reference in a new issue