diff --git a/script_library/index.json b/script_library/index.json index ef13d1c..32755a1 100644 --- a/script_library/index.json +++ b/script_library/index.json @@ -1,7 +1,7 @@ { "format_version": 1, - "data_version": 50, - "updated": "2026-04-01T16:23:30.391Z", + "data_version": 51, + "updated": "2026-04-01T17:24:19.806Z", "announcement": null, "categories": [ { @@ -1214,6 +1214,29 @@ "updated": null, "status": "active", "lines": 499 + }, + { + "id": "script_mngbfc3s", + "name": "照片统计", + "name_en": "照片统计", + "desc": "运行可以直接统计你相册有多少照片", + "desc_en": "运行可以直接统计你相册有多少照片", + "category": "basic", + "file": "scripts/basic/script_mngbfc3s.py", + "thumbnail": null, + "version": 1, + "file_type": "py", + "author": "今晚打老虎", + "author_en": "今晚打老虎", + "tags": [ + "community" + ], + "requires": [], + "min_app_version": "1.5.0", + "added": "2026-04-01", + "updated": null, + "status": "active", + "lines": 18 } ] } diff --git a/script_library/scripts/basic/script_mngbfc3s.py b/script_library/scripts/basic/script_mngbfc3s.py new file mode 100644 index 0000000..e737ac9 --- /dev/null +++ b/script_library/scripts/basic/script_mngbfc3s.py @@ -0,0 +1,18 @@ +import photos +from collections import Counter +import datetime + +assets = photos.get_assets(media_type='photo', limit=0) +print(f'共 {len(assets)} 张照片') + +year_counter = Counter() +for asset in assets: + ts = asset.creation_date + if ts: + year = datetime.datetime.fromtimestamp(ts).year + year_counter[year] += 1 + +print('\n按年份分布:') +for year in sorted(year_counter): + bar = '█' * (year_counter[year] // 10) + print(f'{year}: {year_counter[year]:4d} 张 {bar}') \ No newline at end of file