Code Monkey home page Code Monkey logo

watcher's Introduction

Watcher

A python script to back up Blink video footage to your local drive, from the cloud.

How to use

Continuous Backup

Complete installation, then setup a daily cron job that runs run_cron.py at least once a day for continuous back-up. Make sure to set environment variables for your Blink login.

Set username and password (can be done in startup profile, or passed-through during the run command):

export BLINK_USERNAME=<YOUR_USERNAME>
export BLINK_PASSWORD=<YOUR_PASSWORD>

Set 2FA automation tokens (Outlook client supported only at the moment). This also requires a o365_token.txt in the root directory of the project as per the o365 library. See here for instructions on how to generate the o365_token.txt file.

export OUTLOOK_CLIENT_ID=<YOUR_OUTLOOK_CLIENT_ID>
export OUTLOOK_CLIENT_SECRET=<YOUR_OUTLOOK_CLIENT_SECRET>

Then run your cron job on :

# Example for every 12 hours
CRON EXPRESSION: 0 0 */12 ? * *
CRON JOB: poetry run python run_cron.py

The downloads will be sent to ./video_backup unless otherwise specified with -f <DIRECTORY> running run_cron.py.

Download All Footage Off The Cloud

The script allows you to download all footage off the cloud. Complete installation, then do the following.

Set username and password (can be done in startup profile, or passed-through during the run command):

export BLINK_USERNAME=<YOUR_USERNAME>
export BLINK_PASSWORD=<YOUR_PASSWORD>

Set 2FA automation tokens (Outlook client supported only at the moment). This also requires a o365_token.txt in the root directory of the project as per the o365 library. See here for instructions on how to generate the o365_token.txt file.

export OUTLOOK_CLIENT_ID=<YOUR_OUTLOOK_CLIENT_ID>
export OUTLOOK_CLIENT_SECRET=<YOUR_OUTLOOK_CLIENT_SECRET>

Run run_cron.py

poetry run python run_cron.py --all

The downloads will be sent to ./video_backup unless otherwise specified with -f <DIRECTORY> running run_cron.py.

Installation

Requires python 3.7.9:

pyenv install 3.7.9
pyenv virtualenv 3.7.9 watcher
pyenv local watcher
poetry install

Development

Complete installation, then install pre-commit.

poetry run pre-commit install

Testing

This project uses pytest.

poetry run pytest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.