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 line and generate a link http://server-1.mitv-iptv.ru:80/id channel /index.m3u8 it should look like this #EXTM3U #EXTINF:-1, channel name http://server-1.mitv-iptv.ru:80/id channel /index.m3u8

def playlist(file): with open(file, 'r') as f: lines = f.readlines() for line in lines: if line.startswith('title'): title = line.split('=')[1].strip() if line.startswith('playlist') and 'm3u8' in line: id = line.split('/')[2].strip() url = 'http://server-1.mitv-iptv.ru:80/{}/index.m3u8'.format(id) print('#EXTINF:-1, {}'.format(title)) print(url) playlist('flussonic.conf')

Questions about programming?Chat with your personal AI assistant