mdhiggins / PlexAutoSkip

Automatically skip content in Plex
MIT License
198 stars 11 forks source link

Offsets not working #34

Closed ShanaryS closed 1 year ago

ShanaryS commented 1 year ago

I tried changing it, restarting the container each time but it doesn't do anything. Changing other things in the config does work however. Same issue everywhere the skip intro works.

Log:

2023-02-19 13:37:56 - __main__ - INFO - /usr/local/pas/venv/bin/python3
2023-02-19 13:37:56 - __main__ - DEBUG - Loading default config file.
2023-02-19 13:37:56 - __main__ - INFO - Loading config file /usr/local/pas/config/config.ini.
2023-02-19 13:37:56 - __main__ - INFO - Loading custom JSON file /usr/local/pas/config/custom.json
2023-02-19 13:37:56 - __main__ - INFO - Connecting to Plex server...
2023-02-19 13:37:59 - __main__ - INFO - Connected to Plex server Q using plex.tv account
2023-02-19 13:37:59 - __main__ - DEBUG - Connected to server using plex.tv account, ignoring manual server settings
2023-02-19 13:37:59 - __main__ - DEBUG - IntroSeeker init with leftOffset 3000 rightOffset 1000
2023-02-19 13:37:59 - __main__ - DEBUG - Operating in MODE_TYPES.SKIP mode
2023-02-19 13:37:59 - __main__ - DEBUG - Skip tags ['intro', 'commercial', 'advertisement', 'credits']
2023-02-19 13:37:59 - __main__ - DEBUG - Skip S01E01 SKIP_TYPES.NEVER
2023-02-19 13:37:59 - __main__ - DEBUG - Skip S**E01 SKIP_TYPES.NEVER
2023-02-19 13:37:59 - __main__ - DEBUG - Skip last chapter 0.0
2023-02-19 13:37:59 - __main__ - INFO - Skipper initiated and ready
2023-02-19 13:37:59 - __main__ - DEBUG - Starting listener
2023-02-19 13:37:59 - websocket - INFO - Websocket connected
2023-02-19 13:38:03 - __main__ - INFO - Found new session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 viewOffset 32836 StoneColeQ, sessions: 0
2023-02-19 13:38:03 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [buffering] viewOffset 32836, old 32836, diff 0ms (0s since last update)
2023-02-19 13:38:03 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 32836, old 32836, diff 0ms (0s since last update)
2023-02-19 13:38:07 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 38038, old 37621, diff 417ms (4s since last update)
2023-02-19 13:38:13 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 43293, old 43302, diff -9ms (5s since last update)
2023-02-19 13:38:18 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 48589, old 48582, diff 7ms (5s since last update)
2023-02-19 13:38:23 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 53845, old 53844, diff 1ms (5s since last update)
2023-02-19 13:38:28 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 58849, old 58843, diff 6ms (4s since last update)
2023-02-19 13:38:29 - __main__ - INFO - Found skippable marker intro for media 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 with range 59176-91454 and viewOffset 59571
2023-02-19 13:38:29 - __main__ - INFO - Seeking Plex for iOS player playing 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 from 59580 to 91454
2023-02-19 13:38:29 - __main__ - DEBUG - Recent seek successful, server offset update 91454 meets/exceeds target 91000 [buffering]
2023-02-19 13:38:29 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [buffering] viewOffset 91454, old 91643, diff -189ms (0s since last update)
2023-02-19 13:38:29 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 91454, old 91454, diff 0ms (0s since last update)
2023-02-19 13:38:32 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [paused] viewOffset 94595, old 94820, diff -225ms (3s since last update)
2023-02-19 13:38:52 - __main__ - DEBUG - Updating session 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [paused] viewOffset 94595, old 94595, diff 0ms (19s since last update)

Config:

ssl = True
port = 32400

[Security]
ignore-certs = False

[Skip]
mode = skip
tags = intro, commercial, advertisement, credits
types = movie, episode
ignored-libraries = Shadowplay
last-chapter = 0.0
unwatched = True
first-episode-series = Never
first-episode-season = Never
next = True

