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

Audio cover preview support #1022

Closed
1 task done
gaesa opened this issue May 9, 2024 · 1 comment
Closed
1 task done

Audio cover preview support #1022

gaesa opened this issue May 9, 2024 · 1 comment
Labels
invalid This doesn't seem right

Comments

@gaesa
Copy link

gaesa commented May 9, 2024

Please describe the problem you're trying to solve

Without the proposed feature, the current state of audio file navigation in the application is not as intuitive or visually engaging as it could be. Users are only able to view metadata, which may not provide enough visual cues to quickly and easily identify specific audio files. This can lead to a less efficient and enjoyable user experience, especially for those with large collections of audio files with cover art.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

The proposed solution involves checking if an audio file has a cover using the lofty library in Rust. If a cover is present, it will be used for the preview. If not, the program will fall back to previewing the audio's metadata. Here is a sample code snippet demonstrating this:

use lofty::file::TaggedFileExt;
use lofty::probe::Probe;

fn audio_has_cover<P: AsRef<Path>>(path: P) -> bool {
    return match Probe::open(path) {
        Ok(p) => {
            let tagged_file = match p.read().ok() {
                Some(file) => file,
                None => return false,
            };
            let tag = match tagged_file.primary_tag() {
                Some(tag) => tag,
                None => return false,
            };
            tag.picture_count() > 0
        }
        Err(_) => false,
    };
}

If the audio file has a cover, the following ffmpeg command can be used to generate the thumbnail:

[
    "/usr/bin/ffmpeg",
    "-i",
    audio,
    "-an",
    "-vcodec",
    "copy",
    thumbnail_path,
]

Additional context

No response

@gaesa gaesa added the feature New feature request label May 9, 2024
@sxyazi
Copy link
Owner

sxyazi commented May 9, 2024

Hi, https://github.com/Sonico98/exifaudio.yazi is exactly what you're looking for:

302044743-53c1492c-9f05-4c80-a4e7-94fb36f35ca9

You can find more awesome plugins at https://yazi-rs.github.io/docs/resources

@sxyazi sxyazi closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
@sxyazi sxyazi added invalid This doesn't seem right and removed feature New feature request labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants