What’s done in spare time (segment catching experiment)

This is a first live example of how to download file segments (for example video files) from a single playlist (like a m3u-manifest) by only using netcurl as a download library, and what sometimes happens on spare time.

The project can be watched at https://github.com/Tornevall/netcurl-segment-catcher or https://bitbucket.tornevall.net/users/tornevall/repos/mpd-netcurl/browse.

So what is this?

Basically, it is an example of what people can’t explain. Once upon a time, I got curious on how playlist manifests was built and how they could be downloaded and merged into one file. The most common way to do this with for example a shell script was to simply use curl from the command line:

curl -s <url> >manifest.file
cat -s manifest.file |grep -v ^#| awk '{system("curl -sS <extraUrlData>"$1 " >>merge.file")}'    

However, I quickly realized that it wan’t enough, since some playlists was delivered with multiple segments. By just downloading everything into same joined filed could simply destroy the content, or disrupt it. On this journey, I realized that I actually could use the tornelib-php-netcurl library to do the dirty work for me. So I wrote this project, to see whether it worked or now. It better, since it has been widely used in various ecommerce project, where reachability is the primary key to success. However, this was about binary files, so the expectations with netcurl project was quite high. If it, in reality, can’t handle binaries I can just throw it to the garbage.

So here we are with the first successful live example of how to use a binary safe downloader to fetch multiple segments from a playlist. The linked project has a README-file that explains more.