pannal / plex-for-kodi

Unoffical Plex for Kodi add-on releases.
GNU General Public License v2.0
237 stars 30 forks source link

Kodi replays media when using external player (MPC-HC) #122

Open rajopotamus opened 1 week ago

rajopotamus commented 1 week ago

Description: After exiting a movie/show using external player (MPC-HC) with Kodi, Kodi instructs the content to replay instead of exiting back to the Kodi main screen. This does not happen when playing content natively with Kodi, or using other add-ons such as plexkodiconnect; it only occurs when using PM4k. Everyone once in a while it will exit correctly, but over 75% of the time Kodi will call MPC-HC to replay the file.

I have resorted to using plexkodiconnect but would much rather use PM4k for plex.

Details:

pannal commented 1 week ago

Please post logs with PM4K in DEBUG logging.

rajopotamus commented 1 week ago

kodi.log

I downgraded to Kodi 20.4 and the behavior is the same. I have to stick to Kodi 20.4 nexus bc I have to use plexconnectkodi in order to use my flex for now until we can figure out what's happening with PM4k because PCK only supports nexus. The behavior in Kodi 21 is the exact same as what im experiencing with 20.4 so it should still be relevant.

pannal commented 1 week ago

I'll try and debug this soon. Thanks for the log!

rajopotamus commented 1 week ago

you're welcome! I just realized that I might have sent a log with Kodi in debug but not PM4k. I can send another one with both in debug mode shortly

pannal commented 1 week ago

All good, the log in fact included PM4K's debug logging. No need for a new one.

PM4K even detects the onPlaybackEnded/Stopped events, but somehow reacts wrongly. I'll have to dig deep to fix this, but I think it should be possible.

rajopotamus commented 1 week ago

kodi.log

ok im glad the first one had the info. Here is another log with pm4ks debug log on. Also, this log shows that I played dune 2, and it exited correctly, then I played dungeons and dragons, and it exited correctly, but then I played the tv show x men 97 and it kept replaying. Not sure if its any more or less helpful but this does show the inherently variability.

pannal commented 1 week ago

Does that only happen to TV shows?

rajopotamus commented 1 week ago

No it routinely occurs with movies too. It just happened to do it only on a tv show that time.

There are other times when it’ll be fine on a tv show and not on movies. Or more routinely not fine on either. I havnt been able to get a pattern down right.

This didn’t always happen so I’m wondering if maybe an older version of pm4k might not have this behavior?

pannal commented 1 week ago

Sounds like a timing issue. You can try and pinpoint when this started happening if you'd like, by going back versions.

rajopotamus commented 1 week ago

Just as a guess I think it was like 6-10 months ago.  I know I was on kodi nexus when it was working fine but I think it was 20.2; so in an around that timeframe.  Sent from my iPhoneOn Jun 30, 2024, at 9:22 PM, pannal @.***> wrote: Sounds like a timing issue. You can try and pinpoint when this started happening if you'd like, na going back versions.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

pannal commented 1 week ago

That doesn't really help :D

No worries, though, I'll try and reproduce this. Got a good couple of other things to do before, so it'll take some time.

pannal commented 1 week ago

Hmm, does it make a difference whether you stop the playback manually vs letting it run til the end?

rajopotamus commented 6 days ago

I had these same exact thoughts but unfortunately I couldn’t find any consistency there either when recalling from memory; however I rarely let it play through since I have an external player and don’t want to watch credits etc. I will test this out today and see if letting it play through makes any difference. Sincerely,Raj Sent from my iPhoneOn Jul 1, 2024, at 10:09 AM, pannal @.***> wrote: Hmm, does it make a difference whether you stop the playback manually vs letting it run til the end?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

rajopotamus commented 6 days ago

Ok so I did some testing today.  Everything was working great for movies or tv; whether I let it play through or cut it short.  Then later nothing was working regardless of whether I cut it short or played through; only thing I could do was restart kodi to stop the loop.Sent from my iPhoneOn Jul 1, 2024, at 10:09 AM, pannal @.***> wrote: Hmm, does it make a difference whether you stop the playback manually vs letting it run til the end?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

pannal commented 2 days ago

Can you post your external player config so I can replicate this? Thanks!

rajopotamus commented 2 days ago

playercorefactory.txt

pannal commented 1 day ago

I don't have any issues with this: script.plexmod.zip

playercorefactory.xml:

<playercorefactory>
<players>
<player name="mpc-be" type="ExternalPlayer" audio="false" video="true">
<filename>C:\Program Files\MPC-BE x64\mpc-be64.exe</filename>
<args>"{1}" /fullscreen /close</args>
<hidexbmc>false</hidexbmc>
<hideconsole>false</hideconsole>
<warpcursor>none</warpcursor>
</player>
</players>
<rules action="prepend">
<rule video="true" player="mpc-be"/>
</rules>
</playercorefactory>

Edit: I'm using MPC-BE, but MPC-HE should be the same.

Edit 2: Reuploaded zip. This skips all next() handling when using an external player. This isn't ideal but should fix your issue.

Edit 3: Reuploaded zip

rajopotamus commented 22 hours ago

I see that you uploaded a script but i am unsure with what I am supposed to do with it. Can you let me know?

pannal commented 21 hours ago

You replace the one you have with the folder inside the zip. I'm guessing you've installed PM4K using my repository?

You'll need to find your kodi's addons folder (see here: https://kodi.wiki/view/Kodi_data_folder) , where there'll be a script.plexmod folder, which you can delete and replace with the one contained in the zip file.

pannal commented 18 hours ago

And no, using mpc-be won't change anything on its own. You need the fix from the PM4K beta I posted.

rajopotamus commented 18 hours ago

Ok great thanks for the info! Ironically enough all weekend it’s been working fine.  So strange; but I’ll definitely apply that script if it starts to act up again.  Thank you so much for your effort in helping me!Sent from my iPhoneOn Jul 7, 2024, at 5:15 PM, pannal @.***> wrote: And no, using mpc-be won't change anything on its own. You need the fix from the PM4K beta I posted.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

pannal commented 18 hours ago

Well, it's the addon itself. You're using version 0.7.8 right now, what I've posted is 0.7.9-beta11 with the special handling for external players built in.

Funnily I was able to reproduce your issue every time on my end.

pannal commented 18 hours ago

0.7.9 final is planned for release in about a week. If you're using my repository (dontpanic), it will automatically update to the final version, even if you install the beta.