Create helper scripts to convert old calendar to new style.
This commit is contained in:
parent
b68394ec68
commit
294c537f3f
23
scripts/nc-cal-sync/helper/convert.sh
Executable file
23
scripts/nc-cal-sync/helper/convert.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "calendars:"
|
||||||
|
for r in vorne mitte hinten
|
||||||
|
do
|
||||||
|
echo " $r:"
|
||||||
|
echo " id: \"$r\""
|
||||||
|
echo " ignore: true"
|
||||||
|
echo " schedule:"
|
||||||
|
echo -n " "
|
||||||
|
(
|
||||||
|
echo '['
|
||||||
|
prefix_comma=''
|
||||||
|
for d in Mo Di Mi Do Fr
|
||||||
|
do
|
||||||
|
echo -n "$prefix_comma"
|
||||||
|
prefix_comma=', '
|
||||||
|
cat ../../data/calendar.yaml | yq -cj '.calendar.'"$r.$d"' | . as $dict | [keys[] | . as $key | $dict[$key] | to_entries | [ .[], {key: "day", value: "'"$d"'"}, {key: "start", value: $key}, {key: "age", value: ""}, {key: "extern", value: false}, {key: "duration", value: (($dict[$key].slots) * 15)} ] | from_entries | del(.slots)]'
|
||||||
|
done
|
||||||
|
echo ']'
|
||||||
|
) | jq -cj '[ .[][] ]'
|
||||||
|
echo
|
||||||
|
done
|
12
scripts/nc-cal-sync/helper/test.yq
Normal file
12
scripts/nc-cal-sync/helper/test.yq
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.calendar.vorne.Mo | . as $dict |
|
||||||
|
keys[] | . as $key |
|
||||||
|
$dict[$key] | to_entries |
|
||||||
|
[
|
||||||
|
.[],
|
||||||
|
{key: "day", value: "Mo"},
|
||||||
|
{key: "start", value: $key},
|
||||||
|
{key: "age", value: ""},
|
||||||
|
{key: "extern", value: false},
|
||||||
|
{key: "duration", value: (($dict[$key].slots) * 15)}
|
||||||
|
] |
|
||||||
|
from_entries | del(.slots)
|
Loading…
x
Reference in New Issue
Block a user