# -*- coding: UTF-8 -*- ''' SVPlayer ANTIK iptv functions (c) 2011 Jan ONDREJ (SAL) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ''' import urllib2, re reg_download = re.compile( r'''onclick="window.open.'/tvarchiv/download.id=([0-9]+)','download'.''' ) reg_time = re.compile(r"""^ * (..:..|.:..) *[\r\n]*$""") reg_name = re.compile(r"""^ +([^<>]+) +[\r\n]*$""") def parse_file(fd): row = [] for line in fd.readlines(): r_download = reg_download.search(line) if r_download: #print r_download.group(1), row.append(r_download.group(1)) r_time = reg_time.search(line) if r_time: #print "%5s" % r_time.group(1), row.append("%5s" % r_time.group(1)) continue r_name = reg_name.search(line) if r_name and r_name.group(1).strip(): #print r_name.group(1).replace(' ', ' ') row.append(r_name.group(1).replace(' ', ' ').strip()) if len(row)==1: yield ['PLAY', row[0]] else: yield row row = [] def parse_prog(prog_url, date=None): if date is None: return [['DATE', 'Select date']] + [[1204844400, 'NOT TODAY']] return list(parse_file( urllib2.urlopen(prog_url % date) ))