This commit is contained in:
Nemo 2023-11-26 22:18:34 +05:30
parent b8da1259ac
commit 29886bb533
6 changed files with 2412 additions and 243 deletions

View File

@ -1,5 +1,5 @@
docs/2023.json:
curl --silent 'https://ec2.unboxingblr.com/get-all-events' -X POST > docs/2023.json
curl --silent 'https://ec2.unboxingblr.com/get-all-events' -X POST |jq '.events' > docs/2023.json
gems:
bundle install
@ -8,6 +8,9 @@ docs/2023.ics: gems docs/2023.json
bundle exec ruby gen.rb
docs/index.html:
pandoc -f markdown README.md > docs/index.html
pandoc --metadata title="BLR Habba Calendar" -s -f markdown README.md > docs/index.html
publish: docs/2023.ics docs/index.html
publish: docs/2023.ics docs/index.html
clean:
rm docs/*

View File

@ -1,9 +1,23 @@
# unboxing BLR habba 2023 calendar
A ICS calendar that you can subscribe for the unboxing [BLR Habba 2023](https://habba.unboxingblr.com/).
> Unboxing BLR Habba (Festival) is a celebration of the city's rich and vibrant
cultural heritage and dynamism. From art to literature, dance to design, food
to films, music to theatre, handicrafts to walking tours - the city festival
brings everyone together and channels its creative energies with the vision
to make Bengaluru come alive in its public and community spaces.
## How to subscribe
Click the following links depending on which calendar app you use.
On iOS/MacOS you can directly sync the calendar against your device, without using iCloud as well. If you
don't use one of these apps, you can use the Calendar URL directly and "subscribe" to it in your app.
Do not download the ICS file and import it, as that will not keep the calendar updated.
**Note**: A few ticketed events do not yet have their tickets on sale, you will get updates as long as you're subscribed
to the calendar, so keep checking in your calendar app.
### Google Calendar
<https://www.google.com/calendar/render?cid=webcal%3A%2F%2Fcaptnemo.in%2Fblr-habba%2F2023.ics>
@ -20,10 +34,10 @@ A ICS calendar that you can subscribe for the unboxing [BLR Habba 2023](https://
<webcal://captnemo.in/blr-habba/2023.ics>
### Download ICS File
### Calendar URL
<https://captnemo.in/blr-habba/2023.ics>
## License
Licensed under the [MIT License](https://nemo.mit-license.org/). See LICENSE file for details.
Licensed under the [MIT License](https://nemo.mit-license.org/). See LICENSE file for details. Source code [published on GitHub](https://github.com/captn3m0/blr-habba).

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,201 @@
<h1 id="unboxing-blr-habba-2023-calendar">unboxing BLR habba 2023
calendar</h1>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>BLR Habba Calendar</title>
<style>
html {
color: #1a1a1a;
background-color: #fdfdfd;
}
body {
margin: 0 auto;
max-width: 36em;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media (max-width: 600px) {
body {
font-size: 0.9em;
padding: 12px;
}
h1 {
font-size: 1.8em;
}
}
@media print {
html {
background-color: white;
}
body {
background-color: transparent;
color: black;
font-size: 12pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
p {
margin: 1em 0;
}
a {
color: #1a1a1a;
}
a:visited {
color: #1a1a1a;
}
img {
max-width: 100%;
}
svg {
height: auto;
max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
h6 {
font-weight: normal;
}
ol, ul {
padding-left: 1.7em;
margin-top: 1em;
}
li > ol, li > ul {
margin-top: 0;
}
blockquote {
margin: 1em 0 1em 1.7em;
padding-left: 1em;
border-left: 2px solid #e6e6e6;
color: #606060;
}
code {
font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
font-size: 85%;
margin: 0;
hyphens: manual;
}
pre {
margin: 1em 0;
overflow: auto;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
hr {
background-color: #1a1a1a;
border: none;
height: 1px;
margin: 1em 0;
}
table {
margin: 1em 0;
border-collapse: collapse;
width: 100%;
overflow-x: auto;
display: block;
font-variant-numeric: lining-nums tabular-nums;
}
table caption {
margin-bottom: 0.75em;
}
tbody {
margin-top: 0.5em;
border-top: 1px solid #1a1a1a;
border-bottom: 1px solid #1a1a1a;
}
th {
border-top: 1px solid #1a1a1a;
padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
margin-bottom: 4em;
text-align: center;
}
#TOC li {
list-style: none;
}
#TOC ul {
padding-left: 1.3em;
}
#TOC > ul {
padding-left: 0;
}
#TOC a:not(:hover) {
text-decoration: none;
}
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
/* The extra [class] is a hack that increases specificity enough to
override a similar rule in reveal.js */
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<header id="title-block-header">
<h1 class="title">BLR Habba Calendar</h1>
</header>
<p>A ICS calendar that you can subscribe for the unboxing <a
href="https://habba.unboxingblr.com/">BLR Habba 2023</a>.</p>
<blockquote>
<p>Unboxing BLR Habba (Festival) is a celebration of the citys rich and
vibrant cultural heritage and dynamism. From art to literature, dance to
design, food to films, music to theatre, handicrafts to walking tours -
the city festival brings everyone together and channels its creative
energies with the vision to make Bengaluru come alive in its public and
community spaces.</p>
</blockquote>
<h2 id="how-to-subscribe">How to subscribe</h2>
<p>Click the following links depending on which calendar app you
use.</p>
<p>On iOS/MacOS you can directly sync the calendar against your device,
without using iCloud as well. If you dont use one of these apps, you
can use the Calendar URL directly and “subscribe” to it in your app.</p>
<p>Do not download the ICS file and import it, as that will not keep the
calendar updated.</p>
<p><strong>Note</strong>: A few ticketed events do not yet have their
tickets on sale, you will get updates as long as youre subscribed to
the calendar, so keep checking in your calendar app.</p>
<h3 id="google-calendar">Google Calendar</h3>
<p><a
href="https://www.google.com/calendar/render?cid=webcal%3A%2F%2Fcaptnemo.in%2Fblr-habba%2F2023.ics"
@ -18,9 +211,13 @@ class="uri">https://outlook.live.com/owa?path=%2Fcalendar%2Faction%2Fcompose&amp
<h3 id="iosandroidmacos">iOS/Android/MacOS</h3>
<p><a href="webcal://captnemo.in/blr-habba/2023.ics"
class="uri">webcal://captnemo.in/blr-habba/2023.ics</a></p>
<h3 id="download-ics-file">Download ICS File</h3>
<h3 id="calendar-url">Calendar URL</h3>
<p><a href="https://captnemo.in/blr-habba/2023.ics"
class="uri">https://captnemo.in/blr-habba/2023.ics</a></p>
<h2 id="license">License</h2>
<p>Licensed under the <a href="https://nemo.mit-license.org/">MIT
License</a>. See LICENSE file for details.</p>
License</a>. See LICENSE file for details. Source code <a
href="https://github.com/captn3m0/blr-habba">published on
GitHub</a>.</p>
</body>
</html>

