This commit is contained in:
guorong.zheng 2024-09-09 18:06:46 +08:00
parent c3d0ef835c
commit 3a7114c01a
9 changed files with 33 additions and 12 deletions

View file

@ -93,7 +93,11 @@ class UpdateSource:
continue
if config.getboolean("Settings", setting):
if setting == "open_subscribe":
subscribe_urls = config.get("Settings", "subscribe_urls").split(",")
subscribe_urls = [
url.strip()
for url in config.get("Settings", "subscribe_urls").split(",")
if url.strip()
]
task = asyncio.create_task(
task_func(subscribe_urls, callback=self.update_progress)
)

View file

@ -71,7 +71,7 @@ class HotelUI:
self.region_list_label.pack(side=tk.LEFT, padx=4, pady=8)
regions = ["全部"] + list(getattr(fofa_map, "region_url").keys())
region_selected_values = [
value
value.strip()
for value in config.get("Settings", "hotel_region_list").split(",")
if value.strip()
]

View file

@ -86,7 +86,7 @@ class MulticastUI:
regions.remove("全部")
regions.insert(0, "全部")
region_selected_values = [
value
value.strip()
for value in config.get("Settings", "multicast_region_list").split(",")
if value.strip()
]

View file

@ -24,7 +24,7 @@ class SelectCombobox(ttk.Combobox):
def on_text_change(self, event):
text_value = self.get().strip()
value_list = [value.strip() for value in text_value.split(",")]
value_list = [value.strip() for value in text_value.split(",") if value.strip()]
self.selected_values = [
value for value in self.selected_values if value in value_list
]

View file

@ -35,7 +35,11 @@ async def get_channels_by_hotel(callback=None):
open_proxy = config.getboolean("Settings", "open_proxy")
open_driver = config.getboolean("Settings", "open_driver")
page_num = config.getint("Settings", "hotel_page_num")
region_list = config.get("Settings", "hotel_region_list").split(",")
region_list = [
region.strip()
for region in config.get("Settings", "hotel_region_list").split(",")
if region.strip()
]
if "all" in region_list or "ALL" in region_list or "全部" in region_list:
fofa_region_name_list = list(getattr(fofa_map, "region_url").keys())
region_list = fofa_region_name_list

View file

@ -103,7 +103,11 @@ def get_multicast_region_result_by_rtp_txt(callback=None):
Get multicast region result by rtp txt
"""
rtp_path = resource_path("config/rtp")
config_region_list = set(config.get("Settings", "multicast_region_list").split(","))
config_region_list = set(
region.strip()
for region in config.get("Settings", "multicast_region_list").split(",")
if region.strip()
)
rtp_file_list = [
filename.rsplit(".", 1)[0]
for filename in os.listdir(rtp_path)

View file

@ -27,7 +27,7 @@ async def get_channels_by_subscribe_urls(
subscribe_results = {}
pattern = r"^(.*?),(?!#genre#)(.*?)$"
subscribe_urls = [
url
url.strip()
for url in config.get("Settings", "subscribe_urls").split(",")
if url.strip()
]

View file

@ -199,7 +199,11 @@ def get_channel_multicast_region_type_list(result):
"""
Get the channel multicast region type list from result
"""
config_region_list = set(config.get("Settings", "multicast_region_list").split(","))
config_region_list = set(
region.strip()
for region in config.get("Settings", "multicast_region_list").split(",")
if region.strip()
)
region_type_list = {
(region, type)
for region_type in result.values()
@ -662,7 +666,11 @@ def get_multicast_fofa_search_urls():
"""
Get the fofa search urls for multicast
"""
config_region_list = config.get("Settings", "multicast_region_list").split(",")
config_region_list = [
region.strip()
for region in config.get("Settings", "multicast_region_list").split(",")
if region.strip()
]
rtp_file_names = []
for filename in os.listdir(resource_path("config/rtp")):
if filename.endswith(".txt") and "_" in filename:

View file

@ -159,9 +159,10 @@ def check_by_domain_blacklist(url):
Check by domain blacklist
"""
domain_blacklist = [
urlparse(domain).netloc if urlparse(domain).scheme else domain
(parsed_domain.netloc if parsed_domain.scheme else stripped_domain)
for domain in config.get("Settings", "domain_blacklist").split(",")
if domain.strip()
if (stripped_domain := domain.strip())
and (parsed_domain := urlparse(stripped_domain))
]
return urlparse(url).netloc not in domain_blacklist
@ -171,7 +172,7 @@ def check_by_url_keywords_blacklist(url):
Check by URL blacklist keywords
"""
url_keywords_blacklist = [
keyword
keyword.strip()
for keyword in config.get("Settings", "url_keywords_blacklist").split(",")
if keyword.strip()
]