~kris/dots

srice

ref: e98f3b030dc24445bd55c68d95d2d81933fd68b3 srice/.local/bin/misc/config.py -rw-r--r-- 1.7 KiB
e98f3b03 — Kris Yotam chore: sync local state after restore (push updates, no pull) a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
"""
===============================================================
 Script: config.py
 Author: Kris Yotam (aka. khr1st)
 Date:   2025-09-29
 License: MIT License
 Description:
   Global configuration for the LaTeX lecture note system.
   Defines paths, calendar settings, and date formatting.
   Provides helper to compute academic week numbers.

 Inspiration:
   Adapted and extended from Gilles Castel's lecture note workflow.
===============================================================
"""

from datetime import datetime
from pathlib import Path


# -----------------------------
# Calendar configuration
# -----------------------------

# Default Google Calendar to use for countdown + course events.
# Replace 'primary' with a calendar ID if using a dedicated course calendar.
USERCALENDARID = "primary"


# -----------------------------
# Course symlink and tracking
# -----------------------------

CURRENT_COURSE_SYMLINK = Path("~/current_course").expanduser()
CURRENT_COURSE_ROOT = CURRENT_COURSE_SYMLINK.resolve()
CURRENT_COURSE_WATCH_FILE = Path("/tmp/current_course").resolve()


# -----------------------------
# Root directory for courses
# -----------------------------

ROOT = Path("~/Documents/Kulak/bachelor_3/semester_2").expanduser()


# -----------------------------
# Date formatting
# -----------------------------

DATE_FORMAT = "%a %d %b %Y %H:%M"


# -----------------------------
# Week number utility
# -----------------------------

def get_week(d: datetime = datetime.today()) -> int:
    """
    Compute the academic week number.
    My university labels semester weeks from 1 to 13.
    Adjusted from ISO week numbers using an offset.
    """
    return (int(d.strftime("%W")) + 52 - 5) % 52