This will look for a download ts link.
        It will then download that file and replace the
        link with the local file.
        :param process_last_line:
        :param path:  str of the path to put the file
        :param chunk: str of the chunk file, note this could have partial lines
        :return:      str of the chunk with the local file link

def download_ts(self, path, chunk, process_last_line=True):
        """
        This will look for a download ts link.
        It will then download that file and replace the
        link with the local file.
        :param process_last_line:
        :param path:  str of the path to put the file
        :param chunk: str of the chunk file, note this could have partial lines
        :return:      str of the chunk with the local file link
        """
        import glob

        ret_chunk = []
        partial_chunk = ''
        lines = chunk.strip().split('\n')
        if not process_last_line:
            partial_chunk = lines.pop()

        for line in lines:
            if line.startswith('http:'):
                ts = '%s/%s.ts' % (path, line.split('.ts?')[0].split('/')[-1])
                relative_ts = '%s/%s.ts' % (
                    path.split('/')[-1], line.split('.ts?')[0].split('/')[-1])
                if not os.path.exists(ts):  # this could be a repeat call
                    # log.debug("Downloading: %s at %s" % (line, time.time()))
                    gevent.spawn(ApiCall.save_url_to_file, line, ts).start()
                    gevent.sleep(0)
                    ret_chunk.append('# ' + line)
                    ret_chunk.append(relative_ts)
                    # log.debug("Done Downloading = %s"%time.time())
                else:
                    ret_chunk = []  # start over
            else:
                ret_chunk.append(line)

        if '#EXT-X-ENDLIST' in chunk:
            self.repeat_needed = 0
            gevent.sleep(0)
        elif chunk.strip():
            self.repeat_needed = 1 + len(glob.glob(path + '/*.ts'))

        ret_chunk = ret_chunk and '\n'.join(ret_chunk) + '\n' or ''
        return ret_chunk, partial_chunk