12
gen.rb
View File

@ -1,22 +1,28 @@
require 'icalendar'
require 'json'
data = JSON.parse File.read 'docs/2023.json'
events = data['events']
events = JSON.parse File.read 'docs/2023.json'
cal = Icalendar::Calendar.new
events.each do |event_data|
event_date = Date.parse(event_data['date'])
start_time = DateTime.parse("#{event_date} #{event_data['start_time']}")
end_time = DateTime.parse("#{event_date} #{event_data['end_time']}")
created_time = DateTime.parse("#{event_date} #{event_data['createdAt']}")
updated_time = DateTime.parse("#{event_date} #{event_data['updatedAt']}")
# Create an event within the calendar
cal.event do |e|
e.uid = event_data['id']
e.dtstart = Icalendar::Values::DateTime.new(start_time, 'tzid' => "Asia/Kolkata")
e.dtend = Icalendar::Values::DateTime.new(end_time, 'tzid' => "Asia/Kolkata")
e.created = Icalendar::Values::DateTime.new(created_time, 'tzid' => "Asia/Kolkata")
e.last_modified = Icalendar::Values::DateTime.new(updated_time, 'tzid' => "Asia/Kolkata")
e.summary = event_data['event_name']
if event_data['thumbnail'] =~ /https:\/\/drive.google.com\/file\/d\/([a-zA-Z0-9\-]+)/
e.append_attach Icalendar::Values::Uri.new("https://drive.google.com/uc?id=#{$1}", "fmttype" => "image/png")
end
e.description = " \
Location Link: #{event_data['gmap_coordinates']}
@ -27,7 +33,7 @@ events.each do |event_data|
if event_data['book_bms_link'] != "" and event_data['book_bms_link'] != event_data['knowMore_url']
e.description += "More Details: #{event_data['knowMore_url']}"
end
e.location = event_data['venue']
e.location = event_data['venue'] + " / #{event_data['regions']} Bangalore"
url = ""
for url_key in ['book_bms_link', 'knowMore_url', 'gmap_coordinates']
url = url.empty? ? event_data[url_key] : url