'#EXTM3U url-tvg="http://www.teleguide.info/download/new3/jtv.zip"\n'
m3uemptyheader = '#EXTM3U\n'
m3uchanneltemplate = \
- '#EXTINF:-1 group-title="%s" tvg-name="%s" tvg-logo="%s",%s\n%s\n'
+ '#EXTINF:-1 group-title="%s" tvg-name="%s" tvg-logo="%s" country="%s",%s\n%s\n'
def __init__(self):
self.itemlist = list()
name - item name
url - item URL
tvg - item JTV name (optional)
+ country - country of origin (optional)
group - item playlist group (optional)
logo - item logo file name (optional)
'''
'''
Generates EXTINF line with url
'''
+ print(item)
return PlaylistGenerator.m3uchanneltemplate % (
- item.get('group', ''), item.get('tvg', ''), item.get('logo', ''),
- item.get('name'), item.get('url'))
+ item.get('group', ''),
+ item.get('tvg', ''),
+ item.get('logo', ''),
+ item.get('country', ''),
+ item.get('name'),
+ item.get('url'))
def exportm3u(self, hostport, prefix="get", add_ts=False, empty_header=False, archive=False):
'''
itemlist += PlaylistGenerator._generatem3uline(item)
return itemlist
+
+ def dumpm3u(self):
+ '''
+ Dump m3u playlist
+ '''
+ itemlist = PlaylistGenerator.m3uemptyheader
+
+ for item in self.itemlist:
+ item['tvg'] = item.get('tvg', '') if item.get('tvg') else \
+ item.get('name').replace(' ', '_')
+ # For .acelive and .torrent
+ itemlist += PlaylistGenerator._generatem3uline(item)
+
+ return itemlist