1
0
Fork 0
mirror of https://github.com/LaQuay/TDTChannels.git synced 2024-10-31 22:51:11 +01:00
TDTChannels/script/country.py

44 lines
1.1 KiB
Python
Raw Normal View History

2018-09-22 19:28:28 +02:00
class Country:
def __init__(self, name):
self.name = name
self.ambits = []
def add_ambit(self, ambit):
self.ambits.append(ambit)
2019-01-07 23:45:27 +01:00
def get_ambit(self, ambit_to_get):
for ambit in self.ambits:
2019-01-08 07:38:59 +01:00
if ambit.name == ambit_to_get:
2019-01-07 23:45:27 +01:00
return ambit
return None
2018-09-22 19:28:28 +02:00
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__()
2019-01-26 15:40:27 +01:00
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__()