Skip to content

Commit

Permalink
convert: disable album-art embedding for linked files.
Browse files Browse the repository at this point in the history
Fixed flag precedence of link and hardlink over their options.
Fixed formatting issue.
  • Loading branch information
Vexatos committed Aug 20, 2019
1 parent a61aa74 commit 3d23649
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
23 changes: 14 additions & 9 deletions beetsplug/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ def commands(self):
cmd.parser.add_option('-y', '--yes', action='store_true', dest='yes',
help=u'do not ask for confirmation')
cmd.parser.add_option('-l', '--link', action='store_true', dest='link',
help=u'symlink files that do not need transcoding. \
Don\'t use with \'embed\'.')
help=u'symlink files that do not need transcoding.')
cmd.parser.add_option('-H', '--hardlink', action='store_true', dest='hardlink',
help=u'hardlink files that do not need transcoding. \
Overrides --link. Don\'t use with \'embed\'.')
Overrides --link.')
cmd.parser.add_album_option()
cmd.func = self.convert_func
return [cmd]
Expand Down Expand Up @@ -360,7 +359,7 @@ def convert_item(self, dest_dir, keep_new, path_formats, fmt,
item.read()
item.store() # Store new path and audio data.

if self.config['embed']:
if self.config['embed'] and not (link or hardlink):
album = item.get_album()
if album and album.artpath:
self._log.debug(u'embedding album art from {}',
Expand Down Expand Up @@ -479,13 +478,18 @@ def convert_func(self, lib, opts, args):

if opts.link is not None:
link = opts.link

if opts.hardlink is not None:
hardlink = opts.hardlink
else:
hardlink = self.config['hardlink'].get(bool) and not link
else:
link = self.config['link'].get(bool)

if opts.hardlink is not None:
hardlink = opts.hardlink
else:
hardlink = self.config['hardlink'].get(bool)
if opts.hardlink is not None:
hardlink = opts.hardlink
else:
hardlink = self.config['hardlink'].get(bool)

if opts.album:
albums = lib.albums(ui.decargs(args))
Expand All @@ -507,7 +511,8 @@ def convert_func(self, lib, opts, args):

if opts.album and self.config['copy_album_art']:
for album in albums:
self.copy_album_art(album, dest, path_formats, pretend, link, hardlink)
self.copy_album_art(album, dest, path_formats, pretend,
link, hardlink)

convert = [self.convert_item(dest,
opts.keep_new,
Expand Down
8 changes: 4 additions & 4 deletions docs/plugins/convert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ file. The available options are:
to their destination. This option creates symbolic links instead. Note that
options such as ``embed`` that modify the output files after the transcoding
step will cause the original files to be modified as well if ``link`` is
enabled. For this reason, it is highly recommended not use to ``link`` and
``embed`` at the same time.
enabled. For this reason, album-art embedding is disabled
for files that are linked.
Default: ``false``.
- **hardlink**: By default, files that do not need to be transcoded will be
copied to their destination. This option creates hard links instead. Note that
options such as ``embed`` that modify the output files after the transcoding
step will cause the original files to be modified as well if ``hardlink`` is
enabled. For this reason, it is highly recommended not use to ``hardlink`` and
``embed`` at the same time.
enabled. For this reason, album-art embedding is disabled
for files that are linked.
This option overrides ``link``. Only works when converting to a directory
on the same filesystem as the library.
Default: ``false``.
Expand Down

0 comments on commit 3d23649

Please sign in to comment.