Skip to content

Commit

Permalink
chore: Rename to CastSponsorSkip
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Aug 15, 2023
1 parent 96d971d commit aa81b3a
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
.pre-commit-config.yaml
Dockerfile
docker-compose.yml
sponsorblockcast-go
castsponsorskip
vendor/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

dist/
vendor/
sponsorblockcast-go
castsponsorskip
8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: sponsorblockcast-go
project_name: castsponsorskip
builds:
- env:
- CGO_ENABLED=0
Expand Down Expand Up @@ -69,16 +69,16 @@ docker_manifests:
nfpms:
- id: packages
vendor: Gabe Cook
homepage: https://github.com/gabe565/sponsorblockcast-go
homepage: https://github.com/gabe565/CastSponsorSkip
description: A Go program that skips sponsored YouTube content on all local Google Cast devices
license: GPL-3.0
maintainer: Gabe Cook <[email protected]>
formats:
- deb
- rpm
contents:
- src: ./sponsorblockcast-go.service
dst: /etc/systemd/system/sponsorblockcast-go.service
- src: ./castsponsorskip.service
dst: /etc/systemd/system/castsponsorskip.service
type: config
publishers:
- name: fury.io
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ WORKDIR /app

RUN apk add --no-cache tzdata

ARG USERNAME=sponsorblockcast-go
ARG USERNAME=castsponsorskip
ARG UID=1000
ARG GID=$UID
RUN addgroup -g "$GID" "$USERNAME" \
&& adduser -S -u "$UID" -G "$USERNAME" "$USERNAME"

COPY --from=go-builder /app/sponsorblockcast-go ./
COPY --from=go-builder /app/castsponsorskip ./

USER $UID
CMD ["./sponsorblockcast-go"]
CMD ["./castsponsorskip"]
6 changes: 3 additions & 3 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ WORKDIR /app

RUN apk add --no-cache tzdata

COPY sponsorblockcast-go .
COPY castsponsorskip .

ARG USERNAME=sponsorblockcast-go
ARG USERNAME=castsponsorskip
ARG UID=1000
ARG GID=$UID
RUN addgroup -g "$GID" "$USERNAME" \
&& adduser -S -u "$UID" -G "$USERNAME" "$USERNAME"
USER $UID

CMD ["./sponsorblockcast-go"]
CMD ["./castsponsorskip"]
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# sponsorblockcast-go
# CastSponsorSkip

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

This program will scan for all Google Cast devices on the LAN, and runs a Goroutine for each one to efficiently poll its status every minute. If a Cast device is found to be playing a YouTube video, the poll interval is increased to once every second, sponsored segments are fetched from the SponsorBlock API and stored in memory. Whenever the Cast device reaches a sponsored segment, the program tells it to seek to the end of the segment.

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

## Installation

Expand All @@ -18,7 +18,7 @@ Additionally, sponsorblockcast-go will look for skippable YouTube ads, and autom
#### Docker
Run the below commands as root or a member of the `docker` group:
```shell
docker run --network=host --name=sponsorblockcast-go ghcr.io/gabe565/sponsorblockcast-go
docker run --network=host --name=castsponsorskip ghcr.io/gabe565/castsponsorskip
```

#### Docker Compose
Expand Down Expand Up @@ -49,9 +49,9 @@ Additionally, sponsorblockcast-go will look for skippable YouTube ads, and autom
sudo apt update
```

4. Install sponsorblockcast-go
4. Install CastSponsorSkip
```shell
sudo apt install sponsorblockcast-go
sudo apt install castsponsorskip
```
</details>

Expand All @@ -74,9 +74,9 @@ Additionally, sponsorblockcast-go will look for skippable YouTube ads, and autom
gpgcheck=0
```

3. Install sponsorblockcast-go
3. Install CastSponsorSkip
```shell
sudo yum install sponsorblockcast-go
sudo yum install castsponsorskip
```
</details>

Expand All @@ -86,7 +86,7 @@ Additionally, sponsorblockcast-go will look for skippable YouTube ads, and autom
<summary>Click to expand</summary>

```shell
brew install gabe565/tap/sponsorblockcast-go
brew install gabe565/tap/castsponsorskip
```
</details>

Expand All @@ -97,11 +97,11 @@ Additionally, sponsorblockcast-go will look for skippable YouTube ads, and autom

#### Instructions

