I-A-C / plugin.video.exodusredux

GNU General Public License v3.0
20 stars 13 forks source link

Resume Not Functioning correctly Kodi 18 Beta 4 #4

Closed SerpentDrago closed 5 years ago

SerpentDrago commented 5 years ago

https://www.reddit.com/r/Addons4Kodi/comments/9r4mvy/exodus_redux_resume_playback/

Resume not working for me and others . Need confirmation if it only effects Kodi 18 . or Kodi 18 beta 4 , i'll try to find some time to do some tests .

Resume will Pop up (even if i've never watched a show ) it never works even if i have .

I have trakt installed and auth'd , both in addon and trakt addon , scrobbling works

JFG90 commented 5 years ago

I would have uploaded a log file but it didn't produce me with one, was using the ARMV8A 64bit

host505 commented 5 years ago

FYI this hasn't been working an any Exodus fork since the very early stages of Leia. It's not something new, so whoever wanna degug this don't start looking on recent Leia changes, it must have been a very old Kodi change that caused this - I'm assuming something to do with the videoplayer refactoring that occurred at the beginning of Leia branching.

Tikipeter commented 5 years ago

The problem here is that 'seektime' in the xbmc.player class has been playing up since the videoplayer refactoring.

One fix is to set a delay before invoking the seek, This is problematic for an add-on as you would have to set a very large delay before seeking forward as different videos/hosters will resolve quicker than others. So this is not really an option.

Another fix is to stop using 'onPlayBackStarted' and instead use 'onAVStarted'. The problem is this is not backwards compatible with Kodi 17 or below, so is not really an option either.

The code below will continue to try seeking forward to the resume time, until the current playback time matches or is greater than the resume time. Then it will break. There's 30 seconds total for the seektime function to work, therefore 30 seconds to resolve the video. That should be plenty.

In script.module.exodusredux/lib/resources/lib/modules/player.py: Replace the current 'onPlayBackStarted' function with the one below (line 256):

def onPlayBackStarted(self):
    control.execute('Dialog.Close(all,true)')
    if not self.offset == '0':
        for i in range(0, 300):
            self.seekTime(float(self.offset))
            if self.getTime() >= float(self.offset): break
            else: control.sleep(100)
    subtitles().get(self.name, self.imdb, self.season, self.episode)
    self.idleForPlayback()

Someone having this problem please test.....

SerpentDrago commented 5 years ago

Another fix is to stop using 'onPlayBackStarted' and instead use 'onAVStarted'. The problem is this is not backwards compatible with Kodi 17 or below, so is not really an option either.

Can't you just issue one or the other depending on what version kodi is detected ?

I'll tryout your fix in a few

SerpentDrago commented 5 years ago

It works ! Want me to do the PR or you ? (also i changed notepad ++ in settings to "replace with spaces " omg no more weird indent errors ! )

SerpentDrago commented 5 years ago

SO ... I think there is other issues going on . Sometimes i don't even get a Resume Dialog to pop up . If i do . it works ! so theres that . but i think something else is going on .. or maybe just for me . That stops kodi getting resume data or something .

host505 commented 5 years ago

Another fix is to stop using 'onPlayBackStarted' and instead use 'onAVStarted'. The problem is this is not backwards compatible with Kodi 17 or below, so is not really an option either.

Thanks so much for this! It has been bugging me for quite some time. I new it had to do something with the videoplayer refactoring but I hadn't dug into the changes being made.

I didn't test your code, as others had, but what worked for me (on both 17 & 18): On control.py add:

def getKodiVersion():
    return xbmc.getInfoLabel("System.BuildVersion").split(".")[0]

On player.py add (just above def onPlayBackStarted(self):):

    def onAVStarted(self):
        try:
            if int(control.getKodiVersion()) >= 18:
                control.execute('Dialog.Close(all,true)')
                if not self.offset == '0': self.seekTime(float(self.offset))
                subtitles().get(self.name, self.imdb, self.season, self.episode)
                self.idleForPlayback()
        except:
            pass

Now I'm not an actual coder, just hacking around here, what'you think, is this valid/hacky, are there any drawbacks?

JFG90 commented 5 years ago

Was using Numbers and it was working

SerpentDrago commented 5 years ago

I'm all for having one thing that works using the Kodi 18 way and one thing that works using the kodi 17 way .

I would think it would be better going forward to switch to the new method and only have code for compatibility for old versions

Tikipeter commented 5 years ago

You could probably just add the "onAVStarted" function and leave in place the original "onPlayBackStarted" function as well. It SHOULD work without having to see what version of Kodi is installed. Just have identical code for each function:

def onAVStarted(self):
    control.execute('Dialog.Close(all,true)')
    if not self.offset == '0': self.seekTime(float(self.offset))
    subtitles().get(self.name, self.imdb, self.season, self.episode)
    self.idleForPlayback()

def onPlayBackStarted(self):
    control.execute('Dialog.Close(all,true)')
    if not self.offset == '0': self.seekTime(float(self.offset))
    subtitles().get(self.name, self.imdb, self.season, self.episode)
    self.idleForPlayback()
host505 commented 5 years ago

^^Tried that, resume stopped working for v17...

Tikipeter commented 5 years ago

I just tested it and with the above code in Kodi 17 and resume still worked for me....

host505 commented 5 years ago

Yes, you're right, it works. Must have messed up something when I first tried.

jewbmx commented 5 years ago

Dont know if i messed up or missed something but when i tried the code Tikipter last posted it loads a weird vshare pair msg on every source lol. Might fix the kodi 18 issue but it broke my 17.6 so i took it back out for now

host505 commented 5 years ago

Seems like an interference with resolveurl. I use the code I posted here https://github.com/I-A-C/plugin.video.exodusredux/issues/4#issuecomment-433089689, haven't came across any issues so far.

jewbmx commented 5 years ago

K I'll toss that in. My roommate will be happy for the fix lol

ghost commented 5 years ago

I tried that code last night on 17. Video would not play.

host505 commented 5 years ago

^^ works fine here. Can you post your control.py & player.py on pastebin or something?

ghost commented 5 years ago

@host505 yes I'll post both later on tonight

jewbmx commented 5 years ago

That code gives me a error at kodi startup for the control.py part. But im not fussing with it anymore lol I dont even use that kodi 18 mess so I dont feel like the stress is worth it lmao.

host505 commented 5 years ago

Probably indentation error.

drinfernoo commented 5 years ago

Any movement on this? Just curious if I've missed a commit somewhere that possibly fixed it.

jewbmx commented 5 years ago

Pretty sure theres a old issue thats closed with its fix inside the comments but dont know if anyone made the changes lol. With a chance of sounding like a dick did you try to resume from the same host? (Like rapidshare)

I-A-C commented 5 years ago

Does this fix work? (I don't have a Kodi 18 version available atm) https://github.com/I-A-C/plugin.video.exodusredux/issues/4#issuecomment-433158782

Pushed commit to script.module.exodusredux, https://github.com/I-A-C/script.module.exodusredux/commit/6204e113d5468b1e2b5f00dfe081879ca4218dde

SerpentDrago commented 5 years ago

For anyone that likes doing testing on different version of kodi . Its SUPER ez to get that going .

First make sure to install each version of kodi you want to its own unique folder . then when you run it use -p switch to run in "portable mode" , It will store all its settings its own folder .

I have 2 kodi 17 setups , and 3 kodi 18 setups using this method