Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gapless in M4B causes issue on reimport in beets #15

Open
SenorSmartyPants opened this issue May 19, 2022 · 4 comments
Open

Gapless in M4B causes issue on reimport in beets #15

SenorSmartyPants opened this issue May 19, 2022 · 4 comments
Labels
Blocked On Upstream Blocked on changes to Beets

Comments

@SenorSmartyPants
Copy link
Contributor

If gapless is set in my M4B files and I try to reimport using beets an error is generated. Using Picard to delete gapless removes this error.

beet -c /config/config-audiobook.yaml import -It .
Traceback (most recent call last):
  File "/usr/bin/beet", line 33, in <module>
    sys.exit(load_entry_point('beets==1.6.1', 'console_scripts', 'beet')())
  File "/usr/lib/python3.9/site-packages/beets/ui/__init__.py", line 1304, in main
    _raw_main(args)
  File "/usr/lib/python3.9/site-packages/beets/ui/__init__.py", line 1291, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/lib/python3.9/site-packages/beets/ui/commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "/usr/lib/python3.9/site-packages/beets/ui/commands.py", line 943, in import_files
    session.run()
  File "/usr/lib/python3.9/site-packages/beets/importer.py", line 340, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/lib/python3.9/site-packages/beets/util/pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/usr/lib/python3.9/site-packages/beets/util/pipeline.py", line 260, in run
    msg = next(self.coro)
  File "/usr/lib/python3.9/site-packages/beets/importer.py", line 1320, in read_tasks
    yield from task_factory.tasks()
  File "/usr/lib/python3.9/site-packages/beets/importer.py", line 1145, in tasks
    tasks = self._create(self.album(paths, dirs))
  File "/usr/lib/python3.9/site-packages/beets/importer.py", line 1224, in album
    items = [item for item in items if item]
  File "/usr/lib/python3.9/site-packages/beets/importer.py", line 1224, in <listcomp>
    items = [item for item in items if item]
  File "/usr/lib/python3.9/site-packages/beets/importer.py", line 1273, in read_item
    return library.Item.from_path(path)
  File "/usr/lib/python3.9/site-packages/beets/library.py", line 606, in from_path
    i.read(path)
  File "/usr/lib/python3.9/site-packages/beets/library.py", line 718, in read
    value = getattr(mediafile, key)
  File "/config/.local/lib/python3.9/site-packages/mediafile-0.6.0-py3.9.egg/mediafile.py", line 1198, in __get__
    out = style.get(mediafile.mgfile)
  File "/config/.local/lib/python3.9/site-packages/mediafile-0.6.0-py3.9.egg/mediafile.py", line 487, in get
    return self.deserialize(self.fetch(mutagen_file))
  File "/config/.local/lib/python3.9/site-packages/mediafile-0.6.0-py3.9.egg/mediafile.py", line 494, in fetch
    return mutagen_file[self.key][0]
TypeError: 'bool' object is not subscriptable

M4Bs are typically a single file and I wouldn't think they need gapless set.

@SenorSmartyPants
Copy link
Contributor Author

This may be an issue with the LSIO container as I noticed it has an older mediafile than the latest installed.

@SenorSmartyPants
Copy link
Contributor Author

Something in 616bad0 is causing this issue. I checked out commits until this error didn't occur.

@SenorSmartyPants
Copy link
Contributor Author

Something is wrong in these lines

beets-audible/audible.py

Lines 59 to 62 in 0c50320

gapless = mediafile.MediaField(
mediafile.MP4StorageStyle('pgap', as_type=bool),
)
self.add_media_field('gapless', gapless)

When I comment that out, no error is generated.

@Neurrone
Copy link
Owner

Neurrone commented May 20, 2022

Thanks a lot for the bug report!

I've fixed this by not setting the gapless flag.

I tried setting it to match the audiobook guide, but this seems to be causing more problems than its worth.

I'll leave this open till a better way of setting the flag is found.

@Neurrone Neurrone added the Blocked On Upstream Blocked on changes to Beets label Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked On Upstream Blocked on changes to Beets
Projects
None yet
Development

No branches or pull requests

2 participants