flixctl icon indicating copy to clipboard operation
flixctl copied to clipboard

A toolkit for controlling the infrastructure necessary for a true MaSaS (Movies and Shows as a Service) architecture.

= flixctl :toc: :toc-placement: preamble :toclevels: 3 :Some attr: Some value

// Need some preamble to get TOC: {empty}

image:https://travis-ci.com/eschizoid/flixctl.svg?branch=master["Build Status", link="https://travis-ci.com/eschizoid/flixctl"] image:https://goreportcard.com/badge/github.com/eschizoid/flixctl["Go Report Card", link="https://goreportcard.com/report/github.com/eschizoid/flixctl"] image:https://godoc.org/github.com/eschizoid/flixctl?status.svg["GoDoc", link="https://godoc.org/github.com/eschizoid/flixctl"]

flixctl provides an easy way to provision a Plex installation on the cloud. After the provisioning of the main infrastructure it's done, flixctl can also be used to control some of the most popular components that users normally bundle up with Plex: torrent and newsgroup clients (transmission and nzbget), movies and shows searches (sonarr and radarr), movies and shows requests (ombi), and monitoring utilities (tautulli) just to mention a few.

Inspired by kubectl, flixctl was designed to be leveraged using Slack Slash API in conjunction with AWS Lambda. The flexibility of this architecture allows an easy installation of the full flixctl API into any Slack workspace. This means the provision and administration of a true MaSaS (Movies and Shows as a Service) architecture can be done via Slack.

=== Architecture

=== Components

==== Infrastructure (AWS)

  • https://aws.amazon.com/api-gateway[API Geteway]
  • https://aws.amazon.com/ebs[EBS]
  • https://aws.amazon.com/ec2[EC2]
  • https://aws.amazon.com/dynamodb[DynamoDB]
  • https://aws.amazon.com/glacier[Glacier]
  • https://aws.amazon.com/lambda[Lambda]
  • https://aws.amazon.com/sns[SNS]

==== Software

  • https://letsencrypt.org/[Let's Encrypt]
  • https://www.duckdns.org/[Duck DNS]
  • https://github.com/lukas2511/dehydrated[Dehydrated]
  • https://github.com/Jackett/Jackett[Jackett]
  • https://github.com/nzbget[NZBGet]
  • https://github.com/tidusjar/Ombi[Ombi]
  • https://github.com/plexinc/plex-media-player[Plex]
  • https://github.com/Radarr/Radarr[Radarr]
  • https://github.com/Sonarr/Sonarr[Sonarr]
  • https://github.com/Tautulli/Tautulli[Tautulli]
  • https://github.com/transmission/transmission[Transmission]
  • https://api.slack.com/slash-commands[Slack Slash Commands]

=== Pre-requisites ==== Infrastructure

  • 1 EC2 Instance
  • 2 EBS Volume, 1 for ROOT and 1 for Plex Library
  • 1 Glacier Vault (For Plex library cold storage)
  • 1 S3 Bucket (For Plex library cold storage)

==== Software

brew install go brew install dep

==== Environment [%header,cols=2*] |=== |Environment Variable Name|Description

|AWS_RESOURCE_TAG_NAME_VALUE| |DYNAMODB_ENDPOINT| |FLIXCTL_HOST| |PLEX_PASSWORD| |PLEX_PORT| |PLEX_TOKEN| |RADARR_API_KEY| |RADARR_URL| |PLEX_USER| |SLACK_CLIENT ID| |SLACK_CLIENT_SECRET| |SLACK_LEGACY_TOKEN| |SLACK_REDIRECT_URI| |SLACK_GENERAL_HOOK_URL| |SLACK_MONITORING_HOOK_URL| |SLACK_NEW_RELEASES_HOOK_URL| |SLACK_NOTIFICATION| |SLACK_REQUESTS_HOOK_URL| |SLACK_SIGNING_SECRET| |SONARR_API_KEY| |SONARR_URL| |TAUTULI_API_KEY| |TRANSMISSION_PORT| |TR_AUTH| |===

=== Installing it as a Slack app To install the CLI into your Slack workspace, start the oauth flow https://marianoflix.duckdns.org/auth[here].

=== Useful commands ==== Dependencies

make dep

==== Lints

make lint

