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 and save it to a playlist.m3u file

import os def main(): file = open('flussonic.conf', 'r') file = file.readlines() for i in file: if i[0] == 't': title = i if i[0] == 'u': id = i title = title[7:-2] id = id[12:-1] playlist = '#EXTM3U\n#EXTINF:-1,' + title + '\nhttp://server-1.mitv-iptv.ru:80/' + id + '/index.m3u8' playlist_file = open('playlist.m3u', 'w') playlist_file.write(playlist) playlist_file.close() if __name__ == '__main__': main()

Questions about programming?Chat with your personal AI assistant