-
Notifications
You must be signed in to change notification settings - Fork 0
/
tv.py
68 lines (58 loc) · 2.34 KB
/
tv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
import client
import model
import control
API_CAT = '/11-ogladaj-tv'
ITEM_CHANNEL = 'box with-border search-item'
IMG_PATERN = 'https://toya.net.pl/telewizja/kanaly/logo/sid/'
class GetInstance:
def __init__(self):
print()
def getChannels(self):
soap = client.authRequest(API_CAT, True)
categories = []
channels = soap.findAll("div", {"class": ITEM_CHANNEL})
if control.debugAddon:
control.logInfo(str(channels))
for channel in channels:
source = channel.find("a").get('href')
entry = channel.find("img", {"class": 'logo'})
name = entry.get('alt')
img = entry.get('src')
categories.append(model.Radio(name, source, img, True))
return categories
def getTvChannels(self, cids):
soap = client.authRequest(API_CAT, True)
chList = []
counter = 0
channels = soap.findAll("div", {"class": ITEM_CHANNEL})
if control.debugAddon:
control.logInfo(str(channels))
for channel in channels:
counter += 1
source = channel.find("a").get('href')
entry = channel.find("img", {"class": 'logo'})
name = entry.get('alt')
img = entry.get('src')
sid = img.replace(IMG_PATERN, '').split('?')[0]
cid = '1111' + sid
cids.append(cid)
chList.append(model.Channel(counter, name, source, img, counter, 'All', cid, None))
return chList
def getTvSource(self, source):
soap = client.authRequest(source, False)
return soap.find("div", {"id": 'player'}).get('data-stream')
def getTvFormat(self, source):
soap = client.authRequest(source, False)
format = soap.find("div", {"id": 'player'}).get('data-format')
if format == 'dash':
format = 'mpd'
else:
format = 'hls'
return format
def getTvLicenseServer(self, source):
soap = client.authRequest(source, False)
return soap.find("div", {"id": 'player'}).get('data-license-server')
def getTvManifesttUrl(self, source):
soap = client.authRequest(source, False)
return soap.find("div", {"id": 'player'}).get('data-manifest-uri')