Add separate classes for local and remote file access #37
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.
I'm using Mp3Info to query the duration of podcasts hosted on a remote HTTP server. These are usually 1 hour or longer and thus between 100 and 250 MB in size. The current version of Mp3Info always downloads these files completely before returning a result which takes a long time.
I've now fanned out the file reading into two classes - one for local files, that works basically the same as the current version. And another class for remote files that only downloads the parts Mp3Info needs to work on. It does that using HTTP Range requests and currently is configured to download 4 kB blocks. So in the best case, this only has to download 8 kB per file (one block at the beginning of the file, one block at the end) for Mp3Info to be able to read the metadata - which takes far less time than downloading the whole file.