jellyfin / jellyfin-plugin-intros

Intros Plugin for Jellyfin
GNU General Public License v3.0
43 stars 9 forks source link

How to get intros are playing #33

Closed morris-frank closed 4 months ago

morris-frank commented 4 months ago

Hey @BrianCArnold, I know this is an annoying way to ask for help, but

I'm happy to pay for some help, and to support you developmen!

I forked the plugin to add some functionality to than maybe later re-commit my ideas into the main branch. On this fork no intros are played, even though when I check the LibraryManager, the videos where added correctly and when playing a video, a n>0 list is generated in GetIntros

Returning the IntroInfo list here:

https://github.com/morris-frank/jellyfin-plugin-historic-intros/blob/c6701524d161cf586429cc6763fcefc2c49bbac1/Jellyfin.Plugin.HistoricalIntros/IntroProvider.cs#L75

Adding to the LibraryManager here:

https://github.com/morris-frank/jellyfin-plugin-historic-intros/blob/c6701524d161cf586429cc6763fcefc2c49bbac1/Jellyfin.Plugin.HistoricalIntros/API/HistoricalIntrosController.cs#L108

Is there something specifc that has to be set so that the intros are actually played when returned from GetIntros?

When using the main branch it still works, so I'm thinking somethin has to be exactly a certain way…

BrianCArnold commented 4 months ago

I'll have to look at it, ping me in a day if I haven't gotten back to you, thanks!

BrianCArnold commented 4 months ago

It looks as though you've restructured a great deal of the code, and removed a lot of error checking, but I think I see the problem.

https://github.com/morris-frank/jellyfin-plugin-historic-intros/blob/c6701524d161cf586429cc6763fcefc2c49bbac1/Jellyfin.Plugin.HistoricalIntros/IntroProvider.cs#L79

You're setting the ID of the intro to the ID of the movie. Change this to ItemId = x.Id, I suspect it may work. If it works, feel free to close the issue.

Also, be aware that throwing an exception on line 50 is not recommended, rather you should return Enumerable.Empty<IntroInfo>(). Throwing an exception requires a lot of memory allocation and processor time compared to the single operation of simply returning an empty enumerable.

morris-frank commented 4 months ago

God damn it haha, a mere typo! Very sorry to have cumbered you with this.

Yes, the code is very minimal right now. Now that the playing works, I can make it nice and robust and more interesting!

And thanks for the tip with the Exception, I'm def new to C#!

You're super nice to help so fast!

BrianCArnold commented 4 months ago

No problem! This looks to be very much like something I'd like to integrate into the official plugin, I'll create a ticket to track the idea.