|
| 1 | +# PyCron Video Alarm |
| 2 | + |
| 3 | +> A cross-platform video alarm clock that wakes you up with videos, audio, and custom automation sequences — scheduled through your OS natively (cron on Linux, Task Scheduler on Windows). |
| 4 | +
|
| 5 | +[](./LICENSE) |
| 6 | +[](https://github.com/juke32/PyCronVideoAlarm/releases) |
| 7 | +[](https://buymeacoffee.com) |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## ✨ What It Does |
| 12 | + |
| 13 | +- 🎬 **Play videos as alarms** — launch any video file at a scheduled time using MPV |
| 14 | +- 🔊 **Play audio** — wake up to music, sounds, or recorded voice clips |
| 15 | +- 📋 **Alarm Sequences** — chain actions together (play video → open website → dim screen → etc.) |
| 16 | +- 🕐 **Sleep Cycle Calculator** — calculates optimal wake times in 90-minute cycles |
| 17 | +- 🔁 **Recurring Alarms** — set alarms for specific days of the week, or one-time only |
| 18 | +- 🌙 **Sleep Mode** — dim/black screen overlay with keep-awake to assist sleeping |
| 19 | +- 💡 **Brightness Control** — dim the display as part of a sequence (Linux + Windows) |
| 20 | +- 🏠 **Native OS Scheduling** — uses `cron` on Linux, Task Scheduler on Windows (no background process needed) |
| 21 | +- 🖱️ **Party Mode** — instant random video from your library |
| 22 | +- 🎨 **Themes** — multiple dark/light themes |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## ⚡ Quick Start |
| 27 | + |
| 28 | +### Option A: Download Pre-built Executable *(Recommended)* |
| 29 | + |
| 30 | +1. Download the latest release from the [Releases page](https://github.com/juke32/PyCronVideoAlarm/releases) |
| 31 | +2. Extract the folder anywhere you want the app to live permanently |
| 32 | +3. Run the executable: |
| 33 | + - **Windows**: `PyCronVideoAlarm_Windows.exe` |
| 34 | + - **Linux**: `./PyCronVideoAlarm_Linux` (may need: `chmod +x PyCronVideoAlarm_Linux`) |
| 35 | +4. On first run, go to **Settings → Add to Applications** to register it in your app launcher |
| 36 | + |
| 37 | +> [!TIP] |
| 38 | +> **Keep the folder in one place.** Cron/Task Scheduler entries point to this exact path. Moving the exe after setting alarms will break the schedule links. |
| 39 | +
|
| 40 | +### Option B: Run from Source |
| 41 | + |
| 42 | +```bash |
| 43 | +git clone https://github.com/juke32/PyCronVideoAlarm.git |
| 44 | +cd PyCronVideoAlarm |
| 45 | +python3 -m venv .venv |
| 46 | +source .venv/bin/activate # Linux |
| 47 | +# .venv\Scripts\activate.bat # Windows |
| 48 | +pip install -r requirements.txt |
| 49 | +python src/main.py |
| 50 | +``` |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## 📦 Dependencies |
| 55 | + |
| 56 | +### External (install separately) |
| 57 | + |
| 58 | +| Dependency | Purpose | Linux | Windows | |
| 59 | +|---|---|---|---| |
| 60 | +| **MPV** | Video & audio playback | `sudo apt install mpv` | [mpv.io](https://mpv.io) or `winget install mpv` | |
| 61 | + |
| 62 | +### Python (auto-installed via `requirements.txt`) |
| 63 | + |
| 64 | +| Package | Purpose | |
| 65 | +|---|---| |
| 66 | +| `Pillow` | Image handling / icon display | |
| 67 | +| `python-crontab` | Linux cron scheduling *(Linux only)* | |
| 68 | +| `jeepney` | DBus / Wayland support *(Linux only)* | |
| 69 | +| `pycaw`, `comtypes`, `pywin32` | Windows audio + Task Scheduler *(Windows only)* | |
| 70 | +| `pyautogui`, `opencv-python` | Screen automation actions | |
| 71 | +| `sounddevice`, `numpy`, `scipy` | Audio recording action | |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## 📂 Folder Structure |
| 76 | + |
| 77 | +Place the executable (or run from source) with this layout. The app creates missing folders automatically on first run. |
| 78 | + |
| 79 | +``` |
| 80 | +PyCronVideoAlarm/ |
| 81 | +│ |
| 82 | +├── PyCronVideoAlarm_Linux ← Main executable (Linux) |
| 83 | +├── PyCronVideoAlarm_Windows.exe ← Main executable (Windows) |
| 84 | +├── settings.json ← Auto-generated on first run |
| 85 | +│ |
| 86 | +├── sequences/ ← Alarm sequences (.json files) |
| 87 | +│ ├── Morning_Routine.json |
| 88 | +│ └── Weekend_Wake.json |
| 89 | +│ |
| 90 | +├── audio/ ← Audio files for sequences |
| 91 | +│ ├── Alarm_Clock.mp3 |
| 92 | +│ └── 00-100_numbers/ ← Drop the "0-100 Audio" pack here |
| 93 | +│ |
| 94 | +└── video/ ← Video files for sequences |
| 95 | + ├── FunnyFolder/ ← Drop funny video packs here |
| 96 | + └── MotivationFolder/ ← Drop motivational packs here |
| 97 | +``` |
| 98 | + |
| 99 | +> [!NOTE] |
| 100 | +> Sample sequences, audio, and video packs are available as optional downloads on the [Releases page](https://github.com/juke32/PyCronVideoAlarm/releases). Drop them in the folders above and the included sequences will work immediately. |
| 101 | +
|
| 102 | +--- |
| 103 | + |
| 104 | +## 🐧 Linux Setup |
| 105 | + |
| 106 | +### Make it executable |
| 107 | +```bash |
| 108 | +chmod +x PyCronVideoAlarm_Linux |
| 109 | +./PyCronVideoAlarm_Linux |
| 110 | +``` |
| 111 | + |
| 112 | +### Crontab access |
| 113 | +The app schedules alarms via cron. Test access with: |
| 114 | +```bash |
| 115 | +crontab -l |
| 116 | +# "no crontab for user" = you have access (just no entries yet) |
| 117 | +# "permission denied" = run: echo $USER | sudo tee -a /etc/cron.allow |
| 118 | +``` |
| 119 | + |
| 120 | +> [!CAUTION] |
| 121 | +> Never run the app or set alarms with `sudo`. Cron jobs set as root cannot access your display or audio session. |
| 122 | +
|
| 123 | +### Brightness control |
| 124 | +Install `brightnessctl` for the most reliable brightness support: |
| 125 | +```bash |
| 126 | +sudo apt install brightnessctl |
| 127 | +``` |
| 128 | +Or add your user to the `video` group: |
| 129 | +```bash |
| 130 | +sudo usermod -aG video $USER # log out and back in after |
| 131 | +``` |
| 132 | + |
| 133 | +### Session requirement |
| 134 | +Your user session must be **logged in** for media to play. The app automatically injects `DISPLAY` and `XDG_RUNTIME_DIR` into cron commands for GUI playback. |
| 135 | + |
| 136 | +For full Linux details (Fedora, udev rules, codecs, sleep inhibition): see [README_Linux.md](./README_Linux.md) |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## 🪟 Windows Setup |
| 141 | + |
| 142 | +1. Download and run `VideoAlarm_Windows.exe` |
| 143 | +2. Install MPV: `winget install mpv` or from [mpv.io](https://mpv.io) |
| 144 | +3. Alarms are registered in **Windows Task Scheduler** — no background process needed |
| 145 | +4. Go to **Settings → Add to Start Menu** to add a shortcut |
| 146 | + |
| 147 | +> [!NOTE] |
| 148 | +> Windows can wake from sleep to fire an alarm if configured in Task Scheduler (enabled by default in the app). |
| 149 | +
|
| 150 | +--- |
| 151 | + |
| 152 | +## 🛠️ Troubleshooting |
| 153 | + |
| 154 | +| Problem | Solution | |
| 155 | +|---|---| |
| 156 | +| Alarm didn't fire | Check the **Next Alarm** ticker in the Alarms tab. Verify cron/Task Scheduler using a 1-minute test alarm. | |
| 157 | +| Video won't play | Ensure MPV is installed: `mpv --version` in terminal | |
| 158 | +| No sound | On Linux, check `XDG_RUNTIME_DIR` is set. The app logs this on each alarm run. | |
| 159 | +| App won't open on Linux | Run `chmod +x VideoAlarm_Linux` then try again | |
| 160 | +| Brightness control fails | Install `brightnessctl` or add user to `video` group (Linux) | |
| 161 | + |
| 162 | +Enable **Settings → Logging** and check the logs folder for detailed error output. |
| 163 | + |
| 164 | +--- |
| 165 | + |
| 166 | +## 🏗️ Building from Source |
| 167 | + |
| 168 | +```bash |
| 169 | +# Linux |
| 170 | +./build_linux.sh |
| 171 | + |
| 172 | +# Windows |
| 173 | +build_windows.bat |
| 174 | +``` |
| 175 | + |
| 176 | +Or push a commit whose message **starts with** `build` to trigger GitHub Actions (builds both platforms automatically). |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +## 🤝 Contributing & Support |
| 181 | + |
| 182 | +This project is a labour of love. If it helped you wake up on time (or made your morning less terrible), consider supporting it: |
| 183 | + |
| 184 | +☕ **[Buy Me a Coffee](https://buymeacoffee.com)** — any amount helps! |
| 185 | + |
| 186 | +Issues, feature requests, and pull requests are welcome on the [GitHub repo](https://github.com/juke32/PyCronVideoAlarm). |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## 📄 License |
| 191 | + |
| 192 | +[Custom Source-Available License](./LICENSE) — free for personal and non-commercial use with attribution. Commercial use, resale, and public redistribution of modified versions require permission from Juke32. |
0 commit comments