I have three functions, that each one of them calls internally the one below it:
- GetBitrateOverHTTP
- GetFilesizeOverHTTP
- Is_ServerSupportHTTPRange
Each function uses an HTTP Request on it’s own. Which means the last function uses only a single HTTP Request, while the first uses three.
The GetBitrateOverHTTP function returns only the bitrate.
These functions work fine on their own, but now I want to get all the three outputs for a specific url.
I thought about:
- Calling all the functions. The problem is that I’ll make 6 HTTP Requests instead of 3.
- Changing the definition of the functions to return others vars as well – but then it doesn’t serve the basic purpose of the function – to return what it’s meant to return.
- Definite another function that doesn’t use these definitions, but it doesn’t seem smart to define again something that has been already coded.
Any help?
I implemented a caching option. I created a dummy file and imported it.
Then I used in the beginning of each function:
and just before the return:
Problem solved 🙂