Coder Social home page Coder Social logo

castsponsorskip's Introduction

CastSponsorSkip

CastSponsorSkip Icon

GitHub release (latest by date) Build Go Report Card Quality Gate Status

A Go program that skips sponsored YouTube content and skippable ads on all local Google Cast devices, using the SponsorBlock API. This project was inspired by sponsorblockcast, but written from scratch to decrease memory and CPU usage, and to work around some of its problems (see Differences from sponsorblockcast).

When run, this program will watch all Google Cast devices on the LAN. If a Cast device begins playing a YouTube video, sponsored segments are fetched from the SponsorBlock API. When the device reaches a sponsored segment, the CastSponsorSkip will quickly seek to the end of the segment.

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

Installation

Docker

Click to expand

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 or in the example docker-compose file.

Docker

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

docker run --network=host --name=castsponsorskip ghcr.io/gabe565/castsponsorskip

Docker Compose

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

docker compose up -d

Home Assistant Addon

Click to expand

A Home Assistant addon is provided by @alexbelgium and @bruvv. See alexbelgium/hassio-addons for installation instructions.

APT (Ubuntu, Debian)

Click to expand
  1. If you don't have it already, install the ca-certificates package

    sudo apt install ca-certificates
  2. Add gabe565 apt repository

    echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list
    
  3. Update apt repositories

    sudo apt update
  4. Install CastSponsorSkip

    sudo apt install castsponsorskip

RPM (CentOS, RHEL)

Click to expand
  1. If you don't have it already, install the ca-certificates package

    sudo dnf install ca-certificates
  2. Add gabe565 rpm repository to /etc/yum.repos.d/gabe565.repo

    [gabe565]
    name=gabe565
    baseurl=https://rpm.gabe565.com
    enabled=1
    gpgcheck=0
  3. Install CastSponsorSkip

    sudo dnf install castsponsorskip

AUR (Arch Linux)

Click to expand

Install castsponsorskip-bin with your AUR helper of choice.

Homebrew (macOS, Linux)

Click to expand

Install CastSponsorSkip from gabe565/homebrew-tap:

brew install gabe565/tap/castsponsorskip

Kubernetes

Click to expand

CastSponsorSkip doesn't require a Service or Ingress, so it's simple to host in Kubernetes with a single Deployment. The only gotcha is that hostNetwork must be enabled for device discovery to work.

A Helm chart is available to make Kubernetes deployment even simpler. For more information, see charts.gabe565.com or Artifact Hub.

Manual Installation

Click to expand

Download and run the latest release binary for your system and architecture.

Usage

Run castsponsorskip from a terminal or activate the service with systemd:

systemctl enable --now castsponsorskip
Homebrew Instructions

Use brew services to start CastSponsorSkip:

brew services start castsponsorskip

Configuration

CastSponsorSkip can be configured with envs, command-line flags, or a config file. Some notable envs are listed below, but all flags can be set with envs.
To use an env that is not listed here, capitalize all characters, replace - with _, and prefix with CSS_. For example, --paused-interval=1m would become CSS_PAUSED_INTERVAL=1m.

Notable Envs

Env Description Default
CSS_DISCOVER_INTERVAL Interval to restart the DNS discovery client. 5m
CSS_PAUSED_INTERVAL Time to wait between each poll of the Cast device status when paused. 1m
CSS_PLAYING_INTERVAL Time to wait between each poll of the Cast device status when playing. 500ms
CSS_CATEGORIES Comma-separated list of SponsorBlock categories to skip, see category list and category breakdown. sponsor
CSS_YOUTUBE_API_KEY YouTube API key for fallback video identification (required on some Chromecast devices).
CSS_MUTE_ADS Mutes the device while an ad is playing. true
CSS_DEVICES Comma-separated list of device addresses. This will disable discovery and is not recommended unless discovery fails. []
CSS_SKIP_SPONSORS Toggles sponsored segment skipping via the SponsorBlock API. If disabled, only YouTube ads will be skipped. true

Note

sponsorblockcast envs are also supported to simplify the migration to CastSponsorSkip. When used, a deprecation warning will be logged with an updated env key and value. There are currently no plans to remove these envs.

