X-Git-Url: https://git.rvb.name/vpproxy.git/blobdiff_plain/68a65fd06255411599601a0b9857be6ef2e8eba2..refs/heads/master:/plugins/modules/PlaylistGenerator.py?ds=inline diff --git a/plugins/modules/PlaylistGenerator.py b/plugins/modules/PlaylistGenerator.py index c46197f..4e7654c 100644 --- a/plugins/modules/PlaylistGenerator.py +++ b/plugins/modules/PlaylistGenerator.py @@ -12,7 +12,7 @@ class PlaylistGenerator(object): '#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() @@ -24,6 +24,7 @@ class PlaylistGenerator(object): 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) ''' @@ -34,9 +35,14 @@ class PlaylistGenerator(object): ''' 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): ''' @@ -58,3 +64,17 @@ class PlaylistGenerator(object): 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