benfmiller / audalign

Package for aligning audio files through audio fingerprinting
MIT License
84 stars 2 forks source link

"File could not be decoded" should be fatal error #59

Open milahu opened 2 months ago

milahu commented 2 months ago

im passing mka files with flac codec to audalign.align_files but it fails to read all files, and finally throws

File "file1.mka" could not be decoded
File "file2.mka" could not be decoded
File "file3.mka" could not be decoded
Fingerprinting file0.mka
Finished fingerprinting file0.mka
File "file1.mka" could not be decoded
file1.mka: Finding Matches...

Traceback (most recent call last):

  File "/nix/store/f3jqdgjm5qapi1rwm07hp7qjdw59w9zf-audalign-1.2.4/lib/python3.11/site-packages/audalign/recognizers/fingerprint/recognize.py", line 127, in find_matches
    for t_hash in target_mapper.keys():
                  ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'keys'

it also throws when only one file could not be decoded

expected: should throw on the first "File could not be decoded" error assuming the user wants to process all input files

files 1 2 3 were created by ffmpeg -i src1.mkv -map 0:a:0 -c flac -ss $start -to $end file$i.mka

files 0 was created by ffmpeg -i src0.mkv -map 0:a:0 -c flac file0.mka

im passing mka files with flac codec to audalign.align_files

File could not be decoded

fixed by using flac files with flac codec

probably similar issue like #58 - extension != format

benfmiller commented 1 month ago

Thanks for the bug report!

I'm thinking of moving the extension settings from the filehandler into the Config and refactoring so that the decoding is configurable. Default to fail_on_decode_error = True? It would be nice to be able to ignore unspecified file decoding errors if desired.