Jump to content

EmbyCon and intro-skip plugin not working


averon
 Share

Go to solution Solved by TeamB,

Recommended Posts

averon

Hello, not sure what I do wrong, but I can't get intro-skip plugin working with embycon on kodi.

  • I have the plugin installed, and it works with android client to skip intros
  • I enabled auto-skip in the client, from where I control embycon
  • I installed Kodi Companion on Emby server

What do I miss?

Link to comment
Share on other sites

There is a lot of confusion around the skip intro feature, there is a plug in and also there is a core Emby implementation.

Only the plugin has auto skip, this is where it will skip forward automatically without prompting, this approach "might" work with EmbyCon.

You dont need the Kodi Companion addon on the Emby Server, that is for the Kodi Next Gen addon not EmbyCon.

 

Link to comment
Share on other sites

averon
50 minutes ago, TeamB said:

There is a lot of confusion around the skip intro feature, there is a plug in and also there is a core Emby implementation.

Only the plugin has auto skip, this is where it will skip forward automatically without prompting, this approach "might" work with EmbyCon.

You dont need the Kodi Companion addon on the Emby Server, that is for the Kodi Next Gen addon not EmbyCon.

 

I see, well I use the plugin and auto skip, but it still doesn't work. Any ideas?

Link to comment
Share on other sites

Posted (edited)

@quickmic do you know what the deal is with the current status of the skip intro integration with kodi?

@Luke do clients need to do anything special to facilitated this?

Edited by TeamB
Link to comment
Share on other sites

quickmic
Posted (edited)
24 minutes ago, TeamB said:

@quickmic do you know what the deal is with the current status of the skip intro integration with kodi?

@Luke do clients need to do anything special to facilitated this?

Skip intro is fully supported by next-gen 7.2.0 experimental version but not available in current 6.x stable or beta.

In plugins config menu is an option to enable the "skip" function, chapters are (always) synced to Kodi.

Plugin needs no further configuration as long as Emby server holds the information.

Edited by quickmic
Link to comment
Share on other sites

11 minutes ago, quickmic said:

In plugins config menu is an option to enable

In the kodi addon or the emby server skip intro plugin?

13 minutes ago, quickmic said:

chapters are (always) synced to Kodi.

What about dynamic lists where you dont sync the media items to the local db?

14 minutes ago, quickmic said:

Plugin needs no further configuration as long as Emby server holds the information.

So this works with chapters created using either the internal core skip detection or the skip intro plugin?

Link to comment
Share on other sites

quickmic
7 minutes ago, TeamB said:

In the kodi addon or the emby server skip intro plugin?

In the plugin configuration menu -> Playback -> Skip intro

 

7 minutes ago, TeamB said:

What about dynamic lists where you dont sync the media items to the local db?

Dynamic list doesn't support skip intro yet. (Probably I'll add them in one of the next versions)

 

 

7 minutes ago, TeamB said:

So this works with chapters created using either the internal core skip detection or the skip intro plugin?

Yes, should work with any version as long as the chapters (markers etc) are available on Emby server.

Several users already tested the functionalities, so far no bug reports.

 

 

 

 

 

 

Link to comment
Share on other sites

averon
2 hours ago, quickmic said:

Dynamic list doesn't support skip intro yet. (Probably I'll add them in one of the next versions)

Is there any more information about when the next version will be available? Since I use EmbyCon, as far as I understood its dynamic list, I would love to use the skip-intro feature.

Link to comment
Share on other sites

quickmic
Posted (edited)
19 minutes ago, averon said:

Is there any more information about when the next version will be available? Since I use EmbyCon, as far as I understood its dynamic list, I would love to use the skip-intro feature.

I don't know, I just released 7.3.0 today. Not too long, but I cannot say a date yet.

btw,

EmbyCon isn't (directly) related to Emby-for-Kodi-next-gen so not sure what's the deal. Are you installing both plugins?

Edited by quickmic
Link to comment
Share on other sites

averon
22 minutes ago, quickmic said:

I don't know, I just released 7.3.0 today. Not too long, but I cannot say a date yet.

btw,

EmbyCon isn't (directly) related to Emby-for-Kodi-next-gen so not sure what's the deal. Are you installing both plugins?

No, I tried emby for kodi next gen thingy, but had several issues and went back to EmbyCon, I don't really need the database thingy, I use emby client to control kodi.

  • Like 1
