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

badfiles should offer to try fix broken files #5145

Open
tandy-1000 opened this issue Mar 14, 2024 · 2 comments
Open

badfiles should offer to try fix broken files #5145

tandy-1000 opened this issue Mar 14, 2024 · 2 comments
Labels
feature features we would like to implement

Comments

@tandy-1000
Copy link
Contributor

tandy-1000 commented Mar 14, 2024

I've used this guide to fix flac files that badfiles has alerted me to.

flac -VFf --preserve-modtime -o fixed.flac corrupted.flac

mp3val also seems to have the following options:

 mp3val -f -si -nb -t corrupted.mp3

I'd be happy to work on implementing this.

Proposed solution

badfiles should provide the option to automatically try and resolve errors in FLAC and mp3 files.

Objective

It would be useful if badfiles would offer to try and fix errors for FLAC and mp3 files.

Goals

Fixable FLAC and mp3 files should (optionally) be automatically fixed.

Non-goals

This could potentially be extended to resolve errors for other formats, but is out of scope for this feature request.

Anti-goals

This should be optional and not default behaviour.

@tandy-1000 tandy-1000 changed the title badfiles should offer to try fix broken FLAC files badfiles should offer to try fix broken files Mar 14, 2024
@AnonTester
Copy link
Contributor

AnonTester commented Mar 23, 2024

I was just looking at the badfiles plugin for my own config and saw this issue. I might be missing or misunderstand something, but as you can configure the exact commands in the plugin config, not sure what needs to be changed here?

badfiles:
    check_on_import: yes
    commands:
        mp3: mp3val -f -si -nb -t

tested it with manual trigger on some mp3s badfiles reported streaming errors on and the errors got fixed silently.

The badfiles plugin can run whatever command you want and isn't tied to flac or mp3val - just uses mp3val by default. If the flac command doesn't replace the file automatically, you could write a small bash wrapper script to do that for you or use a different command that could replace the file with the fixed version automatically.

@tandy-1000
Copy link
Contributor Author

tandy-1000 commented Apr 4, 2024

That does work for mp3val, thanks for the tip.
However flac requires a -o outfile argument so I can't use the custom command workaround for that.

As you suggested I've written a script:

#!/usr/bin/env bash

INPUT_FILE=${1}
OUTPUT_FILE=${INPUT_FILE}
flac -VFf --preserve-modtime -o "${OUTPUT_FILE}" "${INPUT_FILE}"
badfiles:
  check_on_import: yes
  commands:
    mp3:  mp3val -f -si -nb -t
    flac: /etc/beets/flacfixer.sh

@wisp3rwind wisp3rwind added the feature features we would like to implement label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature features we would like to implement
Projects
None yet
Development

No branches or pull requests

3 participants