Flags

See command-line flag documentation here.

Systemd

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

sudo systemctl edit castsponsorskip.service

This will open a blank override file where you can specify environment variables like so:

[Service]
Environment="CSS_PAUSED_INTERVAL=1m"
Environment="CSS_PLAYING_INTERVAL=1s"
Environment="CSS_CATEGORIES=sponsor,selfpromo"

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 CSS_PAUSED_INTERVAL=5m --env CSS_PLAYING_INTERVAL=2s --name=castsponsorskip ghcr.io/gabe565/castsponsorskip

Docker Compose

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

Differences from sponsorblockcast

  • Uses the SponsorBlock enhanced privacy endpoint. When searching for sponsored segments, the video ID is hashed and only the first 4 characters of the hash are passed to SponsorBlock. This allows CastSponsorSkip to fetch segments without telling SponsorBlock what video is being watched.
  • Compiles to a single binary. No dependencies are required other than CastSponsorSkip.
  • Scans Cast device status much less frequently when a YouTube video is not playing, resulting in decreased CPU usage and less stress on the Cast device.
  • Written Go, which is the same language as go-chromecast. This means go-chromecast functions can be called directly instead of relying on shell scripts, child commands, or string parsing.
  • go-chromecast only needs to be loaded once within a single Go program, resulting in lower memory usage.
  • Dependency updates are automated with Renovate.

I own 12 Google Cast devices, and have compared CPU and memory usage of the two programs. Note that CPU usage is measured in "milliCPU", meaning that 1m is equal to 1/1000 of a CPU. Here are the averages:

Program CPU Memory
sponsorblockcast 75m 70Mi
castsponsorskip 1m 10Mi

castsponsorskip's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

castsponsorskip's Issues

[Feature] Expand scope to include Youtube TV applications

This project looks amazing!

I was testing this project and was happy with how it worked for casting however I was quite confused as to why it didn't work for Youtube TV apps like isponsorblocktv. Is it possible to expand this project's scope to cover both casting and YouTube TV Apps?

In the meantime, I am running both projects but am concerned they will clash.

The other problem I ran into was Advert muting doesn't work on my TV. CastSponsorSkip attempts to mute the TV however a grey alert bubble on the TV says something along the lines of using the remote to control the TV volume. I suspect this is due to setting the volume to 0 rather than using "Mute". My TV CEC implementation only provides volume increase, decrease and mute and will complain if I try to use the volume slider within the Chromecast remote app however the dedicated mute button functions as expected. Functionally equivalent but ever so slightly different. This functionality does work with isponsorblocktv.

Thanks for all the hard work and I hope this makes sense!

Duplicate Log Lines

Using newest release, but has been long-running

2023/09/05 17:45:19 INFO Skipping to timestamp. device="Living Room TV" category=sponsor from=0s to=3s
2023/09/05 17:45:19 INFO Skipping to timestamp. device="Living Room TV" category=sponsor from=0s to=3s
2023/09/05 17:45:20 INFO Skipping to timestamp. device="Living Room TV" category=sponsor from=0s to=3s
2023/09/05 17:45:21 INFO Skipping to timestamp. device="Living Room TV" category=sponsor from=1s to=3s
2023/09/05 17:45:21 INFO Skipping to timestamp. device="Living Room TV" category=sponsor from=1s to=3s

Examples of log lines showing up multiple times, potentially more than one action.

Doesn't affect experience currently, but inconsistancy is the devil, in programatic terms.

Does not happen every time, but often

Error: search returned no videos occuring multiple times per video, runs quota up

Using latest version,

In a lot of videos, the following log lines will appear

2023/09/03 18:00:21 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"
2023/09/03 18:00:21 ERROR Failed to find video on YouTube. device="Living Room TV" error="search returned no videos"

And it will continue to occur roughly every minute, never resolving the video.

I was told that this was more likely related to buffering, but this has been shown to not be correct, as regardless of buffer status this can occur, although it is more likely to occur on long (>30m) videos