Link to comment
Share on other sites

Posted (edited)

@averon thats why we are talking, i am the EmbyCon dev, i am looking into it.

@quickmic you said the emby plugin config menu playback-skip intro, which emby plugin are you referring to?

How are you handling the user interface/prompt in Kodi? are you using a Kodi dialog to prompt for Skip Intro?

Edited by TeamB
Link to comment
Share on other sites

averon
52 minutes ago, TeamB said:

@averon thats why we are talking, i am the EmbyCon dev, i am looking into it.

Thanks a lot! :)

Link to comment
Share on other sites

Posted (edited)

@quickmic I am trying to avoid having to set this up in a test environment so just going though the code to try to work out how it all fits together.

The only reference I can find in NextGen v7 is in the Playback started event (def onAVStarted(self):)

if self.IntroEndPositionTicks and utils.enableSkipIntro and utils.Dialog.yesno(heading=utils.Translate(33199), message=utils.Translate(33417)):
    self.seekTime(self.IntroEndPositionTicks)

This looks like it would use the default YesNo Kodi Dialog when an item starts playing if the addon setting enableSkipIntro is enabled and the item has a IntroEndPositionTicks value. Does that sound correct?

If so then does this mean any content before the intro would also be skipped?

Edited by TeamB
Link to comment
Share on other sites

quickmic
Posted (edited)
6 hours ago, TeamB said:

@quickmic I am trying to avoid having to set this up in a test environment so just going though the code to try to work out how it all fits together.

The only reference I can find in NextGen v7 is in the Playback started event (def onAVStarted(self):)

if self.IntroEndPositionTicks and utils.enableSkipIntro and utils.Dialog.yesno(heading=utils.Translate(33199), message=utils.Translate(33417)):
    self.seekTime(self.IntroEndPositionTicks)

This looks like it would use the default YesNo Kodi Dialog when an item starts playing if the addon setting enableSkipIntro is enabled and the item has a IntroEndPositionTicks value. Does that sound correct?

If so then does this mean any content before the intro would also be skipped?

At the moment yes, same as the "skip intro" button on Emby server. Other options are possible.

Edit:

I wasn't thinking about Intros in the middle of an episode.

It would be also possible, to avoid the yesno question and just use the position tracker for the jumps.

 

    def PositionTracker(self):  # threaded
        LoopCounter = 0

        while self.EmbyServer and "ItemId" in self.PlayingItem and not utils.SystemShutdown:
            if not utils.sleep(1):
                if self.isPlaying():
                    Position = int(self.getTime())
                    LOG.info("PositionTracker: Position: %s / IntroStartPositionTicks: %s / IntroEndPositionTicks: %s" % (Position, self.IntroStartPositionTicks, self.IntroEndPositionTicks))

                    if utils.enableSkipIntro:
                        if Position > self.IntroStartPositionTicks and Position < self.IntroEndPositionTicks:
                            LOG.info("PositionTracker: Skip intro jump %s" % self.IntroEndPositionTicks)
                            self.seekTime(self.IntroEndPositionTicks)
                            self.PlayingItem['PositionTicks'] = self.IntroEndPositionTicks * 10000000
                            self.EmbyServer.API.session_progress(self.PlayingItem)
                            LoopCounter = 0

                    if LoopCounter % 4 == 0: # modulo 4
                        self.PlayingItem['PositionTicks'] = Position * 10000000
                        LOG.info("PositionTracker: Report progress %s" % self.PlayingItem['PositionTicks'])
                        self.EmbyServer.API.session_progress(self.PlayingItem)
                        LoopCounter = 0


                    LoopCounter += 1

        LoopCounter = 0
        self.PositionTrackerThread = False

 

Edited by quickmic
Link to comment
Share on other sites

quickmic
1 hour ago, quickmic said:

At the moment yes, same as the "skip intro" button on Emby server. Other options are possible.

Edit:

I wasn't thinking about Intros in the middle of an episode.