[Offsets]
start = 3000
end = 1000
command = 500
tags = intro

[Volume]
low = 0
high = 100

Also it seems to error out when trying to skip on the plex app for Chromecast with GoogleTV. Same logs as this

mdhiggins commented 1 year ago

When it reports the range in the logs it includes the offsets

2023-02-19 13:38:29 - __main__ - INFO - Found skippable marker intro for media 14 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 with range 59176-91454 and viewOffset 59571

You would need to check your XML to see if that range is actually missing the offsets or not

Just ran a test on the current version using an episode with this marker

<Marker id="38358" type="intro" startTimeOffset="67966" endTimeOffset="88359">

Which results in

Found skippable marker intro for media 399 [1996] (Brooklyn Nine-Nine s02e02 - Chocolate Milk) *** with range 70966-89359 and viewOffset 73395

Using the following settings

[Offsets]
start = 3000
end = 1000
command = 500
tags = intro

Math all checks out

mdhiggins commented 1 year ago

2cd56c3260001c8259a4238735a3ca0cc012eaf1

Quick patch that will more clearly display the actual chapter markers and offsets in the logs to avoid this confusion

ShanaryS commented 1 year ago

I tried changing the offsets by up to 60,000 and it had no effect. It kept skipping and ending at the same spots. These was after restarting the container.

mdhiggins commented 1 year ago
[Offsets]
start = 3000
end = 10000
INFO - Found skippable marker intro for media 447 [1996] (Brooklyn Nine-Nine s02e02 - Chocolate Milk) *** with range 67966(+3000)-88359(+10000) and viewOffset 74157
INFO - Seeking Plex for Windows player playing 447 [1996] (Brooklyn Nine-Nine s02e02 - Chocolate Milk) *** from 74157 to 98359

Tried it again using 10000 offset and it works as intended. I'm guessing what you're seeing is only the default offsets being applied

Can you try and update to some new non-default offsets and post the logs? Preferably with today's update

mdhiggins commented 1 year ago

You do need to restart the script between setting changes, just in case that's the issue

ShanaryS commented 1 year ago

Here is the marker in the XML: <Marker id="20792" type="intro" startTimeOffset="59176" endTimeOffset="91454"> So the offset wasn't applying earlier.

I ran it with the new update, seems like the overlay isn't applying.