Almost Every day now, when using youtube normally with CastSponsorSkip running, I am more likely to hit my Quota cap, due to all the requests that never resolve, leaving the application completely useless until quota reset the next day


2023/09/03 18:37:32 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"
2023/09/03 18:37:32 ERROR Failed to find video on YouTube. device="Living Room TV" error="search returned no videos"
2023/09/03 18:38:32 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"
2023/09/03 18:38:33 ERROR Failed to find video on YouTube. device="Living Room TV" error="search returned no videos"
2023/09/03 18:39:33 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"
2023/09/03 18:39:33 ERROR Failed to find video on YouTube. device="Living Room TV" error="search returned no videos"
2023/09/03 18:40:33 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"
2023/09/03 18:40:33 ERROR Failed to find video on YouTube. device="Living Room TV" error="search returned no videos"
2023/09/03 18:41:33 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"
2023/09/03 18:41:34 ERROR Failed to find video on YouTube. device="Living Room TV" error="search returned no videos"
2023/09/03 18:42:34 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"
2023/09/03 18:42:34 ERROR Failed to find video on YouTube. device="Living Room TV" error="search returned no videos"
2023/09/03 18:43:34 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"
2023/09/03 18:43:34 ERROR Failed to find video on YouTube. device="Living Room TV" error="search returned no videos"
2023/09/03 18:44:34 INFO Video ID not found. Searching for video on YouTube... device="Living Room TV"

Same video


2023/09/02 01:32:07 INFO Video ID not found. Searching for video on YouTube... device="Bedroom TV"
2023/09/02 01:40:39 ERROR Failed to find video on YouTube. device="Bedroom TV" error="googleapi: Error 403: The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota., quotaExceeded"

Error message when quota is exceeded

Question: Broken pipe

Hello, I have this error and I don't know how to fix it.

2023/09/24 05:16:14 INFO Searching for devices...
2023/09/24 05:16:15 INFO Connected to cast device. device="HUB Enrico"
2023/09/24 05:16:19 INFO Connected to cast device. device="Enrico TV"
2023/09/24 06:19:52 ERROR Lost connection to device. device="HUB Enrico" error="unable to write binary format: write tcp 192.168.0.61:51232->192.168.0.107:8009: write: broken pipe"
2023/09/24 06:21:15 INFO Connected to cast device. device="HUB Enrico"

Limit which device to control

Feature request:

An env/flag to specify a device name (or multiple) to limit the control to only the specified devices.

When ad plays it skips back to end of first segment

When i watch https://youtu.be/1dv54CJycgs?si=pgNPaWJuO6kcBuyI and theres a ad at like 15 minute mark it will see the timestamp of the ad as video timestamp and tries to skip the ad which it thinks is the first segment

Log:

Starting...
/etc/cont-init.d/00-banner.sh: executing

-----------------------------------------------------------
 Add-on: Castsponsorskip
 Skip YouTube ads and sponsorships on all local Google Cast devices
-----------------------------------------------------------
 Add-on version: 0.7.4
 You are running the latest version of this add-on.
 System: Home Assistant OS 12.1  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2024.3.3
 Home Assistant Supervisor: 2024.03.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
CSS_CATEGORIES='sponsor,selfpromo,interaction,intro,outro,preview,music_offtopic,filler'
CSS_MUTE_ADS='true'
'
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory

Load environment variables from /config/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f-sponsorblockcast/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables

... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /addon_configs/db21ed7f-sponsorblockcast/sponsorblockcast.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/99-run.sh: executing
[07:26:43] INFO: Starting app
2024/03/25 07:26:43 INFO CastSponsorSkip v0.7.4 (0303a25)
2024/03/25 07:26:43 INFO Searching for devices...
2024/03/25 07:26:44 INFO Connected to cast device. device="MagentaTV ONE"
2024/03/25 07:26:44 INFO Video ID not set. Searching YouTube for video ID... device="MagentaTV ONE"
2024/03/25 07:26:45 INFO Detected video stream. device="MagentaTV ONE" video_id=1dv54CJycgs
2024/03/25 07:26:45 INFO Found segments for video. device="MagentaTV ONE" segments=5
2024/03/25 07:28:47 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=0s to=6s
2024/03/25 07:28:47 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:47 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:47 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=1s to=6s
2024/03/25 07:28:47 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:47 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:48 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=1s to=6s
2024/03/25 07:28:48 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:48 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:48 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=2s to=6s
2024/03/25 07:28:48 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:48 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:49 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=2s to=6s
2024/03/25 07:28:49 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:49 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:49 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=3s to=6s
2024/03/25 07:28:49 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:49 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:50 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=3s to=6s
2024/03/25 07:28:50 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:50 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:50 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=4s to=6s
2024/03/25 07:28:50 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:50 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:51 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=4s to=6s
2024/03/25 07:28:51 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:51 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:51 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=5s to=6s
2024/03/25 07:28:51 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:51 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s
2024/03/25 07:28:52 INFO Skipping to timestamp. device="MagentaTV ONE" category=outro from=5s to=6s
2024/03/25 07:28:52 INFO Skipping to timestamp. device="MagentaTV ONE" category=preview from=6s to=1m17s
2024/03/25 07:28:52 INFO Skipping to timestamp. device="MagentaTV ONE" category=intro from=1m17s to=1m26s

Bug: 0.3.1 outputs help text and quits

Since teh update to 0.3.1 I can only get CSS to output the help text and quit.

Has the default behaviour so start it with castsponsorskip been changed? The service fails as well.

Feature Request: OpenWRT support

Firstly I’d like to thank the creator and contributors for this fantastic product.

I have an OpenWRT based router and I like the idea of being to install this directly on there. I’m not sure what the complications are, but if it is a standalone binary, then it might just need to be packaged in the opkg format.

Feature Request: Monitor specific devices via IP -or- DNS name

What if instead of monitoring the entire subnet for casting devices, one possible command-line option could be something like '--device-list' with a string list like '192.168.0.3','10.0.0.5' -or- cast1.contoso.local,cast2.fabrikam.local

Case being, not even a huge issue, but I have 4 cast devices in my office, two speakers, two chromecasts. I just don't care if it monitors the speakers, and if there are a large amount of cast devices in a discoverable network, then it may be more prudent resource-wise to allow the 'Selection' of devices.

I'm wondering if focusing on one device would allow sponsorskips, e.g. to be detected quicker, and executed quicker, based on not having to poll unnecessary devices

Fails when trying to attach to a nonexistent IPv6 interface

Heya! That's a neat service, thank you :)

I've hit a problem running it on my laptop (both 'natively' and via Docker). It spams that line to the logs:

2023/12/11 21:44:33 ERROR Failed to discover devices. error="unable to create new zeroconf resolver: listen udp6 [ff02::]:5353: socket: address family not supported by protocol"

I'm running Arch Linux rolling, and I don't have any v6 interfaces. Here's the ip a:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 04:7b:cb:b3:4a:e0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.50.123/24 brd 192.168.50.255 scope global dynamic noprefixroute wlan0
       valid_lft 84715sec preferred_lft 84715sec
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:00:a2:22:a0 brd ff:ff:ff:ff:ff:ff
    inet 172.4.0.1/24 brd 172.4.0.255 scope global docker0
       valid_lft forever preferred_lft forever

Cheers! Let me know if you need me as a guinea pig to test things :)

Failing to Query Segments on Videos

Running environment is Ubuntu 22.04.3 LTS x86_64 VM under Proxmox, installing through the apt repo and configured using systemctl overrides.

Everything but segment retrieval seems to be working. When I tail the systemctl logs, I see it reaching out to and establishing connections with all cast devices on my network. Video lookup succeeds via the YouTube API key provided, but segment retrieval returns the error "Invalid response status: 400 bad request".

The application and my Cast devices are located on separate VLANs, but I have firewall rules created to allow traffic between CastSponsorSkip and the Cast devices to flow bidirectionally, so it isn't a reachability issue. Is there a way to turn up the verboseness of the logs to see if anything else is being caught? I can provide my journalctl tail if needed.

Video Detection not occurring until 30s-45s into videos usually

