File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 {
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}
Original file line number Diff line number Diff line change 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 } ' )
You can’t perform that action at this time.
0 commit comments