fnord12 / script.pseudotv

Channel surfing for your Kodi library
Other
23 stars 3 forks source link

Pause when not watching #10

Open gonzo90017 opened 4 years ago

gonzo90017 commented 4 years ago

kodi.old.log Windows 7 64bit Kodi 18.7 Pseudo TV 4.5.1

TMNT channel Advance Settings: Force Resume Mode Pause When not watching Play Shows in Order

Doesn't matter what channel i'm on. If I press X to close PseudoTV. Launch Pseudotv again and go to the TMNT channel it plays exactly where I left off. Let's say S1:E5

Doesn't matter what channel i'm on. If I press ESC then yes to exit PseudoTV. Launch Pseudotv again an go to the TMNT channel. The channel goes back S1:E1

I can reproduce this issue every time. So it seems like when exiting using ESC something is going on that it's not saving or closing properly. I uploaded my log. If it's too big you can delete it and i'll reproduce both the working exit and the non working exit so the file won't be so big.

fnord12 commented 4 years ago

The log is great, thanks.

A couple questions:

  1. Are you saying this is new behavior with 4.5.1? Because this sounds like the experience we've had with Paused channels since 17 (e..g https://github.com/Steveb1968/script.pseudotv/issues/5 ).

  2. Can you find your settings2.xml file in \userdata\addon_data\script.pseudotv. Look at all the values for this channel when you quit with X. And see if anything is different when you quit with ESC. Especially the _time value.

My experience has been that the time value is correctly written both times, and the reset problem isn't (directly?) related to how you quit. IOW it's not failing because it's incorrectly writing something on quit, it's failing because of whatever is causing the channel reset problem that's been plaguing us. Although the consistent difference between ESC and Quit is worth pulling at. I'll try to investigate that further. But unless you tell me that you're seeing new behavior and i need to revert something, no promises on the timing.

fnord12 commented 4 years ago

FYI, it's not the issue but i see you're in Realtime mode overall and you also have an Advanced rule to set the music video channel to Realtime. That's at best unnecessary as far as i know; the point of those rules at the channel level is to override the overall mode. Is there a reason you did that?

And it's also set to Reset Every Day, is that because you keep the overall reset setting to Never and this allows you to add more videos without having to do a reset?

Nothing here relates to your problem; it just helps me to understand how people use PSTV.

gonzo90017 commented 4 years ago

It's the same issue that's been around for a while.

Did some more testing and noticed something I didn't notice yesterday. The TMNT channel only resets to S1:E1 if I exit while watching that channel. If i'm on my Rock channel and exit using ESC there. When I return to PseudoTV the TMNT channel is where I left off the last time.

Here are my settings.xml findings:

After Exit Using X:

After Exit using ESC:

This is where it gets interesting. This is the settings.xml time value when I reopen Pseudotv after having Exited using ESC:

Settings.zip

gonzo90017 commented 4 years ago

FYI, it's not the issue but i see you're in Realtime mode overall and you also have an Advanced rule to set the music video channel to Realtime. That's at best unnecessary as far as i know; the point of those rules at the channel level is to override the overall mode. Is there a reason you did that?

And it's also set to Reset Every Day, is that because you keep the overall reset setting to Never and this allows you to add more videos without having to do a reset?

Nothing here relates to your problem; it just helps me to understand how people use PSTV.

I forgot I had set the Rock channel to Real time mode. I thought I encountered a bug but it wasn't anything. I was just putting 4.5.1 through its paces.

The reason I have the Rock channel reset every day is because i only have around 19 hours worth of content. And since I have Pseudotv to reset channels to Never. With this setting PseudoTV resets the channel right before launching it, instead of in the background after it's launched. And I also add more videos whenever I have a chance :)

fnord12 commented 4 years ago

