Jump to content

ComSkipper ... A Emby Plugin that skips commercials


BillOatman

Recommended Posts

BillOatman
20 hours ago, roaku said:

From the looks of it, the plugin dev would need to move the culture setting from the Run method to the ReadEdlFile method.

I think the Run method is getting called once when Emby starts up, then Emby changes the setting at some point after that. By the time someone's watching something, the setting is 'wrong'.

The plugin may need to start setting the culture back to what Emby wants art the end of its edl processing too.

This is all just my best guess though.

@Luke  FYI  Is that what I need to do?  Has the threading changed in 4.8?

Link to comment
Share on other sites

9 minutes ago, BillOatman said:

@LukeI still have this set in the plugin code, (first thing entering the Run() method), it was added to resolve the issue above.
 

            // Set for correct parsing of the EDL file regardless of servers culture
            CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");

Do I need to do something different in 4.8?

 

I would remove that because that could interfere with the core server.

Link to comment
Share on other sites

BillOatman
21 minutes ago, Luke said:

I would remove that because that could interfere with the core server.

@LukeThat was added because comskip uses periods for numbers where some locales like French use commas. It worked fine prior to 4.8.  What would your suggestion be to change the locale for my thread to en-US?

@roaku@reneboulardCan comskip be configured to respect the locale of the server its running on? Or, could a script be run after comskip to replace periods with commas in the EDL file?  

 

Edited by BillOatman
Link to comment
Share on other sites

reneboulard
1 hour ago, BillOatman said:

@LukeThat was added because comskip uses periods for numbers where some locales like French use commas. It worked fine prior to 4.8.  What would your suggestion be to change the locale for my thread to en-US?

@roaku@reneboulardCan comskip be configured to respect the locale of the server its running on? Or, could a script be run after comskip to replace periods with commas in the EDL file?  

 

I already changed my postprocessing script to change the edl file, this was easy to do.  However, my edl will not be compatible with kodi.

I do not see any configuration for comskip to set the format of the edl.

Another solution is to set the culture to en-US just prior to reading the edl, and reset the culture to it initial setting after the data of the edl been read.

I have been dealing with this for many years while programming multi language web apps and using data fron other source that cannot be change.  Date format and number are often problematic.

 

Look here https://www.techieclues.com/blogs/converting-strings-to-doubles-in-csharp

 

There is a way to parse in a different culture without changing it.

That should work

seq.startTicks = (long)(double.Parse(parts[0],CultureInfo.GetCultureInfo("en-US")) * (double)TimeSpan.TicksPerSecond);

 

 

 

 

 

Edited by reneboulard
  • Like 1
Link to comment
Share on other sites

BillOatman
41 minutes ago, reneboulard said:

That should work

seq.startTicks = (long)(double.Parse(parts[0],CultureInfo.GetCultureInfo("en-US")) * (double)TimeSpan.TicksPerSecond);

 

Yeah that seems reasonable.  I'll make those changes tonight and get you a DLL to test if that's ok?

  • Like 1
Link to comment
Share on other sites

reneboulard
16 minutes ago, BillOatman said:

Yeah that seems reasonable.  I'll make those changes tonight and get you a DLL to test if that's ok?

Great.

  • Like 1
Link to comment
Share on other sites

reneboulard

I took the liberty to compile ComSkipper after making the following change and it work perfectly.

added the CultureInfo.GetCultureInfo("en-US") when reading the edl file.

                           seq.startTicks = (long)(double.Parse(parts[0],CultureInfo.GetCultureInfo("en-US")) * (double)TimeSpan.TicksPerSecond);
                           if (seq.startTicks < TimeSpan.TicksPerSecond)
                               seq.startTicks = TimeSpan.TicksPerSecond;
                           seq.endTicks = (long)(double.Parse(parts[1],CultureInfo.GetCultureInfo("en-US")) * (double)TimeSpan.TicksPerSecond);
 

and I remove

 

   // CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");

Since it is not needed anymore.

 

Thank you all for you help and patience.

  • Like 1
Link to comment
Share on other sites

BillOatman
12 minutes ago, reneboulard said:

I took the liberty to compile ComSkipper after making the following change and it work perfectly.

added the CultureInfo.GetCultureInfo("en-US") when reading the edl file.

                           seq.startTicks = (long)(double.Parse(parts[0],CultureInfo.GetCultureInfo("en-US")) * (double)TimeSpan.TicksPerSecond);
                           if (seq.startTicks < TimeSpan.TicksPerSecond)
                               seq.startTicks = TimeSpan.TicksPerSecond;
                           seq.endTicks = (long)(double.Parse(parts[1],CultureInfo.GetCultureInfo("en-US")) * (double)TimeSpan.TicksPerSecond);
 

and I remove

 

   // CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");

Since it is not needed anymore.

 

Thank you all for you help and patience.

Yes I did the same and also updated to the latest Emby nuget.  I was going to send it to you but now I guess I do not need to. :)  I'll just release it.  Thanks! 

Link to comment
Share on other sites

BillOatman

Released.  Details in first post.

For some reason I cannot modify the first post.  So the updated binary is here.

Edited by BillOatman
  • Like 1
