Skip to content

Commit

Permalink
Do not set the gapless flag on m4b files, as it seems to cause errors on
Browse files Browse the repository at this point in the history
a reimport

See #15
  • Loading branch information
Neurrone committed May 20, 2022
1 parent 0c50320 commit b266141
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
8 changes: 1 addition & 7 deletions audible.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ def __init__(self):
mediafile.MP4StorageStyle('shwm', as_type=int),
)
self.add_media_field('show_movement', show_movement)
gapless = mediafile.MediaField(
mediafile.MP4StorageStyle('pgap', as_type=bool),
)
self.add_media_field('gapless', gapless)

series_name = mediafile.MediaField(
mediafile.MP3StorageStyle(u'MVNM'),
Expand Down Expand Up @@ -165,7 +161,7 @@ def candidates(self, items, artist, album, va_likely, extra_tags=None):
# is technically possible (based on the API) but unsure how often it happens
self._log.warn(f"Chapter data for {a.album} could be inaccurate.")

if is_likely_match and not (is_chapterized and self.config['match_chapters']):
if is_likely_match and (not is_chapterized or not self.config['match_chapters']):
self._log.debug(f"Attempting to match book: album {album} with {len(items)} files to book {a.album} with {len(a.tracks)} chapters.")

common_track_attributes = dict(a.tracks[0])
Expand All @@ -180,7 +176,6 @@ def candidates(self, items, artist, album, va_likely, extra_tags=None):
# using the bytestring_path function from Beets is needed for correctness
# I was noticing inaccurate sorting if using str to convert paths to strings
naturally_sorted_items = os_sorted(items, key=lambda i: util.bytestring_path(i.path))

a.tracks = [
TrackInfo(**common_track_attributes, title=item.title, length=item.length, index=i+1)
for i, item in enumerate(naturally_sorted_items)
Expand Down Expand Up @@ -362,7 +357,6 @@ def on_write(self, item, path, tags):
if path.endswith(b"m4b"):
# audiobook media type, see https://exiftool.org/TagNames/QuickTime.html
tags["itunes_media_type"] = 2
tags["gapless"] = True
if tags.get("series_name"):
tags["show_movement"] = 1
try:
Expand Down
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ The plugin writes the following tags:
| `TPUB` (PUBLISHER) | Publisher |
| `ASIN` (ASIN) | Amazon Standard Identification Number |
| `stik` (media type), m4b only | 2 (audiobook) |
| `pgap` (gapless), m4b only | true |
| `shwm` (show movement), m4b only | 1 if part of a series |
| `MVNM` (MOVEMENTNAME) | Series |
| `MVIN` / `MVI` for m4b files (MOVEMENT) | Series Book # |
Expand Down

0 comments on commit b266141

Please sign in to comment.