Coder Social home page Coder Social logo

clitube's Introduction

cliTube

A simple CLI Interface to play Youtube-Videos from Windows-Powershell with tube <Video-Title>

Usage

tube SONG

Type cliTube.py <The Video-Title you want to play> or just tube <searchterm> with alias set.

If there are several matches, cliTube will randomly select which video to play. If you don't like this "feature" modify the code for your needs accordingly. (You could set the probabilities in the function choose to probabilities = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] to always play the first match)

Have fun tubing!

Issues

if it doesn't play, try to update the youtube.lua from github (run clitube with
the --update flag and permissions)

tube --update

Installation

  1. Your file-extensions .py have to be associated to run as scripts with python (>= 3.6). If you used the Windows-Installer, that should already be the case (else look that up in the official docs). You could also just make a binary yourself.

  2. A valid installation of VLC media player in your path-environment is required.

  3. If you already have a GOOGLE-DEVELOPER-API-KEY you may skip this step. Otherwise you need to register your own API-KEY to gain Access to the required YouTube Data API.

  4. Have the google-api-client for Python, the HTTP-request library httpx, the dotfile-handler python-dotenv and numpy installed.

    python -m pip install google-api-python-client numpy httpx python-dotenv
  5. Place a symlink to cliTube.py in a directory of your choice (e.g: "$env:home\bin"). Ensure that directory is on PATH.

    Alternatively compile an executable with pyinstaller.

    python -m pip install pyinstaller
    pyinstaller.exe --onefile cliTube.py --distpath . --clean

    Add bin directory to path.

    $path = [Environment]::GetEnvironmentVariable("PATH", "User")
    $script_binaries = "env:home\bin"
    [Environment]::SetEnvironmentVariable("PATH", "$path;$script_binaries", "User")

    Copy the executable.

    mkdir -p $script_binaries
    cp cliTube.exe $env:home\bin\cliTube.exe
    Set-Alias -Name tube -Value $env:home\bin\cliTube.exe -Description "Plays Youtube Search-Results"
  6. Set the GOOGLE_API_KEY environment variable.

    [Environment]::SetEnvironmentVariable(
        "GOOGLE_API_KEY",
        'your secret GOOGLE-API key',
        [System.EnvironmentVariableTarget]::User
    )

    You can also set the key in your env:DOTFILES/local/.env (or modify CUSTOM_DOTENV_PATH on top of the script to find your own secret .env).

clitube's People

Contributors

oryon-dominik avatar

Watchers

 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.