findroid icon indicating copy to clipboard operation
findroid copied to clipboard

feat: Skip credits

Open Cd16d opened this issue 1 year ago • 10 comments

Support for jumoog's Intro Skipper:

  • FindroidSegment
  • Skip Intros
  • Skip Credits

~Keep using the old API for intros, and still support ConfusedPolarBear's Intro Skipper.~

fix #620

Cd16d avatar Jan 22 '24 13:01 Cd16d

Does this could support https://github.com/endrl/jellyfin-plugin-media-analyzer ?

Gauvino avatar Feb 03 '24 16:02 Gauvino

Does this could support https://github.com/endrl/jellyfin-plugin-media-analyzer?

This PR only allows skipping credits from Jumoog's Intro Skipper v0.1.8.0, a new release of ConfusedPolarBear's Intro Skipper. The plugin "endrl/jellyfin-plugin-media-analyzer" needs the segments API, but it is not currently supported by Jellyfin version 10.8.xx. Therefore, we will have to wait at least for Jellyfin 10.9.0.

For more information, please refer to:

  • #590

Cd16d avatar Feb 03 '24 18:02 Cd16d

I only forked the plugin for myself because ConfusedPolarBear quit. I also left everything as it is so that you only have to change the repo url and everything continues to work.

jumoog avatar Mar 01 '24 12:03 jumoog

https://github.com/jarnedemeulemeester/findroid/blob/main/player/video/src/main/java/dev/jdtech/jellyfin/viewmodels/PlayerActivityViewModel.kt#L253

Seems silly to submit an entire PR for this, but you want the line above to check the hideSkipPromptAt value - 1. Thought it might be better to suggest throwing it in with yours.

AbandonedCart avatar Mar 02 '24 22:03 AbandonedCart

Seems silly to submit an entire PR for this, but you want the line above to check the hideSkipPromptAt value - 1. Thought it might be better to suggest throwing it in with yours.

Ok, I've added the - 1, but sometimes the button is still visible for some time due to this:

https://github.com/jarnedemeulemeester/findroid/blob/0a1582f47b33147c6c797c76f674bdedad4a4909/player/video/src/main/java/dev/jdtech/jellyfin/viewmodels/PlayerActivityViewModel.kt#L260

Cd16d avatar Mar 03 '24 23:03 Cd16d

Subtracting the 1 should force it to trigger the end a second early, which should offset performing the check each second well enough for most cases. There's still the possibility for a region of error less than a second long, but the only fix would be to shorten that check and start eating away at the memory.

AbandonedCart avatar Mar 04 '24 00:03 AbandonedCart

That's a good alternative.

AbandonedCart avatar Mar 05 '24 15:03 AbandonedCart

sometimes the button is still visible

Fixed, if you want to test it let me know if it works.

Cd16d avatar Mar 05 '24 15:03 Cd16d

Okay so I took a quick look at this.

The next version of Findroid will target Jellyfin 10.9 so only jumoog's version will work. Knowing that I would completely migrate to the IntroSkipperSegments API call for both intros and credits. Doing that we would also be able to reuse more code for both intros and credits. Maybe with some generic SkippableSegment class with an enum property called type of type SkippableSegmentType which can be Intro or Credit. By doing that we can also store those in a single database table for offline access.

I have not taken a detailed look at the code or the API from jumoog's version but I think reworking the intro skip to something more generic like segment skipping would be ideal.

Also, I have not tested this yet, but I would like to include credit skipping in the next release. But no need to rush this since I have quite some more work to do before the next release :smile:

jarnedemeulemeester avatar Jun 02 '24 16:06 jarnedemeulemeester

Maybe with some generic SkippableSegment class with an enum property called type of type SkippableSegmentType which can be Intro or Credit.

I changed it from Intro and Credit to a generic FindroidSegment:

FindroidSegment(
            type = String,
            skip = Boolean,
            startTime = Double,
            endTime = Double,
            showAt = Double,
            hideAt =Double,
        )

Where type can be: "intro", "credit", "chapter", or everything else. The problem is getting it from the Intro Skipper API, so currently the code isn't optimized. Please let me know if you have any ideas on how to improve it.

Cd16d avatar Jun 20 '24 22:06 Cd16d

I started looking at this, but have yet to review all of the changes. I've changed it to load the segments at the beginning of each episode instead of all at once.

Other than that I have a question about the FindroidSegment. Why does it have a property skip? It seems like it is always set to true?

jarnedemeulemeester avatar Jul 17 '24 20:07 jarnedemeulemeester

The skip property can be removed. I thought of using it in case some segments should not be skipped, but it can also be done using the segment type

Cd16d avatar Jul 18 '24 07:07 Cd16d

Made some more changes:

  • Restyled the buttons to the original outlined style with semi transparent background
  • Changed the Continue watching button to a X icon button
  • Also display the X button for intros
  • Keep the buttons visible when the player controls are visible (I see no reason to hide them)

jarnedemeulemeester avatar Jul 20 '24 12:07 jarnedemeulemeester

More changes:

  • Introduce enum FindroidSegmentType to specify the type instead of using a string
  • Use a map to retrieve the segments from the API and simplify the conversion to FindroidSegments
  • Save each segment in a row and it's properties in columns instead of using a single json

jarnedemeulemeester avatar Jul 20 '24 16:07 jarnedemeulemeester

Made some final changes. If everything looks good to you I think we can merge this 🙂

jarnedemeulemeester avatar Jul 20 '24 17:07 jarnedemeulemeester

Made some more changes:

  • Keep the buttons visible when the player controls are visible (I see no reason to hide them)

For these, I copied the implementation of the main streaming apps which have different behaviour for intro and credits:

  • Intro button is visible for n seconds, after that it is visible only if the player controls are visible
  • Credits button is always visible unless the player controls are visible, so you don't have more buttons for the same function Skip credits and Next, but using this logic means overwriting IntroSkipper logic (maybe we can use the same logic as Intro or add a preference switch)

Everything else looks fine 🙂👍

Cd16d avatar Jul 20 '24 17:07 Cd16d

Let's follow your Intro logic. The button will be visible for n seconds, after that it's only visible when the player controls are shown. Let's do this for both the Intro and Credits.

I will be implementing that change now.

Btw I made an other pretty big change. I changed the Skip credits button to actually only skip the credits and not move on to the next episode. This is because sometimes there are extra scenes after the credits which a viewer would want to watch. I got this idea from Crunchyroll (I don't have access to other streaming services), and it makes sense in my opinion. Skip intro skips the intro and Skip credits skips the credits. It also makes the code a little less complex :slightly_smiling_face:

jarnedemeulemeester avatar Jul 21 '24 15:07 jarnedemeulemeester