From 6f4c27c0a593682754233e6199443d87d96410a0 Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:43:39 +0100 Subject: [PATCH 1/5] Improve exceptions --- src/iSponsorBlockTV/main.py | 14 +++++++------- src/iSponsorBlockTV/setup_wizard.py | 6 +++--- src/iSponsorBlockTV/ytlounge.py | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/iSponsorBlockTV/main.py b/src/iSponsorBlockTV/main.py index d8187fe..61c7ac1 100644 --- a/src/iSponsorBlockTV/main.py +++ b/src/iSponsorBlockTV/main.py @@ -38,14 +38,14 @@ class DeviceListener: await asyncio.sleep(60 * 60 * 24) # Refresh every 24 hours try: await self.lounge_controller.refresh_auth() - except: + except BaseException: # traceback.print_exc() pass async def is_available(self): try: return await self.lounge_controller.is_available() - except: + except BaseException: # traceback.print_exc() return False @@ -57,20 +57,20 @@ class DeviceListener: try: self.logger.debug("Refreshing auth") await lounge_controller.refresh_auth() - except: + except BaseException: await asyncio.sleep(10) while not (await self.is_available()) and not self.cancelled: await asyncio.sleep(10) try: await lounge_controller.connect() - except: + except BaseException: pass while not lounge_controller.connected() and not self.cancelled: # Doesn't connect to the device if it's a kids profile (it's broken) await asyncio.sleep(10) try: await lounge_controller.connect() - except: + except BaseException: pass self.logger.info( "Connected to device %s (%s)", lounge_controller.screen_name, self.name @@ -79,14 +79,14 @@ class DeviceListener: self.logger.info("Subscribing to lounge") sub = await lounge_controller.subscribe_monitored(self) await sub - except: + except BaseException: pass # Method called on playback state change async def __call__(self, state): try: self.task.cancel() - except: + except BaseException: pass time_start = time.time() self.task = asyncio.create_task(self.process_playstatus(state, time_start)) diff --git a/src/iSponsorBlockTV/setup_wizard.py b/src/iSponsorBlockTV/setup_wizard.py index 995ce19..5eb9723 100644 --- a/src/iSponsorBlockTV/setup_wizard.py +++ b/src/iSponsorBlockTV/setup_wizard.py @@ -347,7 +347,7 @@ class AddDevice(ModalWithClickExit): paired = False try: paired = await lounge_controller.pair(pairing_code) - except: + except BaseException: pass if paired: device = { @@ -496,7 +496,7 @@ class AddChannel(ModalWithClickExit): self.query_one("#channel-search-results").remove_children() try: channels_list = await self.api_helper.search_channels(channel_name) - except: + except BaseException: self.query_one("#add-channel-info").update( "[#ff0000]Failed to search for channel" ) @@ -943,7 +943,7 @@ class ISponsorBlockTVSetupMainScreen(Screen): self.app.query_one("#warning-no-key").display = ( not event.input.value ) and self.config.channel_whitelist - except: + except BaseException: pass diff --git a/src/iSponsorBlockTV/ytlounge.py b/src/iSponsorBlockTV/ytlounge.py index 5f32eef..cd7df65 100644 --- a/src/iSponsorBlockTV/ytlounge.py +++ b/src/iSponsorBlockTV/ytlounge.py @@ -44,7 +44,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi): ) # YouTube sends at least a message every 30 seconds (no-op or any other) try: self.subscribe_task.cancel() - except Exception: + except BaseException: pass # Subscribe to the lounge and start the watchdog @@ -52,7 +52,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi): self.callback = callback try: self.subscribe_task_watchdog.cancel() - except: + except BaseException: pass # No watchdog task self.subscribe_task = asyncio.create_task(super().subscribe(callback)) self.subscribe_task_watchdog = asyncio.create_task(self._watchdog()) @@ -64,7 +64,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi): # (Re)start the watchdog try: self.subscribe_task_watchdog.cancel() - except: + except BaseException: pass finally: self.subscribe_task_watchdog = asyncio.create_task(self._watchdog()) From 147004e25734f50358f118200b77f238f5ba0375 Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:44:37 +0100 Subject: [PATCH 2/5] Remove unused variable --- src/iSponsorBlockTV/setup_wizard.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/iSponsorBlockTV/setup_wizard.py b/src/iSponsorBlockTV/setup_wizard.py index 5eb9723..5734ad9 100644 --- a/src/iSponsorBlockTV/setup_wizard.py +++ b/src/iSponsorBlockTV/setup_wizard.py @@ -476,7 +476,6 @@ class AddChannel(ModalWithClickExit): @on(Button.Pressed, "#add-channel-switch-buttons > *") def handle_switch_buttons(self, event: Button.Pressed) -> None: - button_ = event.button.id self.query_one("#add-channel-switcher").current = event.button.id.replace( "-button", "-container" ) From b96014840ab518467d2084533450db7ce6fe7cf6 Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:47:26 +0100 Subject: [PATCH 3/5] ignore license on markdownlint --- .markdownlintignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .markdownlintignore diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 0000000..f0c4298 --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1 @@ +LICENSE.md \ No newline at end of file From adc7e1efe916c24660e61a60ffe7623aee6d20e7 Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:52:21 +0100 Subject: [PATCH 4/5] Pass markdownlint --- .github/ISSUE_TEMPLATE/bug_report.md | 3 ++- .github/ISSUE_TEMPLATE/feature_request.md | 6 ++++-- .markdownlintignore | 2 +- README.md | 26 ++++++++++++++--------- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 0c27e71..e3e4ab7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,8 @@ assignees: '' --- -Before opening an issue make sure that there are no duplicates and that you are on the latest version. +Before opening an issue make sure that there are no duplicates and that you are +on the latest version. **Describe the bug** A clear and concise description of what the bug is. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7..d5a8d55 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -8,13 +8,15 @@ assignees: '' --- **Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +A clear and concise description of what the problem is. Ex. I'm always +frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. +A clear and concise description of any alternative solutions or features you've +considered. **Additional context** Add any other context or screenshots about the feature request here. diff --git a/.markdownlintignore b/.markdownlintignore index f0c4298..0e4b780 100644 --- a/.markdownlintignore +++ b/.markdownlintignore @@ -1 +1 @@ -LICENSE.md \ No newline at end of file +LICENSE.md diff --git a/README.md b/README.md index 523f4ad..3e61a0d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ [![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). +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. @@ -13,8 +14,6 @@ This project is written in asynchronous python and should be pretty quick. 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 @@ -39,18 +38,23 @@ Open an issue/pull request if you have tested a device that isn't listed here. ## 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. +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. -It connects to the device, watches its activity and skips any sponsor segment using the [SponsorBlock](https://sponsor.ajay.app/) API. +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 -- [pyytlounge](https://github.com/FabioGNR/pyytlounge) Used to interact with the device +- [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 +- [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 project @@ -68,8 +72,10 @@ It can also skip/mute YouTube ads. ## 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 +- [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 From dca9186d8b8faaa3ecaba38f4cc38625e19641ed Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:56:31 +0100 Subject: [PATCH 5/5] migrate to github actions cache --- .github/workflows/build_docker_images.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_docker_images.yml b/.github/workflows/build_docker_images.yml index 2ee8afe..b55f5f9 100644 --- a/.github/workflows/build_docker_images.yml +++ b/.github/workflows/build_docker_images.yml @@ -75,6 +75,5 @@ jobs: 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 - # Only cache if it's not a pull request - cache-to: ${{ github.event_name != 'pull_request' && 'type=registry,ref=ghcr.io/dmunozv04/isponsorblocktv:buildcache,mode=max' || '' }} + cache-from: type=gha + cache-to: type=gha,mode=max