Link to comment
Share on other sites

roaku
3 minutes ago, BillOatman said:

Released.  Details in first post.

For some reason I cannot modify the first post.  So the updated binary is here.

Ya, another poster here was a serial thread deleter so the forum admin locked everyone out from editing their posts except for a short time window after publishing. Makes it impossible to manage plugin support threads. 🤷‍♂️

  • Confused 1
Link to comment
Share on other sites

vdrover
1 hour ago, roaku said:

Ya, another poster here was a serial thread deleter so the forum admin locked everyone out from editing their posts except for a short time window after publishing. Makes it impossible to manage plugin support threads. 🤷‍♂️

Maybe the admin can update the OP?

Link to comment
Share on other sites

roaku
13 minutes ago, vdrover said:

Maybe the admin can update the OP?

They can do all kinds of stuff.

Link to comment
Share on other sites

muppet4k

@BillOatman

How can I install this, when I am using emby in a docker container on a Synology NAS? 🙂 have you any Idea? I Would like to try it too.

Or can I install it outside and make videos post processing to cut of commercials 

 

Thank you for your Help

Link to comment
Share on other sites

vdrover
4 hours ago, muppet4k said:

@BillOatman

How can I install this, when I am using emby in a docker container on a Synology NAS? 🙂 have you any Idea? I Would like to try it too.

Or can I install it outside and make videos post processing to cut of commercials 

 

Thank you for your Help

I use docker on Ubuntu, and I suspect the process is similar on Synology: wherever you have your docker data for emby, put the `comskip.dll` file in the `emby/plugins` folder and restart emby.

Link to comment
Share on other sites

muppet4k
39 minutes ago, vdrover said:

I use docker on Ubuntu, and I suspect the process is similar on Synology: wherever you have your docker data for emby, put the `comskip.dll` file in the `emby/plugins` folder and restart emby.

Where can I get this Comskip.dll and how can I figure it ?

Is there also a way with com cut out of recorded video files, too?

Link to comment
Share on other sites

vdrover

@muppet4kI apologize, I thought you were asking specifically about upgrading. 

I recommend you go to the original post on page 1 of this thread and follow the instructions. My Ubuntu procedure is found on page 6 I think and may be useful for Synology.

  • Like 1
Link to comment
Share on other sites

BillOatman
3 minutes ago, muppet4k said:

Where can I get this Comskip.dll and how can I figure it ?

Is there also a way with com cut out of recorded video files, too?

Get it here. There is a pdf to help with the configuration, plus there is a lot of information in posts here.

No way to alter the video file with this plugin.

Link to comment
Share on other sites

muppet4k
1 hour ago, vdrover said:

@muppet4kI apologize, I thought you were asking specifically about upgrading. 

I recommend you go to the original post on page 1 of this thread and follow the instructions. My Ubuntu procedure is found on page 6 I think and may be useful for Synology.

I don’t find something on page 6

how did you install it on Linux ?

I copied now dll file in the plug in folder and restsrted emby

where can I setup it ? 

 

 

Link to comment
Share on other sites

muppet4k
1 hour ago, vdrover said:

Sorry, page 7 here.

iam confused because I have no opt/emby-Server Folder....

 

but I installed it into a docker with these files... you too in a docker?

 

 

Bildschirmfoto 2024-02-06 um 18.06.40.png

Link to comment
Share on other sites

BillOatman

The powers that be graciously gave me permissions to modify my older posts, so I was able to update the first post with the latest release info.

  • Like 2
  • Haha 1
Link to comment
Share on other sites

vdrover
39 minutes ago, muppet4k said:

iam confused because I have no opt/emby-Server Folder...

but I installed it into a docker with these files... you too in a docker?

 

My original post was not docker, but i now use docker. In your case, the DLL goes in the emby/plugins folder.

Link to comment
Share on other sites

muppet4k
55 minutes ago, vdrover said:

My original post was not docker, but i now use docker. In your case, the DLL goes in the emby/plugins folder.

oaky I set up now all in your post... but I got an error:

System.ComponentModel.Win32Exception: System.ComponentModel.Win32Exception (2): An error occurred trying to start process '/usr/local/bin/comskip' with working directory '/var/run/s6/services/emby-server'. No such file or directory

Must I put some path or variables in the docker setting from emby?

Link to comment
Share on other sites

JanLenoch

Hey @BillOatman, I just deployed the 2.1 version and found that the plugin fails to skip commercials. I found that ServerEntryPoint.PlaybackProgress() throws NREs. I set up remote debugging on my box and revealed the NREs happen when getting a control session. First, the code determines that the session found in event args doesn't support remote control. Then, when looking for suitable sessions through SessionManager, the NREs get thrown since you don't use a null-coalescing "?" operator after FirstOrDefault().

When trying to dig deeper, I found that it probably boils down to Emby.Server.Implementations.Session.WebSocketManager.SupportsMediaControl returning false due to GetActiveSockets() failing to find anything.

I have a pretty vanilla 4.8 installation. I didn't do any tweaks beyond what an admin can alter in the admin area. Do you have any ideas what might have gone wrong?

CC @Luke

Thanks!

Edited by JanLenoch
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
×
×
  • Create New...