mirror of
https://github.com/dmunozv04/iSponsorBlockTV.git
synced 2025-12-07 20:36:44 +03:00
Merge pull request #237 from dmunozv04/improve-exceptions
Improve exceptions
This commit is contained in:
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -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**
|
**Describe the bug**
|
||||||
A clear and concise description of what the bug is.
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
|||||||
6
.github/ISSUE_TEMPLATE/feature_request.md
vendored
6
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -8,13 +8,15 @@ assignees: ''
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
**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**
|
**Describe the solution you'd like**
|
||||||
A clear and concise description of what you want to happen.
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
**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**
|
**Additional context**
|
||||||
Add any other context or screenshots about the feature request here.
|
Add any other context or screenshots about the feature request here.
|
||||||
|
|||||||
5
.github/workflows/build_docker_images.yml
vendored
5
.github/workflows/build_docker_images.yml
vendored
@@ -75,6 +75,5 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=registry,ref=ghcr.io/dmunozv04/isponsorblocktv:buildcache
|
cache-from: type=gha
|
||||||
# Only cache if it's not a pull request
|
cache-to: type=gha,mode=max
|
||||||
cache-to: ${{ github.event_name != 'pull_request' && 'type=registry,ref=ghcr.io/dmunozv04/isponsorblocktv:buildcache,mode=max' || '' }}
|
|
||||||
|
|||||||
1
.markdownlintignore
Normal file
1
.markdownlintignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
LICENSE.md
|
||||||
26
README.md
26
README.md
@@ -5,7 +5,8 @@
|
|||||||
[](https://github.com/dmunozv04/iSponsorBlockTV/releases/latest)
|
[](https://github.com/dmunozv04/iSponsorBlockTV/releases/latest)
|
||||||
[](https://github.com/dmunozv04/isponsorblocktv)
|
[](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.
|
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)
|
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
|
## Compatibility
|
||||||
|
|
||||||
Legend: ✅ = Working, ❌ = Not working, ❔ = Not tested
|
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
|
## Usage
|
||||||
|
|
||||||
Run iSponsorBlockTV on a computer that has network access.
|
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.
|
Auto discovery will require the computer to be on the same network as the device
|
||||||
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.
|
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.
|
It can also skip/mute YouTube ads.
|
||||||
|
|
||||||
## Libraries used
|
## 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)
|
- asyncio and [aiohttp](https://github.com/aio-libs/aiohttp)
|
||||||
- [async-cache](https://github.com/iamsinghrajat/async-cache)
|
- [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
|
- [ssdp](https://github.com/codingjoe/ssdp) Used for auto discovery
|
||||||
|
|
||||||
## Projects using this project
|
## Projects using this project
|
||||||
@@ -68,8 +72,10 @@ It can also skip/mute YouTube ads.
|
|||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
- [dmunozv04](https://github.com/dmunozv04) - creator and maintainer
|
- [dmunozv04](https://github.com/dmunozv04) - creator and maintainer
|
||||||
- [HaltCatchFire](https://github.com/HaltCatchFire) - updated dependencies and improved skip logic
|
- [HaltCatchFire](https://github.com/HaltCatchFire) - updated dependencies and
|
||||||
- [Oxixes](https://github.com/oxixes) - added support for channel whitelist and minor improvements
|
improved skip logic
|
||||||
|
- [Oxixes](https://github.com/oxixes) - added support for channel whitelist and
|
||||||
|
minor improvements
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,14 @@ class DeviceListener:
|
|||||||
await asyncio.sleep(60 * 60 * 24) # Refresh every 24 hours
|
await asyncio.sleep(60 * 60 * 24) # Refresh every 24 hours
|
||||||
try:
|
try:
|
||||||
await self.lounge_controller.refresh_auth()
|
await self.lounge_controller.refresh_auth()
|
||||||
except:
|
except BaseException:
|
||||||
# traceback.print_exc()
|
# traceback.print_exc()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def is_available(self):
|
async def is_available(self):
|
||||||
try:
|
try:
|
||||||
return await self.lounge_controller.is_available()
|
return await self.lounge_controller.is_available()
|
||||||
except:
|
except BaseException:
|
||||||
# traceback.print_exc()
|
# traceback.print_exc()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -57,20 +57,20 @@ class DeviceListener:
|
|||||||
try:
|
try:
|
||||||
self.logger.debug("Refreshing auth")
|
self.logger.debug("Refreshing auth")
|
||||||
await lounge_controller.refresh_auth()
|
await lounge_controller.refresh_auth()
|
||||||
except:
|
except BaseException:
|
||||||
await asyncio.sleep(10)
|
await asyncio.sleep(10)
|
||||||
while not (await self.is_available()) and not self.cancelled:
|
while not (await self.is_available()) and not self.cancelled:
|
||||||
await asyncio.sleep(10)
|
await asyncio.sleep(10)
|
||||||
try:
|
try:
|
||||||
await lounge_controller.connect()
|
await lounge_controller.connect()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
while not lounge_controller.connected() and not self.cancelled:
|
while not lounge_controller.connected() and not self.cancelled:
|
||||||
# Doesn't connect to the device if it's a kids profile (it's broken)
|
# Doesn't connect to the device if it's a kids profile (it's broken)
|
||||||
await asyncio.sleep(10)
|
await asyncio.sleep(10)
|
||||||
try:
|
try:
|
||||||
await lounge_controller.connect()
|
await lounge_controller.connect()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"Connected to device %s (%s)", lounge_controller.screen_name, self.name
|
"Connected to device %s (%s)", lounge_controller.screen_name, self.name
|
||||||
@@ -79,14 +79,14 @@ class DeviceListener:
|
|||||||
self.logger.info("Subscribing to lounge")
|
self.logger.info("Subscribing to lounge")
|
||||||
sub = await lounge_controller.subscribe_monitored(self)
|
sub = await lounge_controller.subscribe_monitored(self)
|
||||||
await sub
|
await sub
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Method called on playback state change
|
# Method called on playback state change
|
||||||
async def __call__(self, state):
|
async def __call__(self, state):
|
||||||
try:
|
try:
|
||||||
self.task.cancel()
|
self.task.cancel()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
time_start = time.time()
|
time_start = time.time()
|
||||||
self.task = asyncio.create_task(self.process_playstatus(state, time_start))
|
self.task = asyncio.create_task(self.process_playstatus(state, time_start))
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ class AddDevice(ModalWithClickExit):
|
|||||||
paired = False
|
paired = False
|
||||||
try:
|
try:
|
||||||
paired = await lounge_controller.pair(pairing_code)
|
paired = await lounge_controller.pair(pairing_code)
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
if paired:
|
if paired:
|
||||||
device = {
|
device = {
|
||||||
@@ -476,7 +476,6 @@ class AddChannel(ModalWithClickExit):
|
|||||||
|
|
||||||
@on(Button.Pressed, "#add-channel-switch-buttons > *")
|
@on(Button.Pressed, "#add-channel-switch-buttons > *")
|
||||||
def handle_switch_buttons(self, event: Button.Pressed) -> None:
|
def handle_switch_buttons(self, event: Button.Pressed) -> None:
|
||||||
button_ = event.button.id
|
|
||||||
self.query_one("#add-channel-switcher").current = event.button.id.replace(
|
self.query_one("#add-channel-switcher").current = event.button.id.replace(
|
||||||
"-button", "-container"
|
"-button", "-container"
|
||||||
)
|
)
|
||||||
@@ -496,7 +495,7 @@ class AddChannel(ModalWithClickExit):
|
|||||||
self.query_one("#channel-search-results").remove_children()
|
self.query_one("#channel-search-results").remove_children()
|
||||||
try:
|
try:
|
||||||
channels_list = await self.api_helper.search_channels(channel_name)
|
channels_list = await self.api_helper.search_channels(channel_name)
|
||||||
except:
|
except BaseException:
|
||||||
self.query_one("#add-channel-info").update(
|
self.query_one("#add-channel-info").update(
|
||||||
"[#ff0000]Failed to search for channel"
|
"[#ff0000]Failed to search for channel"
|
||||||
)
|
)
|
||||||
@@ -943,7 +942,7 @@ class ISponsorBlockTVSetupMainScreen(Screen):
|
|||||||
self.app.query_one("#warning-no-key").display = (
|
self.app.query_one("#warning-no-key").display = (
|
||||||
not event.input.value
|
not event.input.value
|
||||||
) and self.config.channel_whitelist
|
) and self.config.channel_whitelist
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
|
|||||||
) # YouTube sends at least a message every 30 seconds (no-op or any other)
|
) # YouTube sends at least a message every 30 seconds (no-op or any other)
|
||||||
try:
|
try:
|
||||||
self.subscribe_task.cancel()
|
self.subscribe_task.cancel()
|
||||||
except Exception:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Subscribe to the lounge and start the watchdog
|
# Subscribe to the lounge and start the watchdog
|
||||||
@@ -52,7 +52,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
|
|||||||
self.callback = callback
|
self.callback = callback
|
||||||
try:
|
try:
|
||||||
self.subscribe_task_watchdog.cancel()
|
self.subscribe_task_watchdog.cancel()
|
||||||
except:
|
except BaseException:
|
||||||
pass # No watchdog task
|
pass # No watchdog task
|
||||||
self.subscribe_task = asyncio.create_task(super().subscribe(callback))
|
self.subscribe_task = asyncio.create_task(super().subscribe(callback))
|
||||||
self.subscribe_task_watchdog = asyncio.create_task(self._watchdog())
|
self.subscribe_task_watchdog = asyncio.create_task(self._watchdog())
|
||||||
@@ -64,7 +64,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
|
|||||||
# (Re)start the watchdog
|
# (Re)start the watchdog
|
||||||
try:
|
try:
|
||||||
self.subscribe_task_watchdog.cancel()
|
self.subscribe_task_watchdog.cancel()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
self.subscribe_task_watchdog = asyncio.create_task(self._watchdog())
|
self.subscribe_task_watchdog = asyncio.create_task(self._watchdog())
|
||||||
|
|||||||
Reference in New Issue
Block a user