It would be also possible, to avoid the yesno question and just use the position tracker for the jumps.

 

    def PositionTracker(self):  # threaded
        LoopCounter = 0

        while self.EmbyServer and "ItemId" in self.PlayingItem and not utils.SystemShutdown:
            if not utils.sleep(1):
                if self.isPlaying():
                    Position = int(self.getTime())
                    LOG.info("PositionTracker: Position: %s / IntroStartPositionTicks: %s / IntroEndPositionTicks: %s" % (Position, self.IntroStartPositionTicks, self.IntroEndPositionTicks))

                    if utils.enableSkipIntro:
                        if Position > self.IntroStartPositionTicks and Position < self.IntroEndPositionTicks:
                            LOG.info("PositionTracker: Skip intro jump %s" % self.IntroEndPositionTicks)
                            self.seekTime(self.IntroEndPositionTicks)
                            self.PlayingItem['PositionTicks'] = self.IntroEndPositionTicks * 10000000
                            self.EmbyServer.API.session_progress(self.PlayingItem)
                            LoopCounter = 0

                    if LoopCounter % 4 == 0: # modulo 4
                        self.PlayingItem['PositionTicks'] = Position * 10000000
                        LOG.info("PositionTracker: Report progress %s" % self.PlayingItem['PositionTicks'])
                        self.EmbyServer.API.session_progress(self.PlayingItem)
                        LoopCounter = 0


                    LoopCounter += 1

        LoopCounter = 0
        self.PositionTrackerThread = False

 

Same approach possible for credit markers.

Link to comment
Share on other sites

1 hour ago, quickmic said:

I wasn't thinking about Intros in the middle of an episode.

some tv shows have the intro at the start but a lot have it after some time, for example some of the newer start trek shows the intro can be anywhere form 10 to 18 minutes into the episode.

I am working on a dialog that will prompt for skip into, bit like the other clients, it just uses a custom dialog with a similar look and feel as the other clients to prompt when the into markers are available.

  • Like 1
Link to comment
Share on other sites

quickmic
Posted (edited)
4 minutes ago, TeamB said:

some tv shows have the intro at the start but a lot have it after some time, for example some of the newer start trek shows the intro can be anywhere form 10 to 18 minutes into the episode.

I am working on a dialog that will prompt for skip into, bit like the other clients, it just uses a custom dialog with a similar look and feel as the other clients to prompt when the into markers are available.

Out of curiosity, do you also "inject" the "regular" chapters not embedded in the stream? I did a nasty workaround to detect if it's an embedded chapter or a "bookmark".

Edited by quickmic
Link to comment
Share on other sites

I am not actually storing any of the chapters into the chapters db in kodi.

I have a play session object I pass arround and I am storing the IntroStart and End times it that

    chapters = result.get("Chapters", [])
    intro_start = 0
    intro_end = 0
    for chapter in chapters:
        log.debug("Play Item Chapter : {0} - {1} - {2}", chapter["MarkerType"], chapter["Name"], chapter["StartPositionTicks"])
        if intro_start == 0 and chapter["MarkerType"] == "IntroStart":
            intro_start = chapter["StartPositionTicks"]
        elif intro_end == 0 and chapter["MarkerType"] == "IntroEnd":
            intro_end = chapter["StartPositionTicks"]

Then is the progress update I am checking is the current possitioon is in the intro time period and if so display a model dialog to allow the user to skip

 

    intro_start = play_data.get("intro_start", 0)
    intro_end = play_data.get("intro_end", 0)
    if intro_start > 0 and intro_end > 0 and not play_data.get("skip_into_shown", False):
        intro_start_sec = ((intro_start / 1000) / 10000) - 5
        intro_end_sec = ((intro_end / 1000) / 10000)
        if intro_start_sec < play_time < intro_end_sec:
            play_data["skip_into_shown"] = True
            settings = xbmcaddon.Addon()
            addon_path = settings.getAddonInfo('path')
            skip_intro_dialog = SkipIntroDialog("SkipIntroDialog.xml", addon_path, "default", "720p")
            skip_intro_dialog.doModal()
            if skip_intro_dialog.confirm:
                player.seekTime(intro_end_sec)

In this case the play_data is that play status object I store for an item that is playing.

Still been a bunch of testing and options but I think it should work.

Link to comment
Share on other sites