Using new version, on advise to not change pause interval
Both the device running the program (Windows 11 Laptop) and the YouTube-playing chromecast Ultra w/ Google TV (Using standard youtube app) are on ethernet.
Still most of the time, the detection of the playback of a video doesn't occur until 30s-45s in, sometimes missing content at the beginning of the video

Feature Request: Retry segment download on timeout.

When a video is already running on boot (like when having an RPi powered by the TV itself) the segment download fails:

Aug 28 11:29:41 DietPi systemd[1]: Started castsponsorskip.service - A Go program that skips sponsored YouTube content on all local Google Cast devices.
Aug 28 11:29:43 DietPi castsponsorskip[429]: 2023/08/28 11:29:43 INFO Searching for devices...
Aug 28 11:29:43 DietPi castsponsorskip[429]: 2023/08/28 11:29:43 INFO Connected to cast device. device="Chromeo ULTRA"
Aug 28 11:29:44 DietPi castsponsorskip[429]: 2023/08/28 11:29:44 INFO Detected video stream. device="Chromeo ULTRA" video_id=[redacted]
Aug 28 11:29:54 DietPi castsponsorskip[429]: 2023/08/28 11:29:54 ERROR Failed to query segments. Retrying... device="Chromeo ULTRA" error="Get \"https://sponsor.ajay.app/api/skipSegments/[redacted]?category=sponsor&category=selfpromo&category=interaction\": net/http: TLS handshake timeout"

It says retrying, but does not seem to do that. Might be specific to my setup, but I can imagine segment download could also fail for numerous other temporary reasons. Maybe add limited retries on fail?

Thank you for considering!

Apple tv support?

Hi,

It's probably no go but this can work with Apple TV YouTube cast or app?

monitor specific device/IP address

Please add the ability to specific the exact device IP address. I cannot get network discovery to work from a docker container, with the standard network config:

docker run --rm -e CSS_DISCOVER_INTERVAL=30s -e CSS_NETWORK_INTERFACE=br0 -e CSS_LOG_LEVEL=debug --network=host --name=castsponsorskip ghcr.io/gabe565/castsponsorskip

I have confirmed my network connectivity to port 8009 on my Chromecast device which is on the same VLAN and subnet.

Would you please consider allowing a specific device, and then waiting for discovery that never happens is not needed.

Stopped working without any apparent errors in debug logs

I noticed that skipping sponsor segments stopped working in the past week or two, but the logs are really not showing any activity.

Restarting the players and the container didn't seem to fix the issue.

I'm running CSS in docker with the following docker-compose:

version: "3.9"

services:
  app:
    image: ghcr.io/gabe565/castsponsorskip:latest
    environment:
      TZ: UTC
      CSS_YOUTUBE_API_KEY: ${API_KEY}
      CSS_LOG_LEVEL: debug
    network_mode: host
    restart: unless-stopped

and the logs just show "Requesting update":

time=2024-02-15T19:09:27.556Z level=INFO msg="CastSponsorSkip v0.7.2 (efdb2b5)"
time=2024-02-15T19:09:27.556Z level=INFO msg="Searching for devices..."
time=2024-02-15T19:09:27.762Z level=INFO msg="Connected to cast device." device=Shield
time=2024-02-15T19:09:27.776Z level=DEBUG msg="Ignoring device." device="Speaker" reason="Does not support video"
time=2024-02-15T19:09:27.785Z level=INFO msg="Connected to cast device." device="Kitchen Display"
time=2024-02-15T19:09:28.263Z level=DEBUG msg="Requesting update." device=Shield
time=2024-02-15T19:09:28.287Z level=DEBUG msg="Requesting update." device="Kitchen Display"
time=2024-02-15T19:09:40.290Z level=DEBUG msg="Requesting update." device=Shield

I was initially running CSS in a k3s cluster, where it had been running version 5.0.0 for a long time without issues, but tried updating to 0.7.2 there and then migrating to a separate server with just Docker directly.

Any thoughts on how I could troubleshoot further? For reference, the main player I use is a Nvidia Shield (not the pro)

Does this app even work on Windows 11 at all?

cc

