Skip to content

Commit

Permalink
feat: add uploader check
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovler-Young committed Dec 1, 2024
1 parent cc5c30b commit adbb893
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion biliarchiver/_biliarchiver_upload_bvid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import time
from typing import List
from urllib.parse import urlparse
from internetarchive import get_item
from internetarchive import get_item, get_username
from requests import Response, HTTPError
from rich import print
from pathlib import Path
Expand Down Expand Up @@ -105,6 +105,12 @@ def _upload_bvid(
item = get_item(remote_identifier)
if item.exists and not update_existing:
print(f"item {remote_identifier} {_('已存在')} (item.exists)")

# check if the user is the same
if item.metadata.get("uploader") != get_username(access_key=access_key, secret_key=secret_key):
print(f"{remote_identifier} {_('不是你上传的,跳过')} (item.metadata.creator)")
return

if item.metadata.get("upload-state") == "uploaded":
print(f"{remote_identifier} {_('已经上传过了,跳过')} (item.metadata.uploaded)")
with open(
Expand Down

0 comments on commit adbb893

Please sign in to comment.