Skip to content

Commit

Permalink
Merge pull request miyouzi#197 from flizzy420/daemon
Browse files Browse the repository at this point in the history
更新 daemon threads 寫法以消除 deprecated 通知
  • Loading branch information
miyouzi authored Aug 6, 2022
2 parents 8e8da50 + 3233bc8 commit 5ddc25b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Anime.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def download_chunk(uri):
chunk_uri = url_path + '/' + chunk
task = threading.Thread(target=download_chunk, args=(chunk_uri,))
chunk_tasks_list.append(task)
task.setDaemon(True)
task.daemon = True
limiter.acquire()
task.start()

Expand Down Expand Up @@ -799,7 +799,7 @@ def check_ffmpeg_alive():
time_counter = time_counter + 1

ffmpeg_checker = threading.Thread(target=check_ffmpeg_alive) # 检查线程
ffmpeg_checker.setDaemon(True) # 如果 Anime 线程被 kill, 检查进程也应该结束
ffmpeg_checker.daemon = True # 如果 Anime 线程被 kill, 检查进程也应该结束
ffmpeg_checker.start()
run = run_ffmpeg.communicate()
return_str = str(run[1])
Expand Down
16 changes: 8 additions & 8 deletions aniGamerPlus.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def __cui(sn, cui_resolution, cui_download_mode, cui_thread_limit, ep_range,
task = threading.Thread(target=__get_info_only, args=(anime_sn,))
else:
task = threading.Thread(target=__download_only, args=(anime_sn, cui_resolution, cui_save_dir, realtime_show_file_size, classify))
task.setDaemon(True)
task.daemon = True
thread_tasks.append(task)
task.start()
tasks_counter = tasks_counter + 1
Expand Down Expand Up @@ -502,7 +502,7 @@ def __cui(sn, cui_resolution, cui_download_mode, cui_thread_limit, ep_range,
a = threading.Thread(target=__get_info_only, args=(episode_dict[ep],))
else:
a = threading.Thread(target=__download_only, args=(episode_dict[ep], cui_resolution, cui_save_dir, realtime_show_file_size))
a.setDaemon(True)
a.daemon = True
thread_tasks.append(a)
a.start()
tasks_counter = tasks_counter + 1
Expand Down Expand Up @@ -537,7 +537,7 @@ def __cui(sn, cui_resolution, cui_download_mode, cui_thread_limit, ep_range,
a = threading.Thread(target=__get_info_only, args=(sn,))
else:
a = threading.Thread(target=__download_only, args=(sn, cui_resolution, cui_save_dir, realtime_show_file_size))
a.setDaemon(True)
a.daemon = True
thread_tasks.append(a)
a.start()
tasks_counter = tasks_counter + 1
Expand All @@ -559,7 +559,7 @@ def __cui(sn, cui_resolution, cui_download_mode, cui_thread_limit, ep_range,
a = threading.Thread(target=__get_info_only, args=(sn,))
else:
a = threading.Thread(target=__download_only,args=(sn, cui_resolution, cui_save_dir, realtime_show_file_size))
a.setDaemon(True)
a.daemon = True
thread_tasks.append(a)
a.start()
tasks_counter = tasks_counter + 1
Expand Down Expand Up @@ -589,7 +589,7 @@ def __cui(sn, cui_resolution, cui_download_mode, cui_thread_limit, ep_range,
for sn in queue.keys(): # 遍历任务列队
processing_queue.append(sn)
task = threading.Thread(target=worker, args=(sn, queue[sn], realtime_show_file_size))
task.setDaemon(True)
task.daemon = True
thread_tasks.append(task)
task.start()
err_print(sn, '加入任务列隊')
Expand Down Expand Up @@ -665,7 +665,7 @@ def run_gost():
gost_subprocess.communicate()

run_gost_threader = threading.Thread(target=run_gost)
run_gost_threader.setDaemon(True)
run_gost_threader.daemon = True
run_gost_threader.start() # 启动 gost
time.sleep(3) # 给时间让 gost 启动

Expand Down Expand Up @@ -731,7 +731,7 @@ def run_dashboard():

from Dashboard.Server import run as dashboard
server = threading.Thread(target=dashboard)
server.setDaemon(True)
server.daemon = True
server.start()
if settings['dashboard']['SSL']:
dashboard_address = 'https://'
Expand Down Expand Up @@ -930,7 +930,7 @@ def run_dashboard():
for task_sn in queue.keys():
if task_sn not in processing_queue: # 如果该任务没有在进行中,则启动
task = threading.Thread(target=worker, args=(task_sn, queue[task_sn]))
task.setDaemon(True)
task.daemon = True
task.start()
processing_queue.append(task_sn)
new_tasks_counter = new_tasks_counter + 1
Expand Down

0 comments on commit 5ddc25b

Please sign in to comment.