bugfix: handle entries without duration or endtime
This commit is contained in:
@@ -55,9 +55,9 @@ BEGIN {
|
|||||||
# Colors
|
# Colors
|
||||||
OFF = "\033[m"
|
OFF = "\033[m"
|
||||||
}
|
}
|
||||||
BEGINFILE { inside = 0; rs = 0; dur = 0; summary = ""; start = "ERROR"; end = "ERROR" }
|
BEGINFILE { inside = 0; rs = 0; dur = 0; summary = ""; start = "ERROR"; end = "" }
|
||||||
{ gsub("\r", "") }
|
{ gsub("\r", "") }
|
||||||
/^END:VEVENT/ { print "~", start, dur ? start " " end : end, title(start, summary), fn(FILENAME); nextfile }
|
/^END:VEVENT/ { print "~", start, dur ? start " " end : (end ? end : start), title(start, summary), fn(FILENAME); nextfile }
|
||||||
/^DTSTART/ && inside { start = parse_dt(getparam($0), getcontent($0)) }
|
/^DTSTART/ && inside { start = parse_dt(getparam($0), getcontent($0)) }
|
||||||
/^DTEND/ && inside { end = parse_dt(getparam($0), getcontent($0)) }
|
/^DTEND/ && inside { end = parse_dt(getparam($0), getcontent($0)) }
|
||||||
/^DURATION/ && inside { end = parse_duration($NF); dur = 1 }
|
/^DURATION/ && inside { end = parse_duration($NF); dur = 1 }
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ function slice(start, stop, collection, desc, status) {
|
|||||||
color = color_from_status(status)
|
color = color_from_status(status)
|
||||||
if (stop == "00:00")
|
if (stop == "00:00")
|
||||||
return collection " " style_timerange start " → " ": " OFF color desc OFF
|
return collection " " style_timerange start " → " ": " OFF color desc OFF
|
||||||
else
|
else if (start == stop)
|
||||||
|
return collection " " style_timerange start " " ": " OFF color desc OFF
|
||||||
|
else
|
||||||
return collection " " style_timerange start " – " stop ": " OFF color desc OFF
|
return collection " " style_timerange start " – " stop ": " OFF color desc OFF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,13 @@ function print_data(start, dur, end, summary, cmd, collection, depth, path) {
|
|||||||
cmd = "date -d '" start "' +\"%s\""
|
cmd = "date -d '" start "' +\"%s\""
|
||||||
cmd | getline start
|
cmd | getline start
|
||||||
close(cmd)
|
close(cmd)
|
||||||
cmd = "date -d '" end "' +\"%s\""
|
if (end) {
|
||||||
cmd | getline end
|
cmd = "date -d '" end "' +\"%s\""
|
||||||
close(cmd)
|
cmd | getline end
|
||||||
|
close(cmd)
|
||||||
|
} else {
|
||||||
|
end = start
|
||||||
|
}
|
||||||
status = status ? status : "CONFIRMED"
|
status = status ? status : "CONFIRMED"
|
||||||
print start, end, fpath, collection, status, summary
|
print start, end, fpath, collection, status, summary
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ BEGIN {
|
|||||||
$2 == "00:00" && $3 == "00:00" { dayline = dayline " " c($4); next }
|
$2 == "00:00" && $3 == "00:00" { dayline = dayline " " c($4); next }
|
||||||
$2 == "00:00" { dayline = dayline style_time " → " $3 OFF " " c($4); next }
|
$2 == "00:00" { dayline = dayline style_time " → " $3 OFF " " c($4); next }
|
||||||
$3 == "00:00" { dayline = dayline style_time " " $2 " → " OFF c($4); next }
|
$3 == "00:00" { dayline = dayline style_time " " $2 " → " OFF c($4); next }
|
||||||
|
NF == 4 && $2 == $3 { dayline = dayline style_time " " $2 OFF " " c($4); next }
|
||||||
NF == 4 { dayline = dayline style_time " " $2 " – " $3 OFF " " c($4); next }
|
NF == 4 { dayline = dayline style_time " " $2 " – " $3 OFF " " c($4); next }
|
||||||
NF == 1 && dayline { print "+", startofweek " +" $1-1 " days", "", dayline }
|
NF == 1 && dayline { print "+", startofweek " +" $1-1 " days", "", dayline }
|
||||||
NF == 1 {
|
NF == 1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user