-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert.tcl
More file actions
37 lines (29 loc) · 727 Bytes
/
convert.tcl
File metadata and controls
37 lines (29 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/tclsh
set COUNT 0
array set PICS {}
cd assets
file delete {*}[glob -nocomplain thumb.**]
proc format_date {pic} {
set tmp [lindex [regexp -inline -- {IMG_([0-9]+)_[0-9]+.[a-z]+} $pic] 1]
set ms [clock scan $tmp]
return [clock format $ms -format "%e %B" -locale el]
}
foreach pic [lsort -dictionary [glob **]] {
set date [format_date $pic]
set thumb \[thumb$::COUNT\]
set img \[img$::COUNT\]
puts "$img: assets/$pic"
puts "$thumb: assets/thumb.$pic"
lappend PICS($date) "\[!$thumb\]$img"
exec convert -thumbnail 200 $pic thumb.$pic
incr ::COUNT
}
puts ""
foreach d [lsort -dictionary [array names PICS]] {
puts "## $d"
puts ""
foreach p $PICS($d) {
puts "$p"
puts ""
}
}