Download and run the [latest release binary](https://github.com/gabe565/sponsorblockcast-go/releases/latest) for your system and architecture.
Download and run the [latest release binary](https://github.com/gabe565/CastSponsorSkip/releases/latest) for your system and architecture.
</details>

## Usage
Run `sponsorblockcast-go` from a terminal or activate the service with `systemctl enable --now sponsorblockcast-go`.
Run `castsponsorskip` from a terminal or activate the service with `systemctl enable --now castsponsorskip`.

## Configuration
You can configure the following parameters by setting the appropriate command line flag or environment variable:
Expand All @@ -116,7 +116,7 @@ You can configure the following parameters by setting the appropriate command li
To modify the variables when running as a systemd service, create an override for the service with:

```shell
sudo systemctl edit sponsorblockcast-go.service
sudo systemctl edit castsponsorskip.service
```

This will open a blank override file where you can specify environment variables like so:
Expand All @@ -130,13 +130,13 @@ Environment="SBC_CATEGORIES=sponsor,selfpromo"
To modify the variables when running as a Docker container, you can add arguments to the `docker run` command like so:

```shell
docker run --network=host --env SBC_PAUSED_INTERVAL=5m --env SBC_PLAYING_INTERVAL=2s --name=sponsorblockcast-go ghcr.io/gabe565/sponsorblockcast-go
docker run --network=host --env SBC_PAUSED_INTERVAL=5m --env SBC_PLAYING_INTERVAL=2s --name=castsponsorskip ghcr.io/gabe565/castsponsorskip
```

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

## Differences from sponsorblockcast
- Compiles to a single binary. No dependencies are required other than `sponsorblockcast-go`.
- 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 on lower memory usage.
Expand All @@ -147,4 +147,4 @@ I own 12 Google Cast devices, and have compared CPU and memory usage of the two
| Program | CPU | Memory |
|---------------------|-----|--------|
| sponsorblockcast | 75m | 70Mi |
| sponsorblockcast-go | 1m | 10Mi |
| castsponsorskip | 1m | 10Mi |
4 changes: 2 additions & 2 deletions sponsorblockcast-go.service → castsponsorskip.service
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[Unit]
Description=A Go program that skips sponsored YouTube content on all local Google Cast devices
Documentation=https://github.com/gabe565/sponsorblockcast-go
Documentation=https://github.com/gabe565/CastSponsorSkip
After=network.target

[Service]
Restart=always
ExecStart=/usr/bin/sponsorblockcast-go
ExecStart=/usr/bin/castsponsorskip
TimeoutStopSec=20s

[Install]
Expand Down
6 changes: 3 additions & 3 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"sync"
"syscall"

"github.com/gabe565/sponsorblockcast-go/internal/config"
"github.com/gabe565/sponsorblockcast-go/internal/device"
"github.com/gabe565/castsponsorskip/internal/config"
"github.com/gabe565/castsponsorskip/internal/device"
"github.com/spf13/cobra"
)

func NewCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "sponsorblockcast-go",
Use: "castsponsorskip",
Short: "Skip sponsored YouTube segments on local Cast devices",
RunE: run,
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.9"

services:
app:
image: ghcr.io/gabe565/sponsorblockcast-go
image: ghcr.io/gabe565/castsponsorskip
environment:
SBC_PAUSED_INTERVAL: 1m
SBC_PLAYING_INTERVAL: 1s
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/gabe565/sponsorblockcast-go
module github.com/gabe565/castsponsorskip

go 1.21

Expand Down
4 changes: 2 additions & 2 deletions internal/config/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

func InitViper() func() {
return func() {
viper.SetConfigName("sponsorblockcast-go")
viper.SetConfigName("castsponsorskip")
viper.SetConfigType("yaml")
viper.AddConfigPath("$HOME/.config/")
viper.AddConfigPath("$HOME/")
viper.AddConfigPath("/etc/sponsorblockcast-go/")
viper.AddConfigPath("/etc/castsponsorskip/")

viper.AutomaticEnv()
viper.SetEnvPrefix("SBC")
Expand Down
2 changes: 1 addition & 1 deletion internal/device/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net"
"time"

"github.com/gabe565/sponsorblockcast-go/internal/config"
"github.com/gabe565/castsponsorskip/internal/config"
castdns "github.com/vishen/go-chromecast/dns"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/device/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"log/slog"
"time"

"github.com/gabe565/sponsorblockcast-go/internal/config"
"github.com/gabe565/sponsorblockcast-go/internal/sponsorblock"
"github.com/gabe565/castsponsorskip/internal/config"
"github.com/gabe565/castsponsorskip/internal/sponsorblock"
"github.com/vishen/go-chromecast/application"
"github.com/vishen/go-chromecast/cast/proto"
castdns "github.com/vishen/go-chromecast/dns"
Expand Down
2 changes: 1 addition & 1 deletion internal/sponsorblock/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
"net/url"

"github.com/gabe565/sponsorblockcast-go/internal/config"
"github.com/gabe565/castsponsorskip/internal/config"
)

type Segment struct {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"os"

"github.com/gabe565/sponsorblockcast-go/cmd"
"github.com/gabe565/castsponsorskip/cmd"
)

func main() {
Expand Down

0 comments on commit aa81b3a

Please sign in to comment.