Jan-06-2017, 12:43 AM
Hi all,
Am new here so please be nice :). Also new to python coding and am still learning with a lot more learning to be done.
I have coded a simple Python script which takes an m3u playlist and converts it into an XML that is playable with livestreamer pro addon in kodi, thing is, I can't figure out how to pass .TS links thru f4mproxy only and not any .Mp4 / .Mkv links etc
Am new here so please be nice :). Also new to python coding and am still learning with a lot more learning to be done.
I have coded a simple Python script which takes an m3u playlist and converts it into an XML that is playable with livestreamer pro addon in kodi, thing is, I can't figure out how to pass .TS links thru f4mproxy only and not any .Mp4 / .Mkv links etc
[color=#000000]import os, re ## Enter file location here ie: C:/temp/PythonTests dir = ' ' ## Enter name of playlist less .m3u extension input_file = ' ' input_extn = '.m3u' output_file = input_file+'.xml' in_path = (dir)+'\\'+(input_file)+input_extn out_path = (dir)+'\\'+(output_file) in_file = open(in_path, 'r') in_txt = in_file.read() out_file = open(out_path, 'w') m3u_regex = '#.+,(.+?)\n(.+?)\n' link = in_txt match = re.compile(m3u_regex).findall(link) out_file.write ('<streamingInfos>\n\n') for title, url in match: url = url.replace('&', '&').replace('rtmp://$OPT:rtmp-raw=', '').strip() title = title.strip() out_file.write('<item>\n<title>' + title + '</title>\n<link>plugin://plugin.video.f4mTester/?streamtype=TSDOWNLOADER;name=' + title + '&url=' + url + '</link>\n<thumbnail>' + ' ' + '</thumbnail>\n</item>\n\n') # print('<item>\n<title>' + title + '</title>\n<link>plugin://plugin.video.f4mTester/?streamtype=TSDOWNLOADER&url=' + url + '</link>\n<thumbnail>' + ' ' + '</thumbnail>\n</item>\n\n') out_file.close() in_file.close() [/color]