-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
79 lines (55 loc) · 2.1 KB
/
config.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
69
70
71
72
73
74
75
76
77
78
79
import sys
import os
import json
import urllib
import urlparse
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
import load_channels
import hashlib
import re
import server
addon = xbmcaddon.Addon()
addonname = addon.getAddonInfo('name')
addondir = xbmc.translatePath( addon.getAddonInfo('profile') )
def portalConfig(number):
portal = {};
portal['parental'] = addon.getSetting("parental");
portal['password'] = addon.getSetting("password");
portal['name'] = addon.getSetting("portal_name_" + number);
portal['url'] = addon.getSetting("portal_url_" + number);
portal['mac'] = configMac(number);
portal['serial'] = configSerialNumber(number);
return portal;
def configMac(number):
global go;
custom_mac = addon.getSetting('custom_mac_' + number);
portal_mac = addon.getSetting('portal_mac_' + number);
if custom_mac != 'true':
portal_mac = '';
elif not (custom_mac == 'true' and re.match("[0-9a-f]{2}([-:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", portal_mac.lower()) != None):
xbmcgui.Dialog().notification(addonname, 'Custom Mac ' + number + ' is Invalid.', xbmcgui.NOTIFICATION_ERROR );
portal_mac = '';
go=False;
return portal_mac;
def configSerialNumber(number):
global go;
send_serial = addon.getSetting('send_serial_' + number);
custom_serial = addon.getSetting('custom_serial_' + number);
serial_number = addon.getSetting('serial_number_' + number);
device_id = addon.getSetting('device_id_' + number);
device_id2 = addon.getSetting('device_id2_' + number);
signature = addon.getSetting('signature_' + number);
if send_serial != 'true':
return None;
elif send_serial == 'true' and custom_serial == 'false':
return {'custom' : False};
elif send_serial == 'true' and custom_serial == 'true':
if serial_number == '' or device_id == '' or device_id2 == '' or signature == '':
xbmcgui.Dialog().notification(addonname, 'Serial information is invalid.', xbmcgui.NOTIFICATION_ERROR );
go=False;
return None;
return {'custom' : True, 'sn' : serial_number, 'device_id' : device_id, 'device_id2' : device_id2, 'signature' : signature};
return None;