This is the only thing I get after running the exe. Nothing happens after that even after starting my CC, playing youtube videos or even starting CC first instead of CastSponsorSkip. The help document mentions nothing of Windows version.

Oh I am running chromecast v2 if this helps. What am I missing here? Thanks

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
docker-compose.yaml
dockerfile
Dockerfile
  • golang 1.22.1-alpine
  • alpine 3.19
Dockerfile.goreleaser
  • alpine 3.19
github-actions
.github/workflows/build.yml
  • actions/checkout v4
  • actions/setup-go v5
  • golangci/golangci-lint-action v6
  • actions/checkout v4
  • actions/setup-go v5
  • actions/checkout v4
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/login-action v3
  • actions/setup-go v5
  • actions/create-github-app-token v1
  • goreleaser/goreleaser-action v5
  • actions/upload-artifact v4
gomod
go.mod
  • go 1.22.1
  • github.com/buger/jsonparser v1.1.1
  • github.com/spf13/cobra v1.8.0
  • github.com/spf13/pflag v1.0.5
  • github.com/spf13/viper v1.18.2
  • github.com/stretchr/testify v1.9.0
  • github.com/vishen/go-chromecast v0.3.2-0.20240219225211-acc55e473219@acc55e473219
  • google.golang.org/api v0.169.0
pre-commit
.pre-commit-config.yaml
  • TekWizely/pre-commit-golang v1.0.0-rc.1

  • Check this box to trigger a request for Renovate to run again on this repository

Discovery of devices connected via VPN

Hello everyone,

I have a CCwGTV that I use for traveling, and it would be great if I could also use CastSponsorSkip (CSS) with it.

My Setup is like this:
NAS with OpenMediaVault, running Docker and CSS (LAN IP: 192.168.0.100)
PiHole on a OrangePi Zero, with a Wireguard server (LAN IP: 192.168.0.3)
The IPs of the Wireguard clients are in the 10.100.0.x range.

I hoped that connecting the CCwGTV via Wireguard would do the trick, but unfortunately the device is not found by CSS, neither with limited IP ranges for the traffic, nor with all traffic routed through Wireguard.

Is there something I can do to make this work, or is there a different solution for CSS to discover a remote CCwGTV?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
docker-compose.yaml
dockerfile
Dockerfile
  • golang 1.21.5-alpine
  • alpine 3.19
Dockerfile.goreleaser
  • alpine 3.19
github-actions
.github/workflows/build.yml
  • actions/checkout v4
  • actions/setup-go v5
  • golangci/golangci-lint-action v3
  • actions/checkout v4
  • actions/setup-go v5
  • actions/checkout v4
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/login-action v3
  • actions/setup-go v5
  • goreleaser/goreleaser-action v5
  • actions/upload-artifact v4
gomod
go.mod
  • go 1.21.5
  • github.com/buger/jsonparser v1.1.1
  • github.com/spf13/cobra v1.8.0
  • github.com/spf13/pflag v1.0.5
  • github.com/spf13/viper v1.18.2
  • github.com/stretchr/testify v1.8.4
  • github.com/vishen/go-chromecast v0.3.2-0.20231028022757-c2af7da8e4b9@c2af7da8e4b9
  • google.golang.org/api v0.154.0
pre-commit
.pre-commit-config.yaml
  • TekWizely/pre-commit-golang v1.0.0-rc.1

  • Check this box to trigger a request for Renovate to run again on this repository

Disable sponsor skipping and only skip ads?

Is it possible to configure the app to only skip ads and not sponsored segments?

Right now I added a non existing category to get this behaviour, but this does throw a lot of errors in the logs and tries to contact the api, while this would be unnecessary when only skipping ads.

As a side node, could the categories be better documenten? I could not find anywhere what the possible categories actually mean.

ERROR Failed to query segments

When I am running this in docker I am getting the following error, not sure what is wrong, any idea @gabe565 ?

2023/08/27 10:51:24 INFO Searching for devices...
2023/08/27 10:51:24 INFO Connected to cast device. device="Bedroom TV"
2023/08/27 10:51:25 INFO Detected video stream. device="Bedroom TV" video_id=5o1EwksAOWI
2023/08/27 10:51:25 ERROR Failed to query segments. Retrying... device="Bedroom TV" error="invalid response status: 400 Bad Request"

