mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -07:00
Update beets to 1.4.7
Also updates: - colorama-0.4.1 - jellyfish-0.6.1 - munkres-1.0.12 - musicbrainzngs-0.6 - mutagen-1.41.1 - pyyaml-3.13 - six-1.12.0 - unidecode-1.0.23
This commit is contained in:
parent
05b0fb498f
commit
e854005ae1
193 changed files with 15896 additions and 6384 deletions
|
@ -20,13 +20,35 @@ import os.path
|
|||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import ui
|
||||
from beets.ui import decargs
|
||||
from beets.ui import print_, decargs
|
||||
from beets.util import syspath, normpath, displayable_path, bytestring_path
|
||||
from beets.util.artresizer import ArtResizer
|
||||
from beets import config
|
||||
from beets import art
|
||||
|
||||
|
||||
def _confirm(objs, album):
|
||||
"""Show the list of affected objects (items or albums) and confirm
|
||||
that the user wants to modify their artwork.
|
||||
|
||||
`album` is a Boolean indicating whether these are albums (as opposed
|
||||
to items).
|
||||
"""
|
||||
noun = u'album' if album else u'file'
|
||||
prompt = u'Modify artwork for {} {}{} (Y/n)?'.format(
|
||||
len(objs),
|
||||
noun,
|
||||
u's' if len(objs) > 1 else u''
|
||||
)
|
||||
|
||||
# Show all the items or albums.
|
||||
for obj in objs:
|
||||
print_(format(obj))
|
||||
|
||||
# Confirm with user.
|
||||
return ui.input_yn(prompt)
|
||||
|
||||
|
||||
class EmbedCoverArtPlugin(BeetsPlugin):
|
||||
"""Allows albumart to be embedded into the actual files.
|
||||
"""
|
||||
|
@ -60,6 +82,9 @@ class EmbedCoverArtPlugin(BeetsPlugin):
|
|||
embed_cmd.parser.add_option(
|
||||
u'-f', u'--file', metavar='PATH', help=u'the image file to embed'
|
||||
)
|
||||
embed_cmd.parser.add_option(
|
||||
u"-y", u"--yes", action="store_true", help=u"skip confirmation"
|
||||
)
|
||||
maxwidth = self.config['maxwidth'].get(int)
|
||||
compare_threshold = self.config['compare_threshold'].get(int)
|
||||
ifempty = self.config['ifempty'].get(bool)
|
||||
|
@ -71,11 +96,24 @@ class EmbedCoverArtPlugin(BeetsPlugin):
|
|||
raise ui.UserError(u'image file {0} not found'.format(
|
||||
displayable_path(imagepath)
|
||||
))
|
||||
for item in lib.items(decargs(args)):
|
||||
|
||||
items = lib.items(decargs(args))
|
||||
|
||||
# Confirm with user.
|
||||
if not opts.yes and not _confirm(items, not opts.file):
|
||||
return
|
||||
|
||||
for item in items:
|
||||
art.embed_item(self._log, item, imagepath, maxwidth, None,
|
||||
compare_threshold, ifempty)
|
||||
else:
|
||||
for album in lib.albums(decargs(args)):
|
||||
albums = lib.albums(decargs(args))
|
||||
|
||||
# Confirm with user.
|
||||
if not opts.yes and not _confirm(albums, not opts.file):
|
||||
return
|
||||
|
||||
for album in albums:
|
||||
art.embed_album(self._log, album, maxwidth, False,
|
||||
compare_threshold, ifempty)
|
||||
self.remove_artfile(album)
|
||||
|
@ -107,7 +145,7 @@ class EmbedCoverArtPlugin(BeetsPlugin):
|
|||
else:
|
||||
filename = bytestring_path(opts.filename or
|
||||
config['art_filename'].get())
|
||||
if os.path.dirname(filename) != '':
|
||||
if os.path.dirname(filename) != b'':
|
||||
self._log.error(
|
||||
u"Only specify a name rather than a path for -n")
|
||||
return
|
||||
|
@ -125,8 +163,15 @@ class EmbedCoverArtPlugin(BeetsPlugin):
|
|||
'clearart',
|
||||
help=u'remove images from file metadata',
|
||||
)
|
||||
clear_cmd.parser.add_option(
|
||||
u"-y", u"--yes", action="store_true", help=u"skip confirmation"
|
||||
)
|
||||
|
||||
def clear_func(lib, opts, args):
|
||||
items = lib.items(decargs(args))
|
||||
# Confirm with user.
|
||||
if not opts.yes and not _confirm(items, False):
|
||||
return
|
||||
art.clear(self._log, lib, decargs(args))
|
||||
clear_cmd.func = clear_func
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue