codetheweb / muse

🎧 a self-hosted midwestern Discord music bot that doesn't suck
MIT License
799 stars 200 forks source link

Add SponsorBlock support #1013

Closed Charlignon closed 2 months ago

Charlignon commented 3 months ago

Functional description

Skip non-musical start and end segments when available. Closes #808

Changes

Add sponsorBlock api client dependency, and call the API when adding songs to the playlist. See review comments for details on implementation choices.

Comments

Hello ! Hope you don't mind this PR, and that it's up to your standards :) Here are a few opinionated choices I made and things I didn't include. Feel free to challenge them !

I tested my code locally ! No issue ocured during testing.

github-actions[bot] commented 3 months ago

:package: A new release has been made for this pull request.

To play around with this PR, pull codetheweb/muse:pr-1013 or codetheweb/muse:468cf0cf09175a665387030810ec7f99e8c4a620.

Images are available for x86_64 and ARM64.

Latest commit: 468cf0cf09175a665387030810ec7f99e8c4a620

codetheweb commented 3 months ago

would also be great to leverage Muse's cache class to cache the result sponsorblock calls if the API is typically slow/often down

Charlignon commented 3 months ago

Pushed all the code review changes, I'll do a separate commit for cache implementation !

codetheweb commented 3 months ago

sounds good

Charlignon commented 2 months ago

@codetheweb sorry life has been pretty busy, but I'm done :) Tested and got the following debug log, as expected muse Cache hit: F2AitTPI5U0 +2ms

Charlignon commented 2 months ago

Hum, that's strange ! I tried it again and it seems to be working properly, the play time displayed by Muse matches the video without the segments image It may be the configuration, have you added ENABLE_SPONSORBLOCK=true in your .env ?

codetheweb commented 2 months ago

oh my bad, forgot it slices the video instead of skipping over segments 😅

github-actions[bot] commented 2 months ago

🚀 Released in Release v2.8.0.