2023-02-19 21:11:28 - __main__ - INFO - /usr/local/pas/venv/bin/python3
2023-02-19 21:11:28 - __main__ - DEBUG - Loading default config file.
2023-02-19 21:11:28 - __main__ - INFO - Loading config file /usr/local/pas/config/config.ini.
2023-02-19 21:11:28 - __main__ - INFO - Loading custom JSON file /usr/local/pas/config/custom.json
2023-02-19 21:11:28 - __main__ - INFO - Connecting to Plex server...
2023-02-19 21:11:32 - __main__ - INFO - Connected to Plex server Q using plex.tv account
2023-02-19 21:11:32 - __main__ - DEBUG - Connected to server using plex.tv account, ignoring manual server settings
2023-02-19 21:11:32 - __main__ - DEBUG - IntroSeeker init with leftOffset 10000 rightOffset 5000
2023-02-19 21:11:32 - __main__ - DEBUG - Operating in MODE_TYPES.SKIP mode
2023-02-19 21:11:32 - __main__ - DEBUG - Skip tags ['intro', 'commercial', 'advertisement', 'credits']
2023-02-19 21:11:32 - __main__ - DEBUG - Skip S01E01 SKIP_TYPES.NEVER
2023-02-19 21:11:32 - __main__ - DEBUG - Skip S**E01 SKIP_TYPES.NEVER
2023-02-19 21:11:32 - __main__ - DEBUG - Skip last chapter 0.0
2023-02-19 21:11:32 - __main__ - INFO - Skipper initiated and ready
2023-02-19 21:11:32 - __main__ - DEBUG - Starting listener
2023-02-19 21:11:32 - websocket - INFO - Websocket connected
2023-02-19 21:11:32 - __main__ - INFO - Found new session 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 viewOffset 44678 StoneColeQ, sessions: 0
2023-02-19 21:11:32 - __main__ - DEBUG - Updating session 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 44678, old 44678, diff 0ms (0s since last update)
2023-02-19 21:11:37 - __main__ - DEBUG - Updating session 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 49967, old 49451, diff 516ms (4s since last update)
2023-02-19 21:11:42 - __main__ - DEBUG - Updating session 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 54971, old 54981, diff -10ms (5s since last update)
2023-02-19 21:11:47 - __main__ - INFO - Found skippable marker intro for media 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 with range 59176(+0)-91454(+0) and viewOffset 59397
2023-02-19 21:11:47 - __main__ - INFO - Seeking Plex for iOS player playing 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 from 59399 to 91454
2023-02-19 21:11:47 - __main__ - ERROR - BadRequest Error, see https://github.com/mdhiggins/PlexAutoSkip/wiki/Troubleshooting#badrequest-error
2023-02-19 21:11:47 - __main__ - DEBUG - Modifying client for direct connection using baseURL http://10.10.10.201:32500 for player iPhone (None)
2023-02-19 21:11:47 - __main__ - INFO - Seeking Plex for iOS player playing 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 from 59400 to 91454
2023-02-19 21:11:47 - __main__ - DEBUG - Recent seek successful, server offset update 91454 meets/exceeds target 91000 [buffering]
2023-02-19 21:11:47 - __main__ - DEBUG - Updating session 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [buffering] viewOffset 91454, old 91454, diff 0ms (0s since last update)
2023-02-19 21:11:47 - __main__ - DEBUG - Updating session 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [playing] viewOffset 91454, old 91454, diff 0ms (0s since last update)
2023-02-19 21:11:50 - __main__ - DEBUG - Updating session 25 [2036] (Big Mouth s01e02 - Everybody Bleeds) iPhone|DB48BC9E-AB7C-405B-99A4-AEFA4212F219 [paused] viewOffset 94261, old 94490, diff -229ms (3s since last update)

Config:

[Security]
ignore-certs = False

[Skip]
mode = skip
tags = intro, commercial, advertisement, credits
types = movie, episode
ignored-libraries = Shadowplay
last-chapter = 0.0
unwatched = True
first-episode-series = Never
first-episode-season = Never
next = True

[Offsets]
start = 10000
end = 5000
command = 500
tags = intro

[Volume]
low = 0
high = 100

What do you mean restart the script? I'm running it through docker so I just restart the container. It definitely updates with the config as I can give it the wrong login info and it breaks.

mdhiggins commented 1 year ago

Do you have anything in your custom.json file that might be overriding things?

mdhiggins commented 1 year ago

The only other way I can figure that you might be having issues is from these lines

            leftOffset = leftOffset if marker.type.lower() in mediaWrapper.offsetTags else 0
            rightOffset = rightOffset if marker.type.lower() in mediaWrapper.offsetTags else 0

Which set the offsets to 0 if the tag isn't in the offset tags list, but it looks like your setting is correct, I added some more logging for this if you want to update and rerun

ShanaryS commented 1 year ago

I haven't edited custom.json:

{
    "markers": {},
    "offsets": {},
    "tags": {},
    "allowed": {
        "users": [],
        "clients": [],
        "keys": [],
        "skip-next": []
    },
    "blocked": {
        "users": [],
        "clients": [],
        "keys": [],
        "skip-next": []
    },
    "clients": {},
    "mode": {}
}

I'm running through docker so you'll have to update the image.

mdhiggins commented 1 year ago

Just set environment variable PAS_UPDATE = true on your container and it'll update from github after every container restart

Also, found the problem

8b2243495269027dab63d9cc3b96e287952710df

That'll fix it, I wasn't using a local variable name inside the for loop so it was carrying over and zeroing out the offset in certain circumstances, fixed now

ShanaryS commented 1 year ago

Yep working now. Thanks!