CastSponsorSkip panics after TV turns off and can't reconnect until it is restarted

CastSponsorSkip works perfectly the first time the TV is turned on, but after the TV is turned off CastSponsorSkip is unable to reconnect again until the systemd service has been restarted,

  • Version: CastSponsorSkip v0.6.0 (afeb347)
  • OS: Raspbian 11 (bullseye)
  • Package: gabe565 apt repository
  • Init: systemd
  • Target device: Android TV with Youtube app

Config:

[Service]
Environment="CSS_PAUSED_INTERVAL=20s"
Environment="CSS_CATEGORIES=sponsor,selfpromo,interaction"
Environment="CSS_YOUTUBE_API_KEY=[REMOVED]"
Environment="CSS_LOG_LEVEL=debug"

Logs:

Nov 14 12:19:26 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:19:26.818Z level=DEBUG msg="Requesting update." device=TV
Nov 14 12:19:46 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:19:46.819Z level=DEBUG msg="Requesting update." device=TV
Nov 14 12:20:06 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:20:06.818Z level=DEBUG msg="Requesting update." device=TV
Nov 14 12:20:41 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:20:41.829Z level=DEBUG msg="Failed to update device. Reconnecting..." device=TV error="context deadline exceeded"
Nov 14 12:20:44 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:20:44.832Z level=DEBUG msg="Failed to connect to device. Retrying..." device=TV try=0 error="unable to connect to chromecast at '192.168.1.30:8009': dial tcp 192.168.1.30:8009: i/o timeout"
Nov 14 12:20:50 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:20:50.345Z level=DEBUG msg="Failed to connect to device. Retrying..." device=TV try=1 error="unable to connect to chromecast at '[<nil>]:0': dial tcp: lookup <nil>: no such host"
Nov 14 12:20:56 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:20:56.355Z level=DEBUG msg="Failed to connect to device. Retrying..." device=TV try=2 error="unable to connect to chromecast at '[<nil>]:0': dial tcp: lookup <nil>: no such host"
Nov 14 12:21:03 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:21:03.378Z level=DEBUG msg="Failed to connect to device. Retrying..." device=TV try=3 error="unable to connect to chromecast at '[<nil>]:0': dial tcp: lookup <nil>: no such host"
Nov 14 12:21:12 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:21:12.387Z level=DEBUG msg="Failed to connect to device. Retrying..." device=TV try=4 error="unable to connect to chromecast at '[<nil>]:0': dial tcp: lookup <nil>: no such host"
Nov 14 12:21:25 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:21:25.401Z level=DEBUG msg="Failed to connect to device. Retrying..." device=TV try=5 error="unable to connect to chromecast at '[<nil>]:0': dial tcp: lookup <nil>: no such host"
Nov 14 12:21:46 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:21:46.411Z level=DEBUG msg="Failed to reconnect." device=TV error="device not found: "
Nov 14 12:21:46 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:21:46.417Z level=ERROR msg="Lost connection to device." device=TV error="context deadline exceeded"
Nov 14 12:21:46 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:21:46.428Z level=DEBUG msg="Panic during close" device=TV error="runtime error: invalid memory address or nil pointer dereference" stack="goroutine 18 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x78\ngithub.com/gabe565/castsponsorskip/internal/device.(*Device).closeApp.func1()\n\tgithub.com/gabe565/castsponsorskip/internal/device/watch.go:118 +0x48\npanic({0x7f1fc8, 0xe17ec8})\n\truntime/panic.go:914 +0x244\ncrypto/tls.(*Conn).Close(0x0)\n\tcrypto/tls/conn.go:1403 +0x14\ngithub.com/vishen/go-chromecast/cast.(*Connection).Close(0x2e9e020)\n\tgithub.com/vishen/[email protected]/cast/connection.go:82 +0xbc\ngithub.com/vishen/go-chromecast/application.(*Application).Close(0x3050090, 0x0)\n\tgithub.com/vishen/[email protected]/application/application.go:431 +0x15c\ngithub.com/gabe565/castsponsorskip/internal/device.(*Device).closeApp(0x2ca5200)\n\tgithub.com/gabe565/castsponsorskip/internal/device/watch.go:122 +0x7c\ngithub.com/gabe565/castsponsorskip/internal/device.(*Device).Close(0x2ca5200)\n\tgithub.com/gabe565/castsponsorskip/internal/device/watch.go:111 +0xa8\ngithub.com/gabe565/castsponsorskip/cmd.run.func1.1()\n\tgithub.com/gabe565/castsponsorskip/cmd/cmd.go:104 +0xb0\ncreated by github.com/gabe565/castsponsorskip/cmd.run.func1 in goroutine 11\n\tgithub.com/gabe565/castsponsorskip/cmd/cmd.go:101 +0x48\n"
Nov 14 12:21:52 raspberrypi castsponsorskip[12350]: time=2023-11-14T12:21:52.479Z level=DEBUG msg="Ignoring device." device=TV reason="Already connected"