quickmic
4 minutes ago, TeamB said:
    intro_start = play_data.get("intro_start", 0)
    intro_end = play_data.get("intro_end", 0)
    if intro_start > 0 and intro_end > 0 and not play_data.get("skip_into_shown", False):
        intro_start_sec = ((intro_start / 1000) / 10000) - 5
        intro_end_sec = ((intro_end / 1000) / 10000)
        if intro_start_sec < play_time < intro_end_sec:
            play_data["skip_into_shown"] = True
            settings = xbmcaddon.Addon()
            addon_path = settings.getAddonInfo('path')
            skip_intro_dialog = SkipIntroDialog("SkipIntroDialog.xml", addon_path, "default", "720p")
            skip_intro_dialog.doModal()
            if skip_intro_dialog.confirm:
                player.seekTime(intro_end_sec)

In this case the play_data is that play status object I store for an item that is playing.

Still been a bunch of testing and options but I think it should work.

 

Yep, looks good to me.

May I make some (performance) suggestions...

((intro_start / 1000) / 10000) -> intro_start / 10000000

If you use "xbmcaddon.Addon" on multiple spots, preload xbmcaddon.Addon() at the top (like an import). Otherwise xbmcaddon will be initialized over and over again. I think intermediate setting changes (after  xbmcaddon.Addon()) should still be covered (to be tested).

at top:

XbmcAddon = xbmcaddon.Addon()

Then you can use it everywhere like -> XbmcAddon.getAddonInfo('path')

if intro_start is never < 0 you could use:  if intro_start and intro_end and not play_data.get("skip_into_shown", False):

If you preload intro_start with -1, this approach will not work. int = 0 equals bool False, everything else is True

 

 

 

 

 

 

 

Link to comment
Share on other sites

59 minutes ago, quickmic said:

((intro_start / 1000) / 10000) -> intro_start / 10000000

I would have though the python perpetrator would be better at optimizing this sort of thing.

1 hour ago, quickmic said:

XbmcAddon = xbmcaddon.Addon()

the problem I have had in the past using a package level version of xbmcaddon.Addon() is that it does not persist any settings or some other weird behavior where I set a setting and it is not loaded in another instance of the xbmcaddon.Addon() until the first one is de referenced.

I need to do a bunch more testing to see if this approach is viable or not, I have crashed Kodi at least once which is not unusual when creating modal dialogs due to Kodi having weird window event handling so will try a few different things to make sure I am happy with it.

  • Like 1
Link to comment
Share on other sites

quickmic
11 minutes ago, TeamB said:

I would have though the python perpetrator would be better at optimizing this sort of thing.

Probably yes, no idea how smart the interpreter is.

You can use pylint. Great tool for code review.

pylint -v --disable=missing-docstring --disable=invalid-name --disable=line-too-long --disable=too-many-branches --disable=too-many-locals --disable=too-many-return-statements --disable=too-many-instance-attributes --disable=bare-except --disable=import-error --disable=consider-using-f-string  /mykodiplugin/*

 

Link to comment
Share on other sites

averon

Not sure if this is relevant, tho, but I noticed that credits get skipped with embycon. Just the intros are not working.

Link to comment
Share on other sites

3 hours ago, quickmic said:

You can use pylint. Great tool for code review.

I normally just use the linter built into PyCharm, it picks up most things.

52 minutes ago, averon said:

Not sure if this is relevant, tho, but I noticed that credits get skipped with embycon. Just the intros are not working.

are you using the auto skip option in the emby introskip plugin, that might do that. There is currently nothing built into embycon to do that so it must be coming from an external trigger.

working on a skip prompt for embycon now, it will prompt when the server has chapter info for intro's

 

Link to comment
Share on other sites

averon
Posted (edited)
6 minutes ago, TeamB said:

I normally just use the linter built into PyCharm, it picks up most things.

are you using the auto skip option in the emby introskip plugin, that might do that. There is currently nothing built into embycon to do that so it must be coming from an external trigger.

working on a skip prompt for embycon now, it will prompt when the server has chapter info for intro's

 

I am using the plugin and I disabled the core feature, but had it running in before I switched to the plugin.

EDIT: and yes I use the auto skip, but that doesn't work for intros.

Edited by averon
Link to comment
Share on other sites

Posted (edited)

I ended up putting it all in a monitor thread to keep it as encapsulated as possible:

https://github.com/faush01/plugin.video.embycon/blob/develop/resources/lib/skip_intro_dialog.py

It will be in the next release in a few days.

Current implementation is just a prompt to skip the intro. I will add some options like auto skip as well in the next release.

 

Edited by TeamB
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...