Giter Club home page Giter Club logo

gflick's Introduction

What

Gflick lets me play video files straight from my Google Drive without downloading the whole thing ahead of time. Subtitles/audio tracks and seek work out of the box.

Demo here

Motivations and design decisions are explained in my blog posts:

After a brief affair with async web frameworks, I got scared of the ridiculous performance overhead and went back to good ol' bottle + gunicorn, which does what I want and gets the hell out of the way.

How?

It's basically an http proxy that does Google Drive authentication behind the scene, exposing a plain old http endpoint that I can feed into off-the-shelf video players. Seeking and text/audio tracks work because the server supports the Range header.

Development

poetry install
gflick-google
# Follow the script's instructions to authorize your newly created client.
# Once that's done, tokens.json will be created, which will be used by server.py.
gflick-dev
# Visit http://localhost:8000

Running it

The gflick PyPI package installs a gflick-prod executable which can be run as-is, as long as the current running dir has a tokens.json file.

There's also a gflick-google helper command that's supposed to be run on a desktop which will guide you the google oauth process and spit out said tokens.json file.

pip install --upgrade gflick
# assuming you've already generated a tokens.json file in current dir
gflick-prod

Running it on a publicly accessible server

This is a draft mostly for my personal use, but it may give you ideas. TL;DR:

  • create non-root user
  • create systemd service
  • create caddyfile

The whole thing can be converted into an ansible playbook (and it should be). I'm just too lazy atm.

apt install python3  # at least 3.6
adduser --disabled-password gflick
chmod 0750 /home/gflick
su gflick
mkdir ~/gflick
cd ~/gflick
pip install --user --upgrade gflick
# [scp your tokens.json file to /home/gflick/gflick/tokens.json]

# as root:
# [populate /etc/systemd/system/gflick.service (see sample file in repo)]
systemctl enable gflick
systemctl start gflick
# Site should now be live at port 8000, but not accessible yet because ufw.
# Let's put TLS-terminating caddy server in front of it.

# [install caddy v2 - they have a debian/ubunto repo]
# Then:
mkdir /etc/caddy/sites-enabled/
cp /home/gflick/gflick/caddy/gflick.caddy /etc/caddy/sites-enabled/
# [ edit /etc/caddy/Caddyfile to simply say `import sites-enabled/*.caddy` ]
systemctl enable caddy
systemctl start caddy

gflick's People

Contributors

nhanb avatar

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.