代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/DeepCreamPy 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import os
def check_file(input_dir, output_dir, release_version = True):
file_list = []
output_file_list = []
files_removed = []
input_dir = os.listdir(input_dir)
output_dir = os.listdir(output_dir)
for file_in in input_dir:
if not file_in.startswith('.'):
file_list.append(file_in)
if release_version is True:
print("\nChecking valid files...")
for file_out in output_dir:
if file_out.lower().endswith('.png'):
output_file_list.append(file_out)
# solving https://github.com/deeppomf/DeepCreamPy/issues/25
# appending in list with reason as tuple (file name, reason)
for lhs in file_list:
lhs.lower()
if not lhs.lower().endswith('.png') :
files_removed.append((lhs, 0))
for rhs in output_file_list:
if(lhs == rhs):
files_removed.append((lhs, 1))
# seperated detecting same file names and deleting file name list
# just in case of index_error and show list of files which will not go though
# decensor process
print("\n### These files will not be decensored for following reason ###\n")
error_messages(file_list, files_removed)
input("\nPress anything to continue...")
print("\n###################################\n")
return file_list, files_removed
def error_messages(file_list, files_removed):
if files_removed is None:
return
for remove_this, reason in files_removed:
if file_list is not None:
file_list.remove(remove_this)
if reason == 0:
print(" REMOVED : (" + str(remove_this) +") is not PNG file format")
elif reason == 1:
print(" REMOVED : (" + str(remove_this) +") already exists")
elif reason == 2:
print(" REMOVED : (" + str(remove_this) +") file unreadable")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。