mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -07:00
Update vendored beets to 1.6.0
Updates colorama to 0.4.6 Adds confuse version 1.7.0 Updates jellyfish to 0.9.0 Adds mediafile 0.10.1 Updates munkres to 1.1.4 Updates musicbrainzngs to 0.7.1 Updates mutagen to 1.46.0 Updates pyyaml to 6.0 Updates unidecode to 1.3.6
This commit is contained in:
parent
5073ec0c6f
commit
56c6773c6b
385 changed files with 25143 additions and 18080 deletions
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This file is part of beets.
|
||||
# Copyright 2016, David Hamp-Gonsalves
|
||||
#
|
||||
|
@ -15,7 +14,6 @@
|
|||
|
||||
"""Send the results of a query to the configured music player as a playlist.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.ui import Subcommand
|
||||
|
@ -26,6 +24,7 @@ from beets import util
|
|||
from os.path import relpath
|
||||
from tempfile import NamedTemporaryFile
|
||||
import subprocess
|
||||
import shlex
|
||||
|
||||
# Indicate where arguments should be inserted into the command string.
|
||||
# If this is missing, they're placed at the end.
|
||||
|
@ -39,25 +38,25 @@ def play(command_str, selection, paths, open_args, log, item_type='track',
|
|||
"""
|
||||
# Print number of tracks or albums to be played, log command to be run.
|
||||
item_type += 's' if len(selection) > 1 else ''
|
||||
ui.print_(u'Playing {0} {1}.'.format(len(selection), item_type))
|
||||
log.debug(u'executing command: {} {!r}', command_str, open_args)
|
||||
ui.print_('Playing {} {}.'.format(len(selection), item_type))
|
||||
log.debug('executing command: {} {!r}', command_str, open_args)
|
||||
|
||||
try:
|
||||
if keep_open:
|
||||
command = util.shlex_split(command_str)
|
||||
command = shlex.split(command_str)
|
||||
command = command + open_args
|
||||
subprocess.call(command)
|
||||
else:
|
||||
util.interactive_open(open_args, command_str)
|
||||
except OSError as exc:
|
||||
raise ui.UserError(
|
||||
"Could not play the query: {0}".format(exc))
|
||||
f"Could not play the query: {exc}")
|
||||
|
||||
|
||||
class PlayPlugin(BeetsPlugin):
|
||||
|
||||
def __init__(self):
|
||||
super(PlayPlugin, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
config['play'].add({
|
||||
'command': None,
|
||||
|
@ -65,6 +64,7 @@ class PlayPlugin(BeetsPlugin):
|
|||
'relative_to': None,
|
||||
'raw': False,
|
||||
'warning_threshold': 100,
|
||||
'bom': False,
|
||||
})
|
||||
|
||||
self.register_listener('before_choose_candidate',
|
||||
|
@ -73,18 +73,18 @@ class PlayPlugin(BeetsPlugin):
|
|||
def commands(self):
|
||||
play_command = Subcommand(
|
||||
'play',
|
||||
help=u'send music to a player as a playlist'
|
||||
help='send music to a player as a playlist'
|
||||
)
|
||||
play_command.parser.add_album_option()
|
||||
play_command.parser.add_option(
|
||||
u'-A', u'--args',
|
||||
'-A', '--args',
|
||||
action='store',
|
||||
help=u'add additional arguments to the command',
|
||||
help='add additional arguments to the command',
|
||||
)
|
||||
play_command.parser.add_option(
|
||||
u'-y', u'--yes',
|
||||
'-y', '--yes',
|
||||
action="store_true",
|
||||
help=u'skip the warning threshold',
|
||||
help='skip the warning threshold',
|
||||
)
|
||||
play_command.func = self._play_command
|
||||
return [play_command]
|
||||
|
@ -123,7 +123,7 @@ class PlayPlugin(BeetsPlugin):
|
|||
|
||||
if not selection:
|
||||
ui.print_(ui.colorize('text_warning',
|
||||
u'No {0} to play.'.format(item_type)))
|
||||
f'No {item_type} to play.'))
|
||||
return
|
||||
|
||||
open_args = self._playlist_or_paths(paths)
|
||||
|
@ -147,7 +147,7 @@ class PlayPlugin(BeetsPlugin):
|
|||
if ARGS_MARKER in command_str:
|
||||
return command_str.replace(ARGS_MARKER, args)
|
||||
else:
|
||||
return u"{} {}".format(command_str, args)
|
||||
return f"{command_str} {args}"
|
||||
else:
|
||||
# Don't include the marker in the command.
|
||||
return command_str.replace(" " + ARGS_MARKER, "")
|
||||
|
@ -174,10 +174,10 @@ class PlayPlugin(BeetsPlugin):
|
|||
|
||||
ui.print_(ui.colorize(
|
||||
'text_warning',
|
||||
u'You are about to queue {0} {1}.'.format(
|
||||
'You are about to queue {} {}.'.format(
|
||||
len(selection), item_type)))
|
||||
|
||||
if ui.input_options((u'Continue', u'Abort')) == 'a':
|
||||
if ui.input_options(('Continue', 'Abort')) == 'a':
|
||||
return True
|
||||
|
||||
return False
|
||||
|
@ -185,7 +185,12 @@ class PlayPlugin(BeetsPlugin):
|
|||
def _create_tmp_playlist(self, paths_list):
|
||||
"""Create a temporary .m3u file. Return the filename.
|
||||
"""
|
||||
utf8_bom = config['play']['bom'].get(bool)
|
||||
m3u = NamedTemporaryFile('wb', suffix='.m3u', delete=False)
|
||||
|
||||
if utf8_bom:
|
||||
m3u.write(b'\xEF\xBB\xBF')
|
||||
|
||||
for item in paths_list:
|
||||
m3u.write(item + b'\n')
|
||||
m3u.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue