This commit is contained in:
0x8664b2
2025-07-02 09:33:52 -07:00
parent 028dea3cb8
commit e28f2e0c51
17 changed files with 372 additions and 6 deletions

33
test.rb Normal file
View File

@@ -0,0 +1,33 @@
require 'http'
# url = "https://static.nocoda.io/remote.php/dav/calendars/pkamin/774BE10B-AEAD-4D20-BF09-9C0FFD135E56/?export"
# a = HTTP.basic_auth(user: 'pkamin', pass: 'QDH*@8fhWekxwWjeX8MQ3H').get(url).body.to_s
# File.write('/Users/pkamin/Desktop/vacation.vcalendar', a)
a = File.read('/Users/pkamin/Desktop/vacation.vcalendar')
b = a.split("\r\n")
events = []
e = nil
puts a.length
b.each do |line|
puts line
if line == "BEGIN:VEVENT"
puts "new e"
e = Struct.new(:begin_at, :end_at)
elsif line == "END:VEVENT"
puts "end"
events << e unless e.nil?
elsif line.start_with?("DTSTART")
puts "begin"
e.begin_at = DateTime.parse(line.split(":")[1]) unless e.nil?
elsif line.start_with?("DTEND")
puts 'end'
e.end_at = DateTime.parse(line.split(":")[1]) unless e.nil?
end
end
puts events