Commit 5d023c4

xxwhirlpool  ·  2026-04-17 14:57:02 -0400 EDT
parent e15c541
ical & blogroll scripts
2 files changed,  +52, -0
R config/.local/bin/eunoia_blogroll => scripts/Scripts/eunoia_blogroll
+0, -0
+52, -0
......@@ -0,0 +1,52 @@
1+#!/usr/bin/env bash
2+
3+# don't take args
4+if [[ "$#" -gt 0 ]]; then
5+ echo "Usage: ical_add [FOLLOW PROMPTS]"
6+ exit 1
7+fi
8+
9+# basic functions
10+die() {
11+ echo "canceled" && exit 1
12+}
13+
14+ginput() {
15+ gum input --placeholder "$@"
16+}
17+
18+# define calendar file
19+calfile="/home/kat/Documents/Git/-mine/ladyflash/public/feeds/cal/Music_Releases.ics"
20+
21+# remove vcalend for now
22+sed -i '/END:VCALENDAR/d' "$calfile"
23+
24+# read/take input and store in variables
25+summary=$(ginput "Artist Type 'NAME'") || die
26+dtstart=$(ginput "format: 20260417") || die
27+dtend=$(ginput "format: 20260418") || die
28+dtstamp=$(date -d "$(ginput "format: 20260417")" +'%Y%m%dT%H%M%SZ') || die
29+uuid=$(uuidgen | tr "[:lower:]" "[:upper:]") || die
30+categories=$(ginput "K-Pop,Pop") || die
31+
32+# idk if this does anything but
33+# it's here just in case lol
34+if [[ -z "$summary" || -z "$dtstart" || -z "$dtend" || -z "$dtstamp" || -z "$uuid" || -z "$categories" ]]; then
35+ die
36+fi
37+
38+# add everything to the calendar
39+cat << EOF | perl -pe "chomp if eof" >> "$calfile"
40+BEGIN:VEVENT
41+SUMMARY:$summary
42+DTSTART;VALUE=DATE:$dtstart
43+DTEND;VALUE=DATE:$dtend
44+DTSTAMP:$dtstamp
45+UID:$uuid
46+SEQUENCE:0
47+CATEGORIES:$categories
48+END:VEVENT
49+EOF
50+
51+# add back in the vcalend
52+echo -e "\nEND:VCALENDAR" >> "$calfile"