Files
DemonEditor/app/eparser/__init__.py

45 lines
1.7 KiB
Python
Raw Normal View History

2018-01-04 20:58:22 +03:00
from app.commons import run_task
2019-12-22 20:42:29 +03:00
from app.settings import SettingsType
2018-05-12 11:47:19 +03:00
from .ecommons import Service, Satellite, Transponder, Bouquet, Bouquets, is_transponder_valid
2018-01-01 17:28:19 +03:00
from .enigma.blacklist import get_blacklist, write_blacklist
2021-01-06 01:54:10 +03:00
from .enigma.bouquets import to_bouquet_id, BouquetsWriter, BouquetsReader
2018-01-01 23:42:40 +03:00
from .enigma.lamedb import get_services as get_enigma_services, write_services as write_enigma_services
2017-12-08 18:32:28 +03:00
from .iptv import parse_m3u
2018-01-02 17:38:01 +03:00
from .neutrino.bouquets import get_bouquets as get_neutrino_bouquets, write_bouquets as write_neutrino_bouquets
from .neutrino.services import get_services as get_neutrino_services, write_services as write_neutrino_services
2018-01-01 17:28:19 +03:00
from .satxml import get_satellites, write_satellites
2019-12-22 20:42:29 +03:00
def get_services(data_path, s_type, format_version):
if s_type is SettingsType.ENIGMA_2:
2018-06-01 11:16:30 +03:00
return get_enigma_services(data_path, format_version)
2019-12-22 20:42:29 +03:00
elif s_type is SettingsType.NEUTRINO_MP:
2018-01-01 23:42:40 +03:00
return get_neutrino_services(data_path)
2018-01-01 17:28:19 +03:00
2018-01-04 20:58:22 +03:00
@run_task
2019-12-22 20:42:29 +03:00
def write_services(path, channels, s_type, format_version):
if s_type is SettingsType.ENIGMA_2:
2018-06-01 17:45:26 +03:00
write_enigma_services(path, channels, format_version)
2019-12-22 20:42:29 +03:00
elif s_type is SettingsType.NEUTRINO_MP:
2018-01-01 23:42:40 +03:00
write_neutrino_services(path, channels)
2019-12-22 20:42:29 +03:00
def get_bouquets(path, s_type):
if s_type is SettingsType.ENIGMA_2:
2021-01-06 01:54:10 +03:00
return BouquetsReader(path).get()
2019-12-22 20:42:29 +03:00
elif s_type is SettingsType.NEUTRINO_MP:
2018-01-01 23:42:40 +03:00
return get_neutrino_bouquets(path)
2018-01-04 20:58:22 +03:00
@run_task
2020-04-16 11:55:48 +03:00
def write_bouquets(path, bouquets, s_type, force_bq_names=False):
2019-12-22 20:42:29 +03:00
if s_type is SettingsType.ENIGMA_2:
2021-01-06 01:54:10 +03:00
BouquetsWriter(path, bouquets, force_bq_names).write()
2019-12-22 20:42:29 +03:00
elif s_type is SettingsType.NEUTRINO_MP:
2018-01-01 23:42:40 +03:00
write_neutrino_bouquets(path, bouquets)
2017-10-09 22:19:51 +03:00
if __name__ == "__main__":
pass