Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
x1jumping committed Sep 19, 2023
1 parent 19e08af commit c021a0b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions generate_pic.conf_without_urls.txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
import sys
import os
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import ThreadPoolExecutor, wait
import threading
import hashlib
import base64
Expand Down Expand Up @@ -103,17 +103,17 @@ def get_urls_in_md_file_and_generate(md_file: str, re_obj_list, re_obj_for_galle
if is_vaild_url(res_url) and res_url not in url_list:

url_list.append(res_url)
pool_for_write_file.submit(write_file,bak_file, res_url,
file_to_w, cdn_list=cdn_list)
threading_list.append(pool_for_write_file.submit(write_file,bak_file, res_url,
file_to_w, cdn_list=cdn_list))
re_res_gallery_tag = re_obj_for_gallery_tag.findall(md_file) #读取文件中的url
for res in re_res_gallery_tag:
re_res_pic_tag = re_obj_for_pic_tag.findall(res)
for res_url in re_res_pic_tag:
res_url = res_url.replace('\n', '')
if is_vaild_url(res_url) and res_url not in url_list:
url_list.append(res_url)
pool_for_write_file.submit(write_file,bak_file, res_url,
file_to_w, cdn_list=cdn_list)
threading_list.append(pool_for_write_file.submit(write_file,bak_file, res_url,
file_to_w, cdn_list=cdn_list))



Expand All @@ -124,6 +124,7 @@ def get_urls_in_md_file_and_generate(md_file: str, re_obj_list, re_obj_for_galle
re_obj_for_gallery_tag = re.compile(r'\{\s*%\s*gallery([\s\S]*)endgallery\s*%\s*\}')
re_obj_for_pic_tag = re.compile(r'!.*\((.*)\)')
url_list = []
threading_list = []
try:
os.remove('./pic.bak.conf')
except:
Expand Down Expand Up @@ -153,5 +154,5 @@ def get_urls_in_md_file_and_generate(md_file: str, re_obj_list, re_obj_for_galle
re_obj_for_gallery_tag, re_obj_for_pic_tag,bak_file) #读取md文件后写入custom.conf

pool.shutdown()
pool_for_write_file.shutdown()
wait(threading_list)
print('done!')

0 comments on commit c021a0b

Please sign in to comment.