==== Build (CLI and λ's)

make build

==== Install flixctl

make install

==== Deploy λ's

make deploy-lambdas

=== Usage ==== flixctl

$ flixctl --help To Control The Following flixctl Components:

  • Library
  • NZB Client
  • Ombi
  • Plex
  • Radarr
  • Sonarr
  • Torrent Client

Usage: flixctl [command]

Available Commands: help Help about any command library To Control Media Library nzb To Control Nzb Client ombi To Control Ombi plex To Control Plex Media Center radarr To Control Radarr sonarr To Control Sonarr torrent To Control Torrent Client version To Get flixctl Version

Flags: -h, --help help for flixctl

Use "flixctl [command] --help" for more information about a command.


==== flixctl admin

flixctl admin --help To Perform Admin / Maintenance Tasks

Usage: flixctl admin [command]

Available Commands: renew-certs To Renew Certs restart-services To Restart Plex Services slack-purge To purge slack messages slack-token To Get An Oauth Token

Flags: -h, --help help for admin

Use "flixctl admin [command] --help" for more information about a command.

==== flixctl plex

$ flixctl plex --help To Control Plex Media Server

Usage: flixctl plex [command]

Available Commands: start To Start Plex status To Get Plex Status stop To Stop Plex token To Get Plex Token

Flags: -h, --help help for plex

Use "flixctl plex [command] --help" for more information about a command.

==== flixctl library

$ flixctl library --help To Control Media Library

Usage: flixctl library [command]

Available Commands: catalogue To Show Plex And Library Catalogue delete To Delete Archives From Library download To Download Movies Or Shows initiate To Initiate Library Jobs inventory To Show Library Inventory jobs To List Library Jobs sync To Sync Plex Watched Movies And Shows upload To Upload Movies Or Shows

Flags: -h, --help help for library

Use "flixctl library [command] --help" for more information about a command.

==== flixctl torrent

$ flixctl torrent --help To Control Torrent Client

Usage: flixctl torrent [command]

Available Commands: download To Download a Torrent search To Search for Torrents status To Show Torrents Status

Flags: -h, --help help for torrent

Use "flixctl torrent [command] --help" for more information about a command.

==== flixctl ombi

$ flixctl ombi --help To Control Ombi

Usage: flixctl ombi [command]

Available Commands: request To Request Movies or Shows

Flags: -h, --help help for ombi

Use "flixctl ombi [command] --help" for more information about a command.

==== flixctl nzb

$ flixctl nzb --help To Control NZB Client

Usage: flixctl nzb [command]

Available Commands: status To Show NZB Status

Flags: -h, --help help for nzb

Use "flixctl nzb [command] --help" for more information about a command.

=== Examples ==== flixctl

$ flixctl version

==== flixctl admin

$ flixctl admin renew-cert

$ flixctl admin restart-services

$ flixctl admin slack-purge

$ flixctl admin slack-token
--slack-client-id xxxxxxxxxxxx.xxxxxxxxxxxx
--slack-client-secret xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--slack-code code
--slack-redrect-uri https://redirect-uri.com

==== flixctl plex

$ flixctl plex start
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl plex status
--slack-notification "false"

$ flixctl plex stop
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl plex monitor
--max-inactive-time 30
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl plex token

==== flixctl torrent

$ flixctl torrent download
--magnet-link "magnet:?xt=urn:btih:80707BDD08084AFD5996BF88DC879BA1B1C0CB67&dn=T2+Trainspotting+2017+BDRip+1080p&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.ch%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Fpublic.popcorn-tracker.org%3A6969%2Fannounce&tr=udp%3A%2F%2Feddie4.nl%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710%2Fannounce"

$ flixctl torrent search
--keywords Trainspotting
--minimum-quality 1080
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl torrent status
--slack-notification "true"
--slack-notification-channel "monitoring"

==== flixctl library

$ flixctl library catalogue
--filter <all|archived|live|unwatched|watched>

$ flixctl library delete
--archive-id U1IDD8GVNYGhtnbtjfr7_oV-h9hNqcjAkR1RfCdBrL8uoQdlViB0TtGUvnWrKkLM8nlf7LEZTV_X8CuXVoMKtnEBOBELgmmuQDIZkSA9xU-mlWJMSxf_132VcP4RTXNxZ7MdmTdNGA

$ flixctl library download
--job-id RP5RUuUyX0PxGlbipyeUr-pjPB74lYqOqXT6mA6sjrDU3y2Y7-ggAgQepNKeuULMpw8RIhNo6U60bTIONhxVI9dg61az
--target-file "/plex/movies/glacier/movie-$(date +%Y-%m-%d.%H:%M:%S).zip"

$ flixctl library inventory
--enable-sync "true"
--max-upload-items "2"
--job-id RP5RUuUyX0PxGlbipyeUr-pjPB74lYqOqXT6mA6sjrDU3y2Y7-ggAgQepNKeuULMpw8RIhNo6U60bTIONhxVI9dg61az
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl library inventory
--enable-sync "false"
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl library initiate

$ flixctl library initiate
--archive-id U1IDD8GVNYGhtnbtjfr7_oV-h9hNqcjAkR1RfCdBrL8uoQdlViB0TtGUvnWrKkLM8nlf7LEZTV_X8CuXVoMKtnEBOBELgmmuQDIZkSA9xU-mlWJMSxf_132VcP4RTXNxZ7MdmTdNGA
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl library jobs
--filter <all|archive|inventory>
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl library sync
--slack-notification "true"
--slack-notification-channel "monitoring"

$ flixctl library upload
--enable-batch-mode "true"

$ flixctl library upload
--enable-batch-mode "false"
--source-file "/plex/movies/trainspoting/Trainspoting.mkv"