This commit is contained in:
guorong.zheng 2024-08-27 17:59:40 +08:00
parent c333ab2585
commit bc4c8f5d2f
5 changed files with 16 additions and 16 deletions
main.py
updates
multicast
subscribe
utils

10
main.py

@ -93,7 +93,7 @@ class UpdateSource:
if setting == "open_subscribe":
subscribe_urls = config.get("Settings", "subscribe_urls").split(",")
task = asyncio.create_task(
task_func(urls=subscribe_urls, callback=self.update_progress)
task_func(subscribe_urls, callback=self.update_progress)
)
elif setting == "open_hotel_tonkiang" or setting == "open_hotel_fofa":
task = asyncio.create_task(task_func(self.update_progress))
@ -148,7 +148,7 @@ class UpdateSource:
self.pbar = tqdm_asyncio(total=self.total, desc="Sorting")
self.sort_n = 0
self.channel_data = await process_sort_channel_list(
data=self.channel_data, callback=self.sort_pbar_update
self.channel_data, callback=self.sort_pbar_update
)
no_result_cate_names = [
(cate, name)
@ -181,7 +181,7 @@ class UpdateSource:
self.pbar = tqdm_asyncio(total=self.total, desc="Sorting")
self.sort_n = 0
sup_channel_items = await process_sort_channel_list(
data=sup_channel_items,
sup_channel_items,
callback=self.sort_pbar_update,
)
self.channel_data = merge_objects(
@ -191,8 +191,8 @@ class UpdateSource:
self.pbar = tqdm(total=self.total, desc="Writing")
self.start_time = time()
write_channel_to_file(
items=channel_items_obj_items,
data=self.channel_data,
channel_items_obj_items,
self.channel_data,
callback=lambda: self.pbar_update(name="写入结果"),
)
self.pbar.close()

@ -125,7 +125,7 @@ async def get_multicast_region_result():
"""
multicast_region_urls_info = get_multicast_urls_info_from_region_list()
multicast_result = await get_channels_by_subscribe_urls(
urls=multicast_region_urls_info, multicast=True
multicast_region_urls_info, multicast=True
)
with open(
resource_path("updates/multicast/multicast_region_result.json"),

@ -13,7 +13,7 @@ timeout = 30
async def get_channels_by_subscribe_urls(
urls=None, multicast=False, retry=True, error_print=True, callback=None
urls, multicast=False, retry=True, error_print=True, callback=None
):
"""
Get the channels by subscribe urls

@ -592,7 +592,7 @@ def append_all_method_data_keep_all(
async def sort_channel_list(
semaphore=None, cate=None, name=None, info_list=None, ffmpeg=False, callback=None
semaphore, cate, name, info_list, ffmpeg=False, callback=None
):
"""
Sort the channel list
@ -602,7 +602,7 @@ async def sort_channel_list(
try:
if info_list:
sorted_data = await sort_urls_by_speed_and_resolution(
data=info_list, ffmpeg=ffmpeg
info_list, ffmpeg=ffmpeg
)
if sorted_data:
for (
@ -625,7 +625,7 @@ async def sort_channel_list(
return {"cate": cate, "name": name, "data": data}
async def process_sort_channel_list(data=None, callback=None):
async def process_sort_channel_list(data, callback=None):
"""
Processs the sort channel list
"""
@ -638,10 +638,10 @@ async def process_sort_channel_list(data=None, callback=None):
tasks = [
asyncio.create_task(
sort_channel_list(
semaphore=semaphore,
cate=cate,
name=name,
info_list=info_list,
semaphore,
cate,
name,
info_list,
ffmpeg=is_ffmpeg,
callback=callback,
)
@ -660,7 +660,7 @@ async def process_sort_channel_list(data=None, callback=None):
return data
def write_channel_to_file(items=None, data=None, callback=None):
def write_channel_to_file(items, data, callback=None):
"""
Write channel to file
"""

@ -129,7 +129,7 @@ async def get_info_with_speed(url_info):
return float("inf")
async def sort_urls_by_speed_and_resolution(data=None, ffmpeg=False):
async def sort_urls_by_speed_and_resolution(data, ffmpeg=False):
"""
Sort by speed and resolution
"""