fix redirect

This commit is contained in:
yzqzss 2023-06-07 16:48:10 +08:00
parent 2d2b4a39bc
commit 6e9bc3e8cd
2 changed files with 17 additions and 16 deletions

View File

@ -69,16 +69,16 @@ def _upload_bvid(bvid: str, create_redirect_item: bool=False):
if file.startswith('_'):
continue
filedict[filename] = file
for filename in os.listdir(f'{OLD_videos_basepath}/{local_identifier}'):
file = f'{OLD_videos_basepath}/{local_identifier}/{filename}'
if os.path.isfile(file):
if os.path.basename(file).startswith('_'):
continue
if not os.path.isfile(file):
continue
filedict[filename] = file
break
# for filename in os.listdir(f'{OLD_videos_basepath}/{local_identifier}'):
# file = f'{OLD_videos_basepath}/{local_identifier}/{filename}'
# if os.path.isfile(file):
# if os.path.basename(file).startswith('_'):
# continue
# if not os.path.isfile(file):
# continue
# filedict[filename] = file
# IA 去重

View File

@ -30,14 +30,15 @@ def parse_args():
def main():
args = parse_args()
if args.by_storage_home_dir:
for bvid_with_upper_part in os.listdir(config.storage_home_dir / 'videos'):
bvid = bvid_with_upper_part
if '-' in bvid_with_upper_part:
bvid = bvid_with_upper_part.split('-')[0]
create_redirect_item = True
else:
print('Skipping', bvid)
for bvid_raw in os.listdir(config.storage_home_dir / 'videos'):
if '-' in bvid_raw:
bvid_with_upper_part = bvid_raw.split('-')[0]
print('Skipping', bvid_with_upper_part)
bvid = bvid_with_upper_part
continue
else:
bvid = bvid_raw
create_redirect_item = True
upload_bvid(bvid, create_redirect_item)