Skip to content

Commit c563bb8

Browse files
Merge pull request #70 from jinwandalaohu66/submission/script_mngbfc3s
2 parents a1beb9a + eeef904 commit c563bb8

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

script_library/index.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 1,
3-
"data_version": 50,
4-
"updated": "2026-04-01T16:23:30.391Z",
3+
"data_version": 51,
4+
"updated": "2026-04-01T17:24:19.806Z",
55
"announcement": null,
66
"categories": [
77
{
@@ -1214,6 +1214,29 @@
12141214
"updated": null,
12151215
"status": "active",
12161216
"lines": 499
1217+
},
1218+
{
1219+
"id": "script_mngbfc3s",
1220+
"name": "照片统计",
1221+
"name_en": "照片统计",
1222+
"desc": "运行可以直接统计你相册有多少照片",
1223+
"desc_en": "运行可以直接统计你相册有多少照片",
1224+
"category": "basic",
1225+
"file": "scripts/basic/script_mngbfc3s.py",
1226+
"thumbnail": null,
1227+
"version": 1,
1228+
"file_type": "py",
1229+
"author": "今晚打老虎",
1230+
"author_en": "今晚打老虎",
1231+
"tags": [
1232+
"community"
1233+
],
1234+
"requires": [],
1235+
"min_app_version": "1.5.0",
1236+
"added": "2026-04-01",
1237+
"updated": null,
1238+
"status": "active",
1239+
"lines": 18
12171240
}
12181241
]
12191242
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import photos
2+
from collections import Counter
3+
import datetime
4+
5+
assets = photos.get_assets(media_type='photo', limit=0)
6+
print(f'共 {len(assets)} 张照片')
7+
8+
year_counter = Counter()
9+
for asset in assets:
10+
ts = asset.creation_date
11+
if ts:
12+
year = datetime.datetime.fromtimestamp(ts).year
13+
year_counter[year] += 1
14+
15+
print('\n按年份分布:')
16+
for year in sorted(year_counter):
17+
bar = '█' * (year_counter[year] // 10)
18+
print(f'{year}: {year_counter[year]:4d}{bar}')

0 commit comments

Comments
 (0)