Closed TongDaDa closed 5 years ago
Your codes are very beautiful, I learned a lot of design patterns of the programme. @aadsm
But, I have some problems below.
if (!isRangeValid(range, fileSize)) {
continue;
}
What means the continue
in that for-loop
, its under codes will execute whether it is true or false that the !isRangeValid(range, fileSize)
@LiuTongTong in that code we're trying to figure out which media tag reader is able to read the metadata from the audio file.
To do that each media tag reader reads a specific section of the file looking for a signature that will identify the metadata.
We don't want to read the entire audio file just for that so we ask each tag reader what are the byte ranges where the signature exists, that's what getTagIdentifierByteRange
returns. We then only load the part of the file that has those byte ranges.
The if/continue you mention acts as a check to make sure the audio file itself is big enough for us to read the byte rages where the signature should be. For example, imagine the signature is in bytes [128-130], if the entire file is only 100bytes then we can't read that range so we skip that, that's why we continue.
Tanks for your suggest! @aadsm
@liutongtong in that code we're trying to figure out which media tag reader is able to read the metadata from the audio file. To do that each media tag reader reads a specific section of the file looking for a signature that will identify the metadata. We don't want to read the entire audio file just for that so we ask each tag reader what are the byte ranges where the signature exists, that's what
getTagIdentifierByteRange
returns. We then only load the part of the file that has those byte ranges. The if/continue you mention acts as a check to make sure the audio file itself is big enough for us to read the byte rages where the signature should be. For example, imagine the signature is in bytes [128-130], if the entire file is only 100bytes then we can't read that range so we skip that, that's why we continue.
OK, I understood your means, thanks for your answer for me.
How do you think? i had changed these files @aadsm
@TongDaDa hey, last weekend I ended up working on another project I have so didn’t have time to review this, sorry about that! I’ll check it this weekend, thank you for contributing!
I’m able to understand your English just fine, it’s not a problem. I’m not a native either :-).
Ok, I like to contribute some open-source projects, so could I develop opened-projects with you?
Ok, I like to contribute some open-source projects, so could I develop opened-projects with you?
Yes, that would be great!
Ok, I like to contribute to some open-source projects, so could I develop opened-projects with you?
Yes, that would be great!
hah, that is great, I'll learn a lot of knowledge about that.
I've just merged and also added you to the list of contributors! https://github.com/aadsm/jsmediatags/blob/master/CONTRIBUTORS.md
Now, for my updated codes, It just supports the type of ArrayBuffer, but It also can support Uint8Array and other Class about binary by get
buffer
property of them. What do you think?