Skip to content

Easy time blocking. This script takes a user's schedule, parses it, and exports it as an .ics file for easy calendar import

Notifications You must be signed in to change notification settings

incandescentman/Primetime

Repository files navigation

Primetime: Text-Based Time Blocking

Primetime is a Python script to streamline time blocking. It accepts a user’s schedule in text form, interprets each line as an event, and transforms it into a .ics file for seamless import into any calendar app.

screenshot.png

Development

Code created by ChatGPT 4:

https://chat.openai.com/share/f7432fc0-989d-4448-b2ca-6651cf2c5406

https://chat.openai.com/share/e81b8a11-e881-438e-96b6-ba350d979fff

https://chat.openai.com/share/d2ed0019-c2fa-42b5-8924-8c26ea4f9568

https://chat.openai.com/share/8e1b72e6-ceaa-4268-8b1f-3a4c054850e1

I developed this script partly because I needed it but mostly to demonstrate my process, as a non-programmer, for using AI to generate code.

Purpose

Time blocking is a time management technique that involves dividing your day into blocks of time, each dedicated to a specific task. Basically, it’s about calendaring your to-do list.

In practice, time blocking involves planning your day in advance, usually by listing all of the tasks you need to complete and then assigning a specific time slot for each task. For example, you might block off 9 am - 11 am for writing a report, 11 am - 12 pm for responding to emails, 1 pm - 2 pm for a meeting, and so on.

Time blocking can help you manage your time more efficiently, reduce distractions and interruptions, and ensure that high-priority tasks get the attention they deserve. It also provides a clear structure for your day, which can reduce stress and decision fatigue.

Time blocking is different from time boxing.

  1. Time Blocking: This method involves scheduling specific tasks to be done within certain periods (or blocks) of time throughout your day. For instance, you might schedule 8:00 AM - 10:00 AM for writing, 10:00 AM - 11:00 AM for responding to emails, etc. The focus here is more on the tasks to be accomplished during each block of time, and these blocks can be adjusted based on the nature and duration of each task.
  2. Time Boxing: This technique involves allotting a fixed amount of time, or a “box” of time, to each task, after which you move on to the next task whether the current task is completed or not. For example, you could decide to dedicate exactly one hour to brainstorming ideas for a project, after which you would move on to the next task, regardless of whether you’ve finished brainstorming or not. The primary goal of time boxing is to prevent tasks from dragging on and consuming more time than they should.

635bd94d968178767885fa30_time-blocking-01.png

Source: Time blocking - Workflowy guide

Time blocking is about organizing your day into blocks of time dedicated to certain tasks, whereas time boxing is about limiting the amount of time you spend on any given task.

Features

  • Accepts schedule input from the clipboard or directly via the console.
  • Parses the schedule to extract task start times, durations, and titles.
  • Accommodates variations in the input format, such as the absence of “am/pm” or a preceding space before “am/pm”.
  • Generates a calendar of events based on the provided schedule.
  • Presents the proposed schedule in an easy-to-read format with color-coded elements, aligning the event titles for readability.
  • Prompts for confirmation before saving the schedule to a .ics file.
  • Automatically opens the .ics file after creation.
  • Correctly interprets and handles events that have already occurred today, as well as events happening after midnight.

Requirements

Requires the following Python libraries:

  • pyperclip
  • ics
  • python-dateutil
  • termcolor

You can install these libraries with pip in this fashion:

pip install pyperclip ics python-dateutil termcolor

Installation

To install and run the script, follow these steps:

Clone the repository:

git clone https://github.com/incandescentman/primetime.git

Navigate to the repository directory:

cd primetime

Ensure you have the required Python libraries. You can install them with pip:

pip install pyperclip ics python-dateutil termcolor

Run the script:

python time_blocking.py

Usage

To use the script, run it and paste your schedule when prompted, or copy your schedule to the clipboard before running the script.

Text-based time blocking

Part of the premise of Primetime is that you don’t need some complicated interface to chart out your day and block out times for each task. You can just type out your agenda and let the script do the work of parsing it and importing it into your calendar.

Each line should start by specifying a time of day and the task you want to work on at that time. So your schedule should roughly follow this format:

6:30pm work on book 30 minutes
7pm go to gym
8:30 pm meditate
9pm shower
9:30pm meet Jenny
10:00 comedy show
11 get a drink
11:30 pm go home

screenshot-2.png

Or this format:

5:00pm - Work on book for 90 minutes
6:30pm - Meditate for 30 minutes
7:00pm - Cook for 1 hour
8:00pm - Take a shower
8:30pm - Clean apartment
10:00pm - Prepare for comedy show
10:30pm - Attend comedy show
12:00am - Reflect on day, plan tomorrow

screenshot-3.png

One task per line, with the event’s start time preceding its title.

If you want to specify the event’s duration, add it at the end of the line in the “X minutes” format, where X represents the duration in minutes. If no duration is specified, the script will end the event 10 minutes before the start of the next one. (Or at the turn of the hour if it’s the last event.)

The script assumes that the first event takes place today unless you explicitly type “tomorrow.” Midnight (12:00am) gets parsed as midnight tonight, not midnight last night.

The script accepts events that have already occurred today, as well as events that occur after midnight. So if it’s currently 2:30pm and the first event is “12:30pm worked on book,” the script recognizes this event as having already occurred and it’s no problem.

Events after midnight are considered (for the purposes of your calendar app) to occur the next day (e.g. “9am + 1 day”). So if your schedule includes “11pm go to sleep” and “9am wake up”, the “9am wake up” event will automatically be scheduled for the next day, since that’s the only 9am that occurs after 11pm. (And since Primetime doesn’t support events that take place after tomorrow.)

If it’s not clear from the start times that an event is taking place tomorrow, you can prepend the word “tomorrow” before the event (e.g., “tomorrow 3pm drive to New Haven”). Events prepended with “tomorrow” are considered to occur the next day regardless of their time.

After entering your schedule, hit RETURN twice to signal the end of input. The script will then present the proposed schedule and prompt you to confirm.

In the terminal display of your schedule, events occurring between 12:00am and 4:00am will not be labeled as “tomorrow”, since they are typically completed before going to sleep. Events starting at or after 4:00am will be labeled as “tomorrow”.

If you confirm the proposed schedule, Primetime will then generate an .ics file for you and open it automatically. 🤯

Contributing

Contributions are welcome! I’m not a programmer and I truly have no idea what I’m doing. Please open an issue or submit a pull request on the GitHub repository.

About

Easy time blocking. This script takes a user's schedule, parses it, and exports it as an .ics file for easy calendar import

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages