create pics.json

This commit is contained in:
ClF3 2024-04-29 14:09:13 +08:00
parent 882fe5e8a3
commit 779c3f09d1
3 changed files with 19 additions and 2 deletions

View File

@ -1 +1,9 @@
{ "original": "../pictures", "webp": "../webp1", "quality": 90, "container": "tmp", "remote": "", "local": "../pictures", "ignore": []}
{
"original": "../pictures",
"webp": "../webp",
"quality": 90,
"container": "tianyi-random",
"remote": "",
"local": "../webp",
"ignore": []
}

1
pics.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,9 @@ from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
import argparse
import json
defaults=json.load(open('defaults.json'))
parser = argparse.ArgumentParser()
parser.add_argument('--container', help='Name of the container', default=defaults['container'])
parser.add_argument('--remote', help='Path to the remote images', default=defaults['remote'])
@ -12,6 +14,8 @@ parser.add_argument('--ignore', help='Files to ignore', default=defaults['ignore
parser.add_argument('--overwrite', help='Overwrite existing images', action='store_true')
args=parser.parse_args()
pics=[]
if args.remote!='' and args.remote[-1] != '/':
args.remote += '/'
@ -24,6 +28,7 @@ try:
for root,fir,files in os.walk(args.local):
for file in files:
pics.append(file)
if file in args.ignore:
print("ignored: " + file)
continue
@ -49,3 +54,6 @@ try:
except Exception as ex:
print('Exception:')
print(ex)
finally:
json.dump(pics, open('pics.json', 'w'))