• This repository has been archived on 21/Aug/2023
  • Stars
    star
    348
  • Rank 121,840 (Top 3 %)
  • Language
    Shell
  • License
    GNU General Publi...
  • Created about 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A shell script that skips sponsored YouTube content on all local Chromecasts

sponsorblockcast

A POSIX shell script that skips sponsored YouTube content and skippable ads on all local Chromecasts, using the SponsorBlock API. It was inspired by CastBlock but written from scratch to avoid some of its pitfalls (see Differences from CastBlock).

Care was taken to ensure it's fully POSIX-compatible, so it can run on lighter shells such as Dash.

The script will scan for all Chromecasts on the LAN, and launches a process for each one to efficiently poll it status every second. If a Chromecast is found to be playing a YouTube video, sponsor segments are fetched from the SponsorBlock API and stored in a temporary file. Whenever the Chromecast reaches a sponsored segment, the script tells it to seek to the end of the segment.

Additionally, sponsorblockcast will look for skippable YouTube ads, and automatically hit the skip button when it becomes avilable.

Installation

Arch Linux

Install sponsorblockcast-git with your AUR helper of choice or with makepkg.

Docker image

You can install Docker directly or use Docker Compose (Or use Podman, Portainer, etc). Please note you MUST use the 'host' network as shown below for CLI Docker or in the example for docker-compose.

Docker

Run the below commands as root or a member of the docker group

  • docker run --network=host --name sponsorblockcast ghcr.io/nichobi/sponsorblockcast:latest

Docker Compose

First you will need a docker-compose.yaml file, such as the example included. Run the below commands as root or a member of the docker group

  • docker-compose up -d

Manual installation

Dependencies

Instructions

Usage

Run sponsorblockcast from a terminal or activate the service with systemctl enable --now sponsorblockcast

Configuration

You can configure the following parameters by setting the appropriate environment values:

  • SBCPOLLINTERVAL - Time to wait between each polling of the Chromecasts' status (default=1)
  • SBCSCANINTERVAL - Time to wait between each scan for available Chromecast (default=300)
  • SBCDIR - Directory where temporary files are stored (default=/tmp/sponsorblockcast)
  • SBCCATEGORIES - Space-separated SponsorBlock categories to skip, see category list (default=sponsor)
  • SBCYOUTUBEAPIKEY - YouTube API key for fallback video identification (required on some Chromecast devices).

To run from the terminal with custom parameters you can use env like so: env SBCSCANINTERVAL=10 SBCPOLLINTERVAL=100 SBCCATEGORIES="sponsor selfpromo" sponsorblockcast

To modify the variables when running as a systemd service, create an override for the service with:

sudo systemctl edit sponsorblockcast.service

This will open a blank override file where you can specify Environment values like so:

[Service]
Environment="SBCPOLLINTERVAL=10"
Environment="SBCSCANINTERVAL=100"
Environment="SBCCATEGORIES=sponsor selfpromo"
Environment="SBCYOUTUBEAPIKEY=<your private API key>"

To modify the variables when running as a Docker container, you can add arguments to the docker run command like so:

docker run --network=host --env SBCPOLLINTERVAL=10 --env SBCSCANINTERVAL=100 --name sponsorblockcast sponsorblockcast:latest

When using docker-compose.yaml you can simply edit the environment directive as shown in the example file.

Differences from CastBlock

  • Regular scans to find new Chromecasts while the script is running
  • Allows configuring parameters
  • Specify which SponsorBlock categories to skip
  • More efficient polling, through using go-chromecast's watch command, avoiding expensive startup costs. This lets us poll much more often, without any large performance costs.
  • Full POSIX-compatibility