#!/usr/bin/env python # coding=utf8 # # This file is part of PlayStream - enigma2 plugin to play video streams from various sources # Copyright (c) 2016 ivars777 (ivars777@gmail.com) # Distributed under the GNU GPL v3. For full terms see http://www.gnu.org/licenses/gpl-3.0.en.html # try: import json except: import simplejson as json import urllib2, urllib import datetime, re, sys, os import ssl if "_create_unverified_context" in dir(ssl): ssl._create_default_https_context = ssl._create_unverified_context from SourceBase import SourceBase API_URL = 'http://replay.lsm.lv/' headers2dict = lambda h: dict([l.strip().split(": ") for l in h.strip().splitlines()]) headers0 = headers2dict(""" User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 """) import HTMLParser h = HTMLParser.HTMLParser() class Source(SourceBase): def __init__(self,country="lv",cfg_path=None): self.hidden = True # nerāda menu nestrādājošos avotus self.name = "play24" self.title = "Play24.lv" self.img = "riga24.png" self.desc = "play24.lv (Riga24TV) satura skatīšanās" self.country=country def get_content(self, data): print "[play24] get_content:", data if "::" in data: data = data.split("::")[1] path = data.split("?")[0] clist = path.split("/")[0] params = data[data.find("?"):] if "?" in data else "" qs = dict(map(lambda x:x.split("="),re.findall("\w+=\w+",params))) lang = qs["lang"] if "lang" in qs else self.country content=[] content.append(("..return", "back","back.png","Return back")) if clist=="home": content.extend([ ("Live stream", "play24::tiesraide","","TV live streams"), ("Last videos", "play24::jaunakie","","Last videos"), ("Categories", "play24::kategorijas","","Categories"), ("Programs", "play24::raidijumi","","Programs"), ]) return content ### Jaunākie video ### elif clist=="jaunakie": url = "http://play24.lv/" r = self._http_request(url) for item in re.findall('