mirror of
https://github.com/LaQuay/TDTChannels.git
synced 2024-11-27 03:04:58 +01:00
32 lines
723 B
Python
32 lines
723 B
Python
|
class Country:
|
||
|
name = None
|
||
|
ambits = []
|
||
|
|
||
|
def __init__(self, name):
|
||
|
self.name = name
|
||
|
self.ambits = []
|
||
|
|
||
|
def add_ambit(self, ambit):
|
||
|
self.ambits.append(ambit)
|
||
|
|
||
|
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__()
|