#!/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 ConfigParser from SourceBase import SourceBase import base64 from collections import OrderedDict import os #sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from resolver import resolve headers2dict = lambda h: dict([l.strip().split(": ") for l in h.strip().splitlines()]) import HTMLParser h = HTMLParser.HTMLParser() class Source(SourceBase): def __init__(self,country=""): self.name = "kinofilmnet" self.title = "KinoFilmNet.lv" self.img = "https://pbs.twimg.com/profile_images/743461209563791361/08RooARb.jpg" self.desc = "Kinofilmnet.lv satura skatīšanās" self.country=country self.headers = headers2dict(""" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,application/json """) self.headers2 = headers2dict(""" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0 X-Requested-With: XMLHttpRequest Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 """) self.url = "http://kinofilmnet.lv/" #self.login() def login(self,user="",password=""): return True ######### Entry point ######## def get_content(self, data): print "[kinofilmnet] 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","","Return back")) if clist=="home": content.extend([ ("Search", "kinofilmnet::search/?q={0};t=0;p=1 ","","Search"), #search/?q={0};t=0;p=1 ("Last movies", "kinofilmnet::jaunakas","","Last movies all"), ("Top50", "kinofilmnet::top50","","Top 50 movies"), ]) r = self.call("") for item in re.findall('