# -*- coding: utf-8 -*-
r"""B101: gom ảnh gốc hiện có vào thư mục AGY + chép BOI_CANH/YEU_CAU, in danh sách."""
import glob, os, shutil

NGUON = r'C:\Claw 2\QC\images\_zalo_tri_1310_full'
DICH = r'C:\Claw 2\QC\images\_agy_tri_1310'
os.makedirs(DICH, exist_ok=True)
for f in glob.glob(os.path.join(DICH, '*.jpg')):
    os.remove(f)
ds = sorted(glob.glob(os.path.join(NGUON, 'goc_*.jpg')))
for i, f in enumerate(ds, 1):
    ten = os.path.join(DICH, 'tri1310_%02d.jpg' % i)
    shutil.copy2(f, ten)
    from PIL import Image
    im = Image.open(ten)
    print('  %-18s %8d B  %sx%s  <- %s' % (os.path.basename(ten), os.path.getsize(ten), im.width, im.height, os.path.basename(f)))
for t in ('BOI_CANH.txt', 'YEU_CAU.txt'):
    p = os.path.join(NGUON, t)
    if os.path.exists(p):
        shutil.copy2(p, os.path.join(DICH, t))
print('  tổng %d ảnh gốc -> %s' % (len(ds), DICH))
