fix[resample/main]: .flac rebuild block type check breaks as fr.block_type is not bytes#30
Open
samicrusader wants to merge 1 commit intosrrDB:masterfrom
Open
fix[resample/main]: .flac rebuild block type check breaks as fr.block_type is not bytes#30samicrusader wants to merge 1 commit intosrrDB:masterfrom
samicrusader wants to merge 1 commit intosrrDB:masterfrom
Conversation
…_type is not bytes `fr.block_type` as in resample/flac.py is `str`; doing a comparison to a array of `bytes` doesn't work and causes a TypeError. using `ord()` in fix incase `block_type` ends up as `int` or `bytes` as seen when just `print()`ing it when testing; `fr.block_type` is seen as integer "115" in test file, causing another TypeError
Author
|
This will probably fix #23. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When going through some .flac releases with
retag, I encountered an error withresample:fr.block_typeas in resample/flac.py is usually aintas it's just unpacked from it's byte form; but is alsostrwhen dealing with the flac header "fLaC"; but files improperly tagged with ID3 tagging has block types "ID3" and "TAG".Strings can't be compared to
bytesin abytearray; instead check against theordinal values of "s", "t" and "u", which can be compared againstbytes,strings andintegers. This allows the release to be rebuilt.The release used,
Fatboy_Slim-The_Rockafeller_Skank-CDM-FLAC-1998-c05_INT, uses ID3 tagging which introducesblock_types "ID3" and "TAG". The "fLaC" type is checked against explicitly; the error I'm seeing is after the flac header check fails over into theelif.Adding a
print(fr.block_type, type(fr.block_type))to thefr.read()whileloop shows this:-= Links for testing =-
The SRR used: https://www.srrdb.com/download/srr/Fatboy_Slim-The_Rockafeller_Skank-CDM-FLAC-1998-c05_INT
The release itself: https://tanizaki.angelicdust.net/Fatboy_Slim-The_Rockafeller_Skank-CDM-FLAC-1998-c05_INT.zip