"Composer" and "Genre" metadata fields for M4B files are now editable from the text editor, update Readme

This commit is contained in:
Deniz Şafak
2025-05-27 12:49:53 +03:00
parent c5174d2c0a
commit 26d4481ee1
4 changed files with 30 additions and 5 deletions
+1
View File
@@ -1,5 +1,6 @@
# v1.0.9 (pre-release) # v1.0.9 (pre-release)
- Changed audio processing pipeline back to converting temporary WAV files instead of directly creating OPUS and M4B files. This resolves memory outage issues with long books that caused crashes, unresponsive behavior, or corrupted audio output. **This approach will be slower, but it is more stable and reliable.** - Changed audio processing pipeline back to converting temporary WAV files instead of directly creating OPUS and M4B files. This resolves memory outage issues with long books that caused crashes, unresponsive behavior, or corrupted audio output. **This approach will be slower, but it is more stable and reliable.**
- "Composer" and "Genre" metadata fields for M4B files are now editable from the text editor.
# v1.0.8 # v1.0.8
- Added support for AMD GPUs in Linux (Special thanks to @hg000125 for his contribution in #23) - Added support for AMD GPUs in Linux (Special thanks to @hg000125 for his contribution in #23)
+11
View File
@@ -166,6 +166,17 @@ When you process the text file, Abogen will detect these markers automatically a
![Abogen Chapter Marker](https://raw.githubusercontent.com/denizsafak/abogen/refs/heads/main/demo/chapter_marker.png) ![Abogen Chapter Marker](https://raw.githubusercontent.com/denizsafak/abogen/refs/heads/main/demo/chapter_marker.png)
## `About Metadata Tags`
Similar to chapter markers, it is possible to add metadata tags to `M4B` files. This is useful for audiobook players that support metadata, allowing you to add information like title, author, year, etc. Abogen automatically adds these tags when you process ePUB or PDF files, but you can also add them manually to your text files. Add metadata tags **at the beginning of your text file** like this:
```
<<METADATA_TITLE:Title>>
<<METADATA_ARTIST:Author>>
<<METADATA_ALBUM:Album Title>>
<<METADATA_YEAR:Year>>
<<METADATA_ALBUM_ARTIST:Album Artist>>
<<METADATA_COMPOSER:Narrator>>
<<METADATA_GENRE:Audiobook>>
```
## `Supported Languages` ## `Supported Languages`
``` ```
+3 -1
View File
@@ -1649,7 +1649,9 @@ class HandlerDialog(QDialog):
f"<<METADATA_ARTIST:{authors_text}>>", f"<<METADATA_ARTIST:{authors_text}>>",
f"<<METADATA_ALBUM:{title} ({chapter_text})>>", f"<<METADATA_ALBUM:{title} ({chapter_text})>>",
f"<<METADATA_YEAR:{year}>>", f"<<METADATA_YEAR:{year}>>",
f"<<METADATA_ALBUM_ARTIST:{album_artist}>>" f"<<METADATA_ALBUM_ARTIST:{album_artist}>>",
f"<<METADATA_COMPOSER:Narrator>>",
f"<<METADATA_GENRE:Audiobook>>"
] ]
return "\n".join(metadata_tags) return "\n".join(metadata_tags)
+15 -4
View File
@@ -751,10 +751,7 @@ class ConversionThread(QThread):
"-map", "0:a", "-map", "0:a",
"-map_metadata", "1", "-map_metadata", "1",
"-map_chapters", "1", "-map_chapters", "1",
# Add metadata tags # Add extracted metadata tags
"-metadata", "composer=Narrator",
"-metadata", "genre=Audiobook",
# Add additional extracted metadata tags
*metadata_options, *metadata_options,
"-c:a", "aac", "-c:a", "aac",
"-movflags", "+faststart+use_metadata_tags", "-movflags", "+faststart+use_metadata_tags",
@@ -843,6 +840,8 @@ class ConversionThread(QThread):
album_match = re.search(r"<<METADATA_ALBUM:([^>]*)>>", text) album_match = re.search(r"<<METADATA_ALBUM:([^>]*)>>", text)
year_match = re.search(r"<<METADATA_YEAR:([^>]*)>>", text) year_match = re.search(r"<<METADATA_YEAR:([^>]*)>>", text)
album_artist_match = re.search(r"<<METADATA_ALBUM_ARTIST:([^>]*)>>", text) album_artist_match = re.search(r"<<METADATA_ALBUM_ARTIST:([^>]*)>>", text)
composer_match = re.search(r"<<METADATA_COMPOSER:([^>]*)>>", text)
genre_match = re.search(r"<<METADATA_GENRE:([^>]*)>>", text)
# Use display path or filename as fallback for title # Use display path or filename as fallback for title
filename = os.path.splitext(os.path.basename(self.display_path if self.display_path else self.file_name))[0] filename = os.path.splitext(os.path.basename(self.display_path if self.display_path else self.file_name))[0]
@@ -879,6 +878,18 @@ class ConversionThread(QThread):
else: else:
metadata_options.extend(["-metadata", f"album_artist=Unknown"]) metadata_options.extend(["-metadata", f"album_artist=Unknown"])
# Add composer metadata
if composer_match:
metadata_options.extend(["-metadata", f"composer={composer_match.group(1)}"])
else:
metadata_options.extend(["-metadata", f"composer=Narrator"])
# Add genre metadata
if genre_match:
metadata_options.extend(["-metadata", f"genre={genre_match.group(1)}"])
else:
metadata_options.extend(["-metadata", f"genre=Audiobook"])
# Add these to ffmpeg command # Add these to ffmpeg command
return metadata_options return metadata_options