From 94d83d172ed57e62c433c44825fde02c3775d15a Mon Sep 17 00:00:00 2001 From: Leslie Van Date: Mon, 29 May 2023 15:55:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?-=20=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E4=B8=BA=201513?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.spec | 2 +- utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.spec b/main.spec index cc4afdd..5db883b 100644 --- a/main.spec +++ b/main.spec @@ -46,5 +46,5 @@ coll = COLLECT( strip=False, upx=True, upx_exclude=[], - name='semi-utils-build1512', + name='semi-utils-build1513', ) diff --git a/utils.py b/utils.py index 490332a..373a4bc 100644 --- a/utils.py +++ b/utils.py @@ -69,8 +69,8 @@ def get_exif(path) -> dict: value_clean = ''.join(c for c in value_normalized if ord(c) < 128) # 将处理后的值更新到 exif_dict 中 exif_dict[key] = value_clean - except: - logger.error(f'get_exif error: {path}') + except Exception as e: + logger.error(f'get_exif error: {path} : {e}') return exif_dict From 0c5a4d76dc29bd7abffb9476912fd514ca746df4 Mon Sep 17 00:00:00 2001 From: Leslie Van Date: Mon, 29 May 2023 16:07:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=AF=BB=E5=8F=96ps=E9=99=8D=E5=99=AA?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=90=8E=E7=9A=84=E5=9B=BE=E7=89=87=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/utils.py b/utils.py index 373a4bc..2ac9e5a 100644 --- a/utils.py +++ b/utils.py @@ -61,12 +61,8 @@ def get_exif(path) -> dict: # 将键值对添加到字典中 exif_dict[key] = value for key, value in exif_dict.items(): - # 将 value 转换成 Unicode 字符串 - value_unicode = value.encode('utf-8').decode('unicode_escape') - # 将字符串进行标准化 - value_normalized = unicodedata.normalize('NFKD', value_unicode) # 过滤非 ASCII 字符 - value_clean = ''.join(c for c in value_normalized if ord(c) < 128) + value_clean = ''.join(c for c in value if ord(c) < 128) # 将处理后的值更新到 exif_dict 中 exif_dict[key] = value_clean except Exception as e: From 8fba6db8463806fd7374684776bf4e5c99627fae Mon Sep 17 00:00:00 2001 From: Leslie Van Date: Tue, 30 May 2023 16:46:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?-=20=E7=A8=B3=E5=AE=9A=E6=80=A7=E6=8F=90?= =?UTF-8?q?=E5=8D=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/utils.py b/utils.py index 2ac9e5a..23b528a 100644 --- a/utils.py +++ b/utils.py @@ -40,10 +40,8 @@ def get_exif(path) -> dict: """ exif_dict = {} try: - # 如果 exif 中不存在镜头信息,用 exiftool 读取 - # if 'LensModel' not in _exif: - output = subprocess.check_output([EXIFTOOL_PATH, '-charset', 'UTF8', '-d', '%Y-%m-%d %H:%M:%S%3f%z', path], - universal_newlines=True) + output_bytes = subprocess.check_output([EXIFTOOL_PATH, '-d', '%Y-%m-%d %H:%M:%S%3f%z', path]) + output = output_bytes.decode('utf-8', errors='ignore') lines = output.splitlines() utf8_lines = [line for line in lines]