-
Notifications
You must be signed in to change notification settings - Fork 8
Another improvement to aiff thumbnailer #18
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
Conversation
|
Merging.. however, I couldn't find any .aiff files with cover art online. What's the use case for this? Also, I noticed many of these files have an .aif extension, not .aiff. |
|
|
Can you add a sample .aiff file with cover art? Where do you get these files? Where do you download them, or which tool do you use to edit their cover art and generate them under that format? |
|
Regarding the extension:
|
|
I think you can drop this altogether: The thumbnailer already restricts itself by mimetype |
Sure, I created my own application to download high quality tracks from sites like YouTube, SoundCloud, bandcamp (using def embed_cover_in_track(track_path: Path, cover_path: Path) -> None:
"""Embeds the cover image in the track using mutagen. The track must be in .aiff format and the cover image must be in .png format."""
try:
if track_path.suffix != ".aiff" or cover_path.suffix != ".png":
if debug:
print(
"\nCan't embed the cover in the track, wrong extension for the track or cover. Track must be in"
+ " .aiff format and cover in .png format"
)
return
if debug:
print(f'\nEmbedding cover: "{str(cover_path)}" inside the track: "{str(track_path)}"')
aiff_file: AIFF = AIFF(str(track_path))
if aiff_file.tags is None:
aiff_file.add_tags()
aiff_file.tags.add( # pyright: ignore[reportUnknownMemberType, reportOptionalMemberAccess]
frame=APIC(
encoding=3,
mime="image/png", # image/jpeg or image/png
type=3, # 3 is for the cover image
desc="Cover",
data=cover_path.open(mode="rb").read(),
)
)
aiff_file.save() # pyright: ignore[reportUnknownMemberType]
if debug:
print(" Cover embedded correctly.")
except Exception as e:
print("An error occurred embedding the cover to the track.")
if debug:
traceback.print_exception(e)The same functionallity can be achieved using C library This would be an example of an |
Got you, I'll create another PR deleting this part to not check the extension. |
|
There might be another issue.. I can get your thumbnailer to work with the indira song when I call it via CLI, but nemo still doesn't generate thumbs for me. |
|
Feel free to add aiff to the readme also. |
Hmm do you see any logs if you launch nemo via CLI? I'm using |
Done in #19 |
sys.exit(n) raises a SystemExit exception, which was being caught by the bare exception handler, causing a failure exit code. ref: #18 (comment)

Sorry for the amount of PRs created for such small changes but this one is to ensure that the thumbnailer would work for files with
.aiffextension and.AIFF(capitalized) extension.