Skip to content

stackxp/Bad-Apple-Google-Calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bad-Apple-Google-Calendar

Play Bad Apple!! (or any other video file) in Google Calendar

Bad Apple in the Google Calendar

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, 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
  7. Download Bad Apple as an MP4 from The Internet Archive.
  8. Insert the following code at the top of index.html:
<script src="/badapple.js"></script>
  1. Run python3 main.py --video-path [path to bad apple].
  2. Open http://localhost:8000/ in a web browser.
  3. Open the browser's developer console and switch to the Console tab.
  4. Ignore all the warnings and enter init(). If you did everything right, all the days should light up blue.
  5. 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)