Skip to content

Commit

Permalink
Merge pull request #57 from dmunozv04/v2-test
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
dmunozv04 authored Oct 13, 2023
2 parents 1aa06e6 + 55f2798 commit 9d7d966
Show file tree
Hide file tree
Showing 19 changed files with 1,958 additions and 423 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,72 @@
# This is a basic workflow to help you get started with Actions

name: build docker images

# Controls when the workflow will run
on:
push:
branches:
- 'main'
- '*'
tags:
- 'v*'
pull_request:
branches:
- 'main'
- '*'

workflow_dispatch:

permissions:
contents: read
packages: write

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

# Generate docker tags
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ghcr.io/dmunozv04/isponsorblocktv, dmunozv04/isponsorblocktv
tags: |
type=raw,value=latest,priority=900,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=raw,value=develop,priority=900,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr
type=ref,event=tag
type=ref,event=branch
type=schedule
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GHCR
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/dmunozv04/isponsorblocktv:buildcache
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ cython_debug/
#.idea/

#config folder
config/
config.json
data/
data/config.json

.DS_Store

.DS_Store
16 changes: 5 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
# syntax=docker/dockerfile:1

FROM python:alpine
FROM python:alpine3.11

RUN python -m venv /opt/venv

ENV PATH="/opt/venv/bin:$PATH" PIP_NO_CACHE_DIR=off iSPBTV_docker=True
ENV PIP_NO_CACHE_DIR=off iSPBTV_docker=True TERM=xterm-256color COLORTERM=truecolor

COPY requirements.txt .

RUN apk add gcc musl-dev build-base linux-headers libffi-dev rust cargo openssl-dev git avahi && \
pip install --upgrade pip setuptools-rust wheel && \
pip install -r requirements.txt && \
apk del gcc musl-dev build-base linux-headers libffi-dev rust cargo openssl-dev git && \
rm -rf /root/.cache /root/.cargo

RUN pip install --upgrade pip wheel && \
pip install -r requirements.txt

COPY requirements.txt .

WORKDIR /app

COPY . .

ENTRYPOINT ["/opt/venv/bin/python3", "-u", "main.py"]
ENTRYPOINT ["python3", "-u", "main.py"]
47 changes: 31 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,58 @@
# iSponsorBlockTV
Skip sponsor segments in YouTube videos playing on a YouTube TV device (see below for compatibility details).

Skip sponsor segments in YouTube videos playing on an Apple TV. Sponsor Block in YouTube for apple TV
This project is written in asynchronous python and should be pretty quick.

This project is written in asycronous python and should be pretty quick.

# Installation
## Installation
Check the [wiki](https://github.com/dmunozv04/iSponsorBlockTV/wiki/Installation)

Warning: armv7 builds have been deprecated.
Warning: docker armv7 builds have been deprecated. Amd64 and arm64 builds are still available.

# Usage
## Compatibility
Leyend: ✅ = Working, ❌ = Not working, ❔ = Not tested

Run iSponsorBLockTV on the same network as the Apple TV.
Open an issue/pull request if you have tested a device that isn't listed here.

It connects to the Apple TV, watches its activity and skips any sponsor segment using the [SponsorBlock](https://sponsor.ajay.app/) API.
| Device | Status |
|:-------------------|:------:|
| Apple TV ||
| Samsung TV (Tizen) ||
| LG TV (WebOS) ||
| Android TV ||
| Chromecast ||
| Roku ||
| Fire TV ||
| Nintendo Switch ||
| Xbox One/Series ||
| Playstation 4/5 ||

The last 5 videos' segments are cached to limit the number on queries on SponsorBlock and YouTube.
## Usage
Run iSponsorBlockTV on a computer that has network access.
Auto discovery will require the computer to be on the same network as the device during setup.

It connects to the device, watches its activity and skips any sponsor segment using the [SponsorBlock](https://sponsor.ajay.app/) API.
It can also skip/mute YouTube ads.

# Libraries used
- [pyatv](https://github.com/postlund/pyatv) Used to connect to the Apple TV
## Libraries used
- [pyytlounge](https://github.com/FabioGNR/pyytlounge) Used to interact with the device
- asyncio and [aiohttp](https://github.com/aio-libs/aiohttp)
- [async-cache](https://github.com/iamsinghrajat/async-cache)
- [Textual](https://github.com/textualize/textual/) Used for the amazing new graphical configurator
- [ssdp](https://github.com/codingjoe/ssdp) Used for auto discovery

# Projects using this proect
## Projects using this project
- [Home Assistant Addon](https://github.com/bertybuttface/addons/tree/main/isponsorblocktv)

# Contributing

## Contributing
1. Fork it (<https://github.com/dmunozv04/iSponsorBlockTV/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## Contributors

- [dmunozv04](https://github.com/dmunozv04) - creator and maintainer
- [HaltCatchFire](https://github.com/HaltCatchFire) - updated dependencies and improved skip logic
- [Oxixes](https://github.com/oxixes) - added support for channel whitelist and minor improvements
# License
## License
[![GNU GPLv3](https://www.gnu.org/graphics/gplv3-127x51.png)](https://www.gnu.org/licenses/gpl-3.0.en.html)
23 changes: 18 additions & 5 deletions config.json.template
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
{
"atvs": [
{"identifier": "", "airplay_credentials": ""}
"devices": [
{
"screen_id": "",
"name": "YouTube on TV",
"offset": 0
}
],
"apikey":"",
"skip_categories": ["sponsor"],
"channel_whitelist": []
"skip_categories": [
"sponsor"
],
"skip_count_tracking": true,
"mute_ads": true,
"skip_ads": true,
"apikey": "",
"channel_whitelist": [
{"id": "",
"name": ""
}
]
}
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.3'
services:
iSponsorBlockTV:
image: ghcr.io/dmunozv04/isponsorblocktv
container_name: iSponsorBlockTV
restart: unless-stopped
volumes:
- /PATH_TO_YOUR_DATA_DIR:/app/data
Loading

0 comments on commit 9d7d966

Please sign in to comment.