about summary refs log tree commit diff
path: root/users/Profpatsch/ical-smolify
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2024-08-05T09·07+0200
committerProfpatsch <mail@profpatsch.de>2024-08-06T09·59+0000
commit3202d008d5ee541b984dfd4fc3b44f92a861116a (patch)
tree30dc8b308b13c6cc4182f4ee6adb787f68d3f5b3 /users/Profpatsch/ical-smolify
parent37b2c2ce7892487b1c31d6ad3f7988841014ba89 (diff)
chore(users/Profpatsch): park ical-smolify r/8446
Parked projects: I might pick these up again, but don’t want to
maintain them right now. Might delete later, or reinstate.

Change-Id: Ieb4f51dfaeba33c84820ca804b57c016e05bf566
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12137
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/ical-smolify')
-rw-r--r--users/Profpatsch/ical-smolify/IcalSmolify.hs124
-rw-r--r--users/Profpatsch/ical-smolify/README.md5
-rw-r--r--users/Profpatsch/ical-smolify/default.nix23
-rw-r--r--users/Profpatsch/ical-smolify/ical-smolify.cabal18
4 files changed, 0 insertions, 170 deletions
diff --git a/users/Profpatsch/ical-smolify/IcalSmolify.hs b/users/Profpatsch/ical-smolify/IcalSmolify.hs
deleted file mode 100644
index 77264d16937e..000000000000
--- a/users/Profpatsch/ical-smolify/IcalSmolify.hs
+++ /dev/null
@@ -1,124 +0,0 @@
-{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE QuasiQuotes #-}
-{-# OPTIONS_GHC -Wall #-}
-
-module Main where
-
-import qualified Data.ByteString.Lazy as Bytes.Lazy
-import qualified Data.CaseInsensitive as CaseInsensitive
-import qualified Data.Default as Default
-import qualified Data.Map.Strict as Map
-import qualified Data.Set as Set
-import ExecHelpers (dieUserError, CurrentProgramName)
-import MyPrelude
-import qualified System.Environment as Env
-import Text.ICalendar
-import Prelude hiding (log)
-
-main :: IO ()
-main = do
-  Env.getArgs >>= \case
-    [] -> dieUserError progName "First argument must be the ics file name"
-    (file : _) ->
-      do
-        parse file
-        >>= traverse_
-          ( \vcal ->
-              vcal
-                & stripSingleTimezone
-                & minify
-                & printICalendar Default.def
-                & Bytes.Lazy.putStr
-          )
-
-progName :: CurrentProgramName
-progName = "ical-smolify"
-
-log :: Error -> IO ()
-log err = do
-  putStderrLn (errorContext "ical-smolify" err & prettyError)
-
-parse :: FilePath -> IO [VCalendar]
-parse file = do
-  parseICalendarFile Default.def file >>= \case
-    Left err -> do
-      dieUserError progName [fmt|Cannot parse ical file: {err}|]
-    Right (cals, warnings) -> do
-      for_ warnings (\warn -> log [fmt|Warning: {warn}|])
-      pure cals
-
--- | Converts a single timezone definition to the corresponding X-WR-Timezone field.
-stripSingleTimezone :: VCalendar -> VCalendar
-stripSingleTimezone vcal =
-  case vcal & vcTimeZones & Map.toList of
-    [] -> vcal
-    [(_, tz)] -> do
-      let xtz =
-            OtherProperty
-              { otherName = CaseInsensitive.mk "X-WR-TIMEZONE",
-                otherValue = tz & vtzId & tzidValue & textToBytesUtf8Lazy,
-                otherParams = OtherParams Set.empty
-              }
-      vcal
-        { vcOther =
-            vcal & vcOther
-              -- remove any existing x-wr-timezone fields
-              & Set.filter (\prop -> (prop & otherName) /= (xtz & otherName))
-              & Set.insert xtz,
-          vcTimeZones = Map.empty
-        }
-    _more -> vcal
-
--- | Minify the vcalendar event by throwing away everything that’s not an event.
-minify :: VCalendar -> VCalendar
-minify vcal =
-  vcal
-    { vcProdId = ProdId "" (OtherParams Set.empty),
-      -- , vcVersion    :: ICalVersion
-      -- , vcScale      :: Scale
-      -- , vcMethod     :: Maybe Method
-      -- , vcOther      :: …
-      -- , vcTimeZones  :: Map Text VTimeZone
-      vcEvents = Map.map minifyEvent (vcal & vcEvents),
-      vcTodos = Map.empty,
-      vcJournals = Map.empty,
-      vcFreeBusys = Map.empty,
-      vcOtherComps = Set.empty
-    }
-
-minifyEvent :: VEvent -> VEvent
-minifyEvent vev =
-  vev
---  { veDTStamp       :: DTStamp
---   , veUID           :: UID
---   , veClass         :: Class -- ^ 'def' = 'Public'
---   , veDTStart       :: Maybe DTStart
---   , veCreated       :: Maybe Created
---   , veDescription   :: Maybe Description
---   , veGeo           :: Maybe Geo
---   , veLastMod       :: Maybe LastModified
---   , veLocation      :: Maybe Location
---   , veOrganizer     :: Maybe Organizer
---   , vePriority      :: Priority -- ^ 'def' = 0
---   , veSeq           :: Sequence -- ^ 'def' = 0
---   , veStatus        :: Maybe EventStatus
---   , veSummary       :: Maybe Summary
---   , veTransp        :: TimeTransparency -- ^ 'def' = 'Opaque'
---   , veUrl           :: Maybe URL
---   , veRecurId       :: Maybe RecurrenceId
---   , veRRule         :: Set RRule
---   , veDTEndDuration :: Maybe (Either DTEnd DurationProp)
---   , veAttach        :: Set Attachment
---   , veAttendee      :: Set Attendee
---   , veCategories    :: Set Categories
---   , veComment       :: Set Comment
---   , veContact       :: Set Contact
---   , veExDate        :: Set ExDate
---   , veRStatus       :: Set RequestStatus
---   , veRelated       :: Set RelatedTo
---   , veResources     :: Set Resources
---   , veRDate         :: Set RDate
---   , veAlarms        :: Set VAlarm
---   , veOther         :: Set OtherProperty
---   }
diff --git a/users/Profpatsch/ical-smolify/README.md b/users/Profpatsch/ical-smolify/README.md
deleted file mode 100644
index 86c166d3c179..000000000000
--- a/users/Profpatsch/ical-smolify/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# ical-smolify
-
-Ensmallen an `ical` by stripping out redundant information like timezone definitions.
-
-The idea here was that after running through this preprocessor, it fits into a QR code (~2000bits) that can be scanned with your phone (for automatically adding to mobile calendar).
diff --git a/users/Profpatsch/ical-smolify/default.nix b/users/Profpatsch/ical-smolify/default.nix
deleted file mode 100644
index bf766db0e974..000000000000
--- a/users/Profpatsch/ical-smolify/default.nix
+++ /dev/null
@@ -1,23 +0,0 @@
-{ depot, pkgs, lib, ... }:
-
-let
-  ical-smolify = pkgs.writers.writeHaskell "ical-smolify"
-    {
-      libraries = [
-        pkgs.haskellPackages.iCalendar
-        depot.users.Profpatsch.my-prelude
-        depot.users.Profpatsch.execline.exec-helpers-hs
-
-      ];
-      ghcArgs = [ "-threaded" ];
-    } ./IcalSmolify.hs;
-
-in
-
-ical-smolify.overrideAttrs (old: {
-  meta = lib.recursiveUpdate old.meta or { } {
-    # Dependency iCalendar no longer builds in nixpkgs due to a lack of maintenance upstream
-    # https://github.com/nixos/nixpkgs/commit/13d10cc6e302e7d5800c6a08c1728b14c3801e26
-    ci.skip = true;
-  };
-})
diff --git a/users/Profpatsch/ical-smolify/ical-smolify.cabal b/users/Profpatsch/ical-smolify/ical-smolify.cabal
deleted file mode 100644
index d7a46c581df2..000000000000
--- a/users/Profpatsch/ical-smolify/ical-smolify.cabal
+++ /dev/null
@@ -1,18 +0,0 @@
-cabal-version:      3.0
-name:               ical-smolify
-version:            0.1.0.0
-author:             Profpatsch
-maintainer:         mail@profpatsch.de
-
-executable ical-smolify
-    main-is: IcalSmolify.hs
-
-    build-depends:
-        base >=4.15 && <5,
-        my-prelude,
-        exec-helpers
-        data-default
-        case-insensitive
-        iCalendar
-
-    default-language: Haskell2010