Yeah, what you're describing sounds like the standard Reset Problem as i know it. That's why the first fix was to introduce that startup channel, so your other channels aren't affected. What you're seeing in the settings2 file makes sense, too. As far as the code is concerned, it's correctly keeping the seektime (not setting back to 0) and if you look in your debug log after a fail/reset, you'll see that it correctly sets the seektime. Something mysterious (not shown in the log) happens after that which causes the playlist to reset.

I'm not suggesting you do this (it wouldn't help with anything, it's just proof of the problem), but if you were to reverse your mode setup, so that the overall mode was Resume and the rest were forced to Realtime, and then you made the code change mentioned in the Release Notes, you'd see that the TMNT channel was now not resetting if it's the startup channel, and all the others would. Although i'm not sure how the Pause option would affect things.

It's weird how i can fix it for one mode or the other, but putting in a simple If statement causes it to fail.

gonzo90017 commented 4 years ago

kodi.zip

Overlay.zip

Tried your suggestion. I think I did everything right. Modified Overlay.py, Changed overall mode to Resume, I removed all of the Advanced channel settings for the TMNT channel just to make sure it didn't affect the results. Set the startup channel to 6 (TMNT).

But still the same behavior as above. Exiting using X works fine. Exiting with ESC and the channel resets. Just thought I should let you know since it's been a while since anybody has looked into this issue.

Forgot to put kodi in debug mode. It's easy to reproduce so let me know if you would like me to do that.

fnord12 commented 4 years ago

Debug wasn't turned on for the log so it doesn't show much. I do see the "script didn't stop in 5 seconds - let's kill it" message from Kodi, which seems to indicate a crash. I also see all the duration notices for the videos - is that normal for you?

It's disappointing that the swap didn't work for you. For me, with my "fix" i can either get Realtime or Resume working, depending on how i have that line in the code (which you changed correctly). I haven't tested much with individual channels forcing one mode or the other, but it sounds like for this test neither did you.

fnord12 commented 4 years ago

Just some notes in case anyone else wants to follow along in the code: there isn't much difference between quitting via X or Esc. If you press Esc it triggers the OnAction function for ACTION_PREVIOUS_MENU, which opens the Yes/No dialog and then calls self.end(). If you press X, what happens is that the playerTimerAction function notices that a video is no longer playing, and then it also calls self.end().

playerTimerAction regularly writes to the lastPlayTime and lastPlaylistPosition variables, which are used when writing the seektime to the settings2.xml file.

The end function has an if statement that explicitly writes those variables one last time if the player is still playing (which would be happening if the user pressed ESC, but not X), and then it explicitly stops the player (which should bethe same as pressing X). That's the only difference between ESC and X. That last write to those variables shouldn't be making a difference - we've seen that the settings2.xml file is storing the correct seek numbers either way.

I did try commenting out the last two writes, and things seemed to work for me in Resume mode about 90% of the time, and it failed 10% of the time because it didn't have values for those variables, i guess because i hadn't been on the channel long enough for playerTimerAction to write them. But, again, we see that the correct information is been written to settings2.xml, so it doesn't make sense to mess with those lines.

Therefore, if there really is some difference between ESC and X, it could be in how the player is stopped when directed by the user - X - vs. how PSTV does it in the end function: self.Player.stop() . Those should be the same, but i wonder if something there is causing the difference.

I think part of Steve's attempts at fixing this involved changing the kodi player setting - in looking at the history i've seen him add, remove, and change the location of the xbmc.executebuiltin("PlayerControl(RepeatOff)") line in the end function. Kodi does seem to have a habit of turning Repeat on; i've noticed that in regular video play. I don't know how that would affect PSTV on restart. But in any even the end function currently turns it off.

It's hard to see how X vs. Esc should make any difference but some things to try when i have time include checking the Kodi repeat (and random?) player before restarting Kodi and seeing it makes a difference, and seeing if playing a video outside of PSTV in between PSTV sessions - exiting a movie with X - somehow makes a difference.

It's all very mysterious and hard to debug,