generate functionWed, 15 Feb 2023

write me a script in python to generate a playlist in the folder there is a file flussonic.conf take the name of the channel from the title line, then take the channel id from this stream line and generate a link channel /index.m3u8 it should look like this #EXTM3U #EXTINF:-1, channel name channel /index.m3u8 and save it to a playlist.m3u file

import re with open("flussonic.conf") as file: for line in file: title ='title (.*)', line) if title: channel_name = stream ='stream (.*)', line) if stream: channel_id = with open("playlist.m3u", "a") as playlist: playlist.write("#EXTM3U\n") playlist.write("#EXTINF:-1,{}\n".format(channel_name)) playlist.write("{}/index.m3u8\n".format(channel_id))

Questions about programming?Chat with your personal AI assistant