mirror of
https://github.com/saveweb/biliarchiver.git
synced 2024-09-19 11:05:28 -07:00
fix redirect
This commit is contained in:
parent
2d2b4a39bc
commit
6e9bc3e8cd
@ -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 去重
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user