Detects but does not connect to any of my chromecast devices

Today I decided to migrate from SponsorBlockCast to CastSponsorSkip and I can't get anything to work. Help please.
Here is the docker-compose file I am using (stack in portainer)

version: "3.9"

services:
  app:
    image: ghcr.io/gabe565/castsponsorskip
    environment:
      # Set the container timezone
      # See identifier list at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      TZ: America/Chicago
      # CSS_PAUSED_INTERVAL:
      # CSS_PLAYING_INTERVAL:
      # CSS_CATEGORIES:
      # CSS_YOUTUBE_API_KEY:
      # CSS_MUTE_ADS:
    network_mode: host
    restart: always

But, when I deploy the container, I get the following errors:

2023/10/10 17:30:56 INFO CastSponsorSkip v0.5.1 (73f3950)
2023/10/10 17:30:57 INFO Searching for devices...
2023/10/10 17:31:47 ERROR Failed to connect to device. device="Media Room TV" error="unable to connect to chromecast at '192.168.36.11:8009': dial tcp 192.168.36.11:8009: i/o timeout"
2023/10/10 17:31:47 ERROR Failed to connect to device. device="Entrance Display" error="unable to connect to chromecast at '192.168.36.105:8009': dial tcp 192.168.36.105:8009: i/o timeout"
2023/10/10 17:31:54 ERROR Failed to connect to device. device="Kitchen Display" error="device not found: "
2023/10/10 17:36:50 ERROR Failed to connect to device. device="Media Room TV" error="unable to connect to chromecast at '192.168.36.11:8009': dial tcp 192.168.36.11:8009: i/o timeout"
2023/10/10 17:36:55 ERROR Failed to connect to device. device="Entrance Display" error="device not found: "
2023/10/10 17:41:55 ERROR Failed to connect to device. device="Media Room TV" error="device not found: "

What is happening here? I do have all my chromecasts on a different VLAN (192.168.36....). But I am running a avahi on my pfsense box which is supposed to enable the discovery. Also as I mentioned, this is working just fine if I deploy SponsorBlock Cast. Are there any fundamental differences in how the networks are handled?

Using the mute feature but not SponsorBlock is difficult and sucks.

I want to use the ad muting and skipping features of this tool, but I don't want to use SponsorBlock. Many of the channels I watch actually do very funny sponsor segments and I enjoy them.

The obvious option seemed to be setting env var CSS_CATEGORIES. CSS_CATEGORIES='' gives me default behaviour (the thing I don't want). So does CSS_CATEGORIES=' '. I had to really fool the config system with CSS_CATEGORIES=' , ' to get it to just have an empty list of zero categories.

This is a pretty rough user experience. Variables explicitly set as being empty should be interpreted as empty, not as unset. It's not the same.

Bug: skippable ads don't get skipped

Skippable ads don't get skipped and they don't show up in log. Setup is a Chromecast Ultra, youtube vids started using cast function. Worked fine with the predecessor, so maybe worth looking into those functions.

I'm available for further testing!

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.