m3u8playlist code refactor