From 4473fc925e198632910b6daaec6f92f4f8c9c014 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 00:26:04 +0000 Subject: [PATCH 01/13] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v5.0.0) - [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2) - [github.com/psf/black: 23.1.0 → 24.10.0](https://github.com/psf/black/compare/23.1.0...24.10.0) - [github.com/hadialqattan/pycln: v2.3.0 → v2.4.0](https://github.com/hadialqattan/pycln/compare/v2.3.0...v2.4.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea88378..4141333 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ # Inspired by textual pre-commit config repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v5.0.0 hooks: - id: check-ast # simply checks whether the files parse as valid python - id: check-builtin-literals # requires literal syntax when initializing empty or zero python builtin types @@ -19,20 +19,20 @@ repos: - id: mixed-line-ending # replaces or checks mixed line ending - id: trailing-whitespace # checks for trailing whitespace - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort name: isort (python) language_version: '3.11' args: ["--profile", "black", "--filter-files"] - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 24.10.0 hooks: - id: black language_version: '3.11' args: ["--preview"] - repo: https://github.com/hadialqattan/pycln # removes unused imports - rev: v2.3.0 + rev: v2.4.0 hooks: - id: pycln language_version: "3.11" From 1a271c567a643be0ce936904c1e410cd829f346e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 00:26:20 +0000 Subject: [PATCH 02/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/iSponsorBlockTV/dial_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/iSponsorBlockTV/dial_client.py b/src/iSponsorBlockTV/dial_client.py index ce742c2..75695ea 100644 --- a/src/iSponsorBlockTV/dial_client.py +++ b/src/iSponsorBlockTV/dial_client.py @@ -1,4 +1,5 @@ """Send out an M-SEARCH request and listening for responses.""" + import asyncio import socket From 7880e222b097b05d7bc65cf361566453e08fc532 Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Sun, 15 Dec 2024 02:09:08 +0100 Subject: [PATCH 03/13] change python cpu variant in build --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5565ae..92662bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,6 +89,7 @@ jobs: env: PYAPP_PASS_LOCATION: "1" PYAPP_UV_ENABLED: "1" + PYAPP_DISTRIBUTION_VARIANT_CPU: "v1" HATCH_BUILD_LOCATION: dist CARGO: cargo CARGO_BUILD_TARGET: ${{ matrix.job.target }} From 658fad64ebefe007d067178bc52defe7c9c20df6 Mon Sep 17 00:00:00 2001 From: David <39565245+dmunozv04@users.noreply.github.com> Date: Sun, 15 Dec 2024 02:33:04 +0100 Subject: [PATCH 04/13] Update pyapp --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92662bc..fe62472 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,7 +94,7 @@ jobs: CARGO: cargo CARGO_BUILD_TARGET: ${{ matrix.job.target }} PYAPP_REPO: pyapp # Use local copy of pyapp (needed for cross-compiling) - PYAPP_VERSION: v0.23.0 + PYAPP_VERSION: v0.24.0 steps: - name: Checkout From ec109e0f105c8c705968bd124528b21a24c558fe Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Sun, 15 Dec 2024 14:00:46 +0100 Subject: [PATCH 05/13] Fix x86_64 macOS and test aarch64-windows --- .github/workflows/release.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe62472..017bc62 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,20 +76,24 @@ jobs: release_suffix: aarch64-linux # Windows - target: x86_64-pc-windows-msvc - os: windows-2022 + os: windows-latest release_suffix: x86_64-windows + - target: aarch64-pc-windows-msvc + os: windows-latest + cross: true + release_suffix: aarch64-windows # macOS - target: aarch64-apple-darwin - os: macos-14 + os: macos-latest release_suffix: aarch64-osx - target: x86_64-apple-darwin - os: macos-12 + os: macos-latest + cross: true release_suffix: x86_64-osx env: PYAPP_PASS_LOCATION: "1" PYAPP_UV_ENABLED: "1" - PYAPP_DISTRIBUTION_VARIANT_CPU: "v1" HATCH_BUILD_LOCATION: dist CARGO: cargo CARGO_BUILD_TARGET: ${{ matrix.job.target }} From 67eb40ca9d48328fe6eb122e3540ca28e86ee14b Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:20:16 +0100 Subject: [PATCH 06/13] Add badges to README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 8bc2484..822c585 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ # iSponsorBlockTV +[![ghcr.io Pulls](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fipitio.github.io%2Fbackage%2Fdmunozv04%2FiSponsorBlockTV%2Fisponsorblocktv.json&query=downloads&logo=github&label=ghcr.io%20pulls&style=flat)](https://ghcr.io/dmunozv04/isponsorblocktv) +[![Docker Pulls](https://img.shields.io/docker/pulls/dmunozv04/isponsorblocktv?logo=docker&style=flat)](https://hub.docker.com/r/dmunozv04/isponsorblocktv/) +[![GitHub Release](https://img.shields.io/github/v/release/dmunozv04/isponsorblocktv?logo=GitHub&style=flat)](https://github.com/dmunozv04/iSponsorBlockTV/releases/latest) +[![GitHub Repo stars](https://img.shields.io/github/stars/dmunozv04/isponsorblocktv?style=flat)](https://github.com/dmunozv04/isponsorblocktv) + Skip sponsor segments in YouTube videos playing on a YouTube TV device (see below for compatibility details). This project is written in asynchronous python and should be pretty quick. From f3d3bdd43252cdf827a1a5966b833bf91e519805 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:20:39 +0000 Subject: [PATCH 07/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/iSponsorBlockTV/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/iSponsorBlockTV/main.py b/src/iSponsorBlockTV/main.py index 09a8a66..a199f98 100644 --- a/src/iSponsorBlockTV/main.py +++ b/src/iSponsorBlockTV/main.py @@ -145,9 +145,11 @@ async def finish(devices, web_session, tcp_connector): await web_session.close() await tcp_connector.close() + def handle_signal(signum, frame): raise KeyboardInterrupt() + def main(config, debug): loop = asyncio.get_event_loop_policy().get_event_loop() tasks = [] # Save the tasks so the interpreter doesn't garbage collect them From 73192a11716740a2a9ab108e8a5eacd208246234 Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:31:16 +0100 Subject: [PATCH 08/13] add v1 variant for linux amd64 builds --- .github/workflows/release.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 017bc62..e634857 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,6 +70,11 @@ jobs: os: ubuntu-latest cross: true release_suffix: x86_64-linux + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + cross: true + cpu_variant: v1 + release_suffix: x86_64-linux-v1 - target: aarch64-unknown-linux-gnu os: ubuntu-latest cross: true @@ -78,10 +83,6 @@ jobs: - target: x86_64-pc-windows-msvc os: windows-latest release_suffix: x86_64-windows - - target: aarch64-pc-windows-msvc - os: windows-latest - cross: true - release_suffix: aarch64-windows # macOS - target: aarch64-apple-darwin os: macos-latest @@ -97,6 +98,7 @@ jobs: HATCH_BUILD_LOCATION: dist CARGO: cargo CARGO_BUILD_TARGET: ${{ matrix.job.target }} + PYAPP_DISTRIBUTION_VARIANT_CPU: ${{ matrix.job.cpu_variant }} PYAPP_REPO: pyapp # Use local copy of pyapp (needed for cross-compiling) PYAPP_VERSION: v0.24.0 From b3dd27748b8353f1cfae6993e177a4ee2b39571f Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:35:01 +0100 Subject: [PATCH 09/13] better actions name --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e634857..826f333 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,7 +57,7 @@ jobs: build-binaries: - name: Build binaries for ${{ matrix.job.target }} (${{ matrix.job.os }}) + name: Build binaries for ${{ matrix.job.release_suffix }} (${{ matrix.job.os }}) needs: - build-sdist-and-wheel runs-on: ${{ matrix.job.os }} From afaced8f847f0975d2dc18ee0fa459912ff46cc4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:47:30 +0000 Subject: [PATCH 10/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 826f333..53db252 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,7 +57,7 @@ jobs: build-binaries: - name: Build binaries for ${{ matrix.job.release_suffix }} (${{ matrix.job.os }}) + name: Build binaries for ${{ matrix.job.release_suffix }} (${{ matrix.job.os }}) needs: - build-sdist-and-wheel runs-on: ${{ matrix.job.os }} From 8fdd13da0408a159236fa7e9729304a46bd6bf94 Mon Sep 17 00:00:00 2001 From: David <39565245+dmunozv04@users.noreply.github.com> Date: Mon, 6 Jan 2025 19:04:36 +0100 Subject: [PATCH 11/13] Update .pre-commit-config.yaml Replace isort, black and pycln with ruff --- .pre-commit-config.yaml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4141333..32a44b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,22 +18,14 @@ repos: - id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline - id: mixed-line-ending # replaces or checks mixed line ending - id: trailing-whitespace # checks for trailing whitespace - - repo: https://github.com/pycqa/isort - rev: 5.13.2 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.6 + hooks: + - id: ruff + args: [ --fix, --exit-non-zero-on-fix ] + - id: ruff-format + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.43.0 hooks: - - id: isort - name: isort (python) - language_version: '3.11' - args: ["--profile", "black", "--filter-files"] - - repo: https://github.com/psf/black - rev: 24.10.0 - hooks: - - id: black - language_version: '3.11' - args: ["--preview"] - - repo: https://github.com/hadialqattan/pycln # removes unused imports - rev: v2.4.0 - hooks: - - id: pycln - language_version: "3.11" - args: [--all] + - id: markdownlint + args: ["--fix"] From 0145b3ba8d31f11eb1509e201d8e481637ce519a Mon Sep 17 00:00:00 2001 From: David <39565245+dmunozv04@users.noreply.github.com> Date: Mon, 6 Jan 2025 19:06:26 +0100 Subject: [PATCH 12/13] fix indent --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32a44b4..1cc1c61 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,11 +19,11 @@ repos: - id: mixed-line-ending # replaces or checks mixed line ending - id: trailing-whitespace # checks for trailing whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 - hooks: - - id: ruff - args: [ --fix, --exit-non-zero-on-fix ] - - id: ruff-format + rev: v0.8.6 + hooks: + - id: ruff + args: [ --fix, --exit-non-zero-on-fix ] + - id: ruff-format - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.43.0 hooks: From 35d13373f9efb42812a01dcddd2b0221c932a387 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:06:32 +0000 Subject: [PATCH 13/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/ISSUE_TEMPLATE/bug_report.md | 10 ++++++---- LICENSE.md | 2 +- README.md | 10 ++++++++++ src/iSponsorBlockTV/main.py | 2 +- src/iSponsorBlockTV/setup_wizard.py | 12 ++++++------ 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 449e953..0c27e71 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -13,6 +13,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -25,13 +26,14 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **iSponsorBlockTV server (please complete the following information):** - - OS: [e.g. Docker on linux Arm64, windows] - - Python version [e.g. 3.7] (no need to fill if running on docker + +- OS: [e.g. Docker on linux Arm64, windows] +- Python version [e.g. 3.7] (no need to fill if running on docker **Apple TV (please complete the following information):** - - Device: [e.g. Apple TV 4] - - OS: [e.g. tvOS 15.4] +- Device: [e.g. Apple TV 4] +- OS: [e.g. tvOS 15.4] **Additional context** Add any other context about the problem here. diff --git a/LICENSE.md b/LICENSE.md index f288702..78651f6 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -657,7 +657,7 @@ notice like this when it starts in an interactive mode: This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. -The hypothetical commands `show w' and `show c' should show the appropriate +The hypothetical commands `show w' and`show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". diff --git a/README.md b/README.md index 822c585..523f4ad 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # iSponsorBlockTV + [![ghcr.io Pulls](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fipitio.github.io%2Fbackage%2Fdmunozv04%2FiSponsorBlockTV%2Fisponsorblocktv.json&query=downloads&logo=github&label=ghcr.io%20pulls&style=flat)](https://ghcr.io/dmunozv04/isponsorblocktv) [![Docker Pulls](https://img.shields.io/docker/pulls/dmunozv04/isponsorblocktv?logo=docker&style=flat)](https://hub.docker.com/r/dmunozv04/isponsorblocktv/) [![GitHub Release](https://img.shields.io/github/v/release/dmunozv04/isponsorblocktv?logo=GitHub&style=flat)](https://github.com/dmunozv04/iSponsorBlockTV/releases/latest) @@ -9,11 +10,13 @@ Skip sponsor segments in YouTube videos playing on a YouTube TV device (see belo This project is written in asynchronous python and should be pretty quick. ## Installation + Check the [wiki](https://github.com/dmunozv04/iSponsorBlockTV/wiki/Installation) Warning: docker armv7 builds have been deprecated. Amd64 and arm64 builds are still available. ## Compatibility + Legend: ✅ = Working, ❌ = Not working, ❔ = Not tested Open an issue/pull request if you have tested a device that isn't listed here. @@ -34,6 +37,7 @@ Open an issue/pull request if you have tested a device that isn't listed here. | Playstation 4/5 | ✅ | ## 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. The device can also be manually added to iSponsorBlockTV with a YouTube TV code. This code can be found in the settings page of your YouTube application. @@ -42,6 +46,7 @@ It connects to the device, watches its activity and skips any sponsor segment us It can also skip/mute YouTube ads. ## 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) @@ -49,9 +54,11 @@ It can also skip/mute YouTube ads. - [ssdp](https://github.com/codingjoe/ssdp) Used for auto discovery ## Projects using this project + - [Home Assistant Addon](https://github.com/bertybuttface/addons/tree/main/isponsorblocktv) ## Contributing + 1. Fork it () 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) @@ -59,8 +66,11 @@ It can also skip/mute YouTube ads. 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 + [![GNU GPLv3](https://www.gnu.org/graphics/gplv3-127x51.png)](https://www.gnu.org/licenses/gpl-3.0.en.html) diff --git a/src/iSponsorBlockTV/main.py b/src/iSponsorBlockTV/main.py index a199f98..59aa5f6 100644 --- a/src/iSponsorBlockTV/main.py +++ b/src/iSponsorBlockTV/main.py @@ -27,7 +27,7 @@ class DeviceListener: logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") ) self.logger.addHandler(sh) - self.logger.info(f"Starting device") + self.logger.info("Starting device") self.lounge_controller = ytlounge.YtLoungeApi( device.screen_id, config, api_helper, self.logger, self.web_session ) diff --git a/src/iSponsorBlockTV/setup_wizard.py b/src/iSponsorBlockTV/setup_wizard.py index 669c581..fa308f5 100644 --- a/src/iSponsorBlockTV/setup_wizard.py +++ b/src/iSponsorBlockTV/setup_wizard.py @@ -328,9 +328,9 @@ class AddDevice(ModalWithClickExit): @on(Input.Changed, "#pairing-code-input") def changed_pairing_code(self, event: Input.Changed): - self.query_one("#add-device-pin-add-button").disabled = ( - not event.validation_result.is_valid - ) + self.query_one( + "#add-device-pin-add-button" + ).disabled = not event.validation_result.is_valid @on(Input.Submitted, "#pairing-code-input") @on(Button.Pressed, "#add-device-pin-add-button") @@ -377,9 +377,9 @@ class AddDevice(ModalWithClickExit): @on(SelectionList.SelectedChanged, "#dial-devices-list") def changed_device_list(self, event: SelectionList.SelectedChanged): - self.query_one("#add-device-dial-add-button").disabled = ( - not event.selection_list.selected - ) + self.query_one( + "#add-device-dial-add-button" + ).disabled = not event.selection_list.selected class AddChannel(ModalWithClickExit):