https://github.com/stackxp/bad-apple-google-calendar
Play Bad Apple (or any other video) in Google Calendar
https://github.com/stackxp/bad-apple-google-calendar
bad-apple badapple calendar google google-calendar javascript python web
Last synced: 12 months ago
JSON representation
Play Bad Apple (or any other video) in Google Calendar
- Host: GitHub
- URL: https://github.com/stackxp/bad-apple-google-calendar
- Owner: stackxp
- License: mit
- Created: 2024-10-12T16:48:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-14T22:03:56.000Z (about 1 year ago)
- Last Synced: 2025-02-14T23:18:45.058Z (about 1 year ago)
- Topics: bad-apple, badapple, calendar, google, google-calendar, javascript, python, web
- Language: Python
- Homepage:
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bad-Apple-Google-Calendar
Play Bad Apple!! (or any other video file) in [Google Calendar](https://calendar.google.com/)

## Setup
1. Download this repo anywhere on your computer
2. Install additional pip packages by running `pip install -r requirements.txt`.
3. Log into [Google Calendar](https://calendar.google.com/), select *year* in the top-right corner or press [Y] on your keyboard.
4. right-click anywhere on the page and select *Save Page as...*
5. Navigate to the path, where you downloaded this repo, and save the page as "index.html".
6. A folder called "index_files" will be created along with the html-file. You can delete all of its contents, except:
- calendar_*[something]*.png
- Every .css file
- unnamed.png
- unnamed_*[something]*.png
9. Download Bad Apple as an MP4 from [The Internet Archive](https://archive.org/details/TouhouBadApple).
10. Insert the following code at the top of `index.html`:
```html
```
9. Run `python3 main.py --video-path [path to bad apple]`.
10. Open http://localhost:8000/ in a web browser.
11. Open the browser's developer console and switch to the *Console* tab.
12. Ignore all the warnings and enter `init()`. If you did everything right, all the days should light up blue.
13. Now type `run()`. A preview window should open and the days in the calendar should start changing to the video.
> [!TIP]
> Run `python3 main.py` without arguments to see all command-line options available.
## How it works
The main.py script starts a Flask and a WebSocket server. The Flask server serves the `index.html` file, `badapple.js` and the `index_files` folder.
The WebSocket server waits for a connection from the hosted webpage and then sends all the frames of the video as strings of ones and zeroes.
`badapple.js` is responsible for the web browser side.
When running `init()`, it organizes all of the calendar days into a list and sets their background color to blue.
And when `run()` is executed, the script establishes a connection to the Python WebSocket-Server and updates every days' color to match the video's pixels.
## TODO
- Add audio playback to main.py
- Compress the data sent to the browser
- Make the days RGB/Grayscale (fancy)