diff --git a/app/eparser/enigma/bouquets.py b/app/eparser/enigma/bouquets.py index 531eabf1..14bcf0dc 100644 --- a/app/eparser/enigma/bouquets.py +++ b/app/eparser/enigma/bouquets.py @@ -1,4 +1,6 @@ """ Module for parsing bouquets """ +import re + from app.eparser.ecommons import BqServiceType, BouquetService, Bouquets, Bouquet, BqType _TV_ROOT_FILE_NAME = "bouquets.tv" @@ -13,32 +15,33 @@ def get_bouquets(path): def write_bouquets(path, bouquets): srv_line = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.{}.{}" ORDER BY bouquet\n' line = [] + pattern = re.compile("[^\w_()]+") for bqs in bouquets: line.clear() line.append("#NAME {}\n".format(bqs.name)) for bq in bqs.bouquets: - line.append(srv_line.format(bq.name.replace(" ", "_"), bq.type)) - write_bouquet(path, bq.name, bq.type, bq.services) + bq_name = re.sub(pattern, "_", bq.name) + line.append(srv_line.format(bq_name, bq.type)) + write_bouquet(path + "userbouquet.{}.{}".format(bq_name, bq.type), bq.name, bq.services) with open(path + "bouquets.{}".format(bqs.type), "w", encoding="utf-8") as file: file.writelines(line) -def write_bouquet(path, name, bq_type, channels): +def write_bouquet(path, name, channels): bouquet = ["#NAME {}\n".format(name)] for ch in channels: if not ch: # if was duplicate continue - if ch.service_type == BqServiceType.IPTV.name or ch.service_type == BqServiceType.MARKER.name: bouquet.append("#SERVICE {}\n".format(ch.fav_id.strip())) else: bouquet.append("#SERVICE {}\n".format(to_bouquet_id(ch))) - with open(path + "userbouquet.{}.{}".format(name.replace(" ", "_"), bq_type), "w", encoding="utf-8") as file: + with open(path, "w", encoding="utf-8") as file: file.writelines(bouquet) diff --git a/app/ui/service_details_dialog.glade b/app/ui/service_details_dialog.glade index 405bad9f..4fe67823 100644 --- a/app/ui/service_details_dialog.glade +++ b/app/ui/service_details_dialog.glade @@ -1,7 +1,7 @@ - + - + @@ -224,6 +224,9 @@ document-properties-symbolic dialog center + + + False @@ -943,24 +946,39 @@ - - True - True - Edit - - - - True - True - 1 - + - + True False - 10 - gtk-edit + 2 + + + True + True + Edit + + + + False + True + 1 + + + + + True + False + 10 + gtk-edit + + + False + True + 2 + + False @@ -1549,6 +1567,9 @@ True True center + + + False