forked from LaQuay/TDTChannels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcountry.py
43 lines (35 loc) · 1.07 KB
/
country.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
class Country:
def __init__(self, name):
self.name = name
self.ambits = []
def add_ambit(self, ambit):
self.ambits.append(ambit)
def get_ambit(self, ambit_to_get):
for ambit in self.ambits:
if ambit.name == ambit_to_get:
return ambit
return None
def __ambits_to_json__(self):
ambits_list = []
for ambit in self.ambits:
ambits_list.append(ambit.to_json())
return ambits_list
def to_json(self):
return {
"name": self.name,
"ambits": self.__ambits_to_json__()
}
def __ambits_to_m3u8__(self):
ambits_list = ""
for ambit in self.ambits:
ambits_list += ambit.to_m3u8()
return ambits_list
def to_m3u8(self):
return self.__ambits_to_m3u8__()
def __ambits_to_enigma2__(self):
ambits_list = ""
for ambit in self.ambits:
ambits_list += ambit.to_enigma2()
return ambits_list
def to_enigma2(self):
return self.__ambits_to_enigma2__()