fedward 1 Posted January 18, 2022 Share Posted January 18, 2022 @BillOatman It does seem to be necessary to find the ID for the control session and send instructions to that one in this case. I defined strings for the two session IDs as class variables: private string PlaybackSession = string.Empty; private string ControlSession = string.Empty; And then set them once in the PlaybackStart method, replacing the local 'session' variable throughout that function: PlaybackSession = e.Session.Id; ControlSession = (e.Session.SupportsRemoteControl) ? PlaybackSession : SessionManager.Sessions.Where( i => i.DeviceId == e.Session.DeviceId && i.SupportsRemoteControl) .First().Id; (Formatted for legibility; the rest of the refactor isn't shown) Then the only further change is to update the two function calls to SkipCommercial and SendMessageToClient so they use the ControlSession value instead of the session determined from PlaybackProgress. I suppose the plugin actually ought to detect if there's no controllable session for the device and exit cleanly, because sending controls to a session that can't respond to them isn't very helpful. Let me know if I need to dust off my GitHub account and submit a PR. Link to comment Share on other sites More sharing options...
BillOatman 502 Posted January 18, 2022 Author Share Posted January 18, 2022 (edited) 13 hours ago, fedward said: Let me know if I need to dust off my GitHub account and submit a PR. Ugh but good work. I'm trying it out now. @fedward This works for me, give it a try. ComSkipper.zip Edited January 18, 2022 by BillOatman Link to comment Share on other sites More sharing options...
Spaceboy 2494 Posted January 18, 2022 Share Posted January 18, 2022 @BillOatman you saw my PM on the requirements for real-time processing? Link to comment Share on other sites More sharing options...
BillOatman 502 Posted January 18, 2022 Author Share Posted January 18, 2022 1 hour ago, Spaceboy said: @BillOatman you saw my PM on the requirements for real-time processing? With the ScripterX script etc? Yup sure did. Updated the doc in github. Next release I'll remove the "experimental" label. Thanks 1 Link to comment Share on other sites More sharing options...
fedward 1 Posted January 18, 2022 Share Posted January 18, 2022 20 hours ago, BillOatman said: Ugh but good work. I'm trying it out now. @fedward This works for me, give it a try. ComSkipper.zip 824.84 kB · 2 downloads Yup, That's got it. Thanks @BillOatman for both incorporating my fix and doing it so quickly. 1 Link to comment Share on other sites More sharing options...
BillOatman 502 Posted January 19, 2022 Author Share Posted January 19, 2022 Updated release in first post. 1 Link to comment Share on other sites More sharing options...
reneboulard 31 Posted January 19, 2022 Share Posted January 19, 2022 Is it possible to add in your code : System.Globalization so the EDL file will be parse correctly if the system is in a different culture than US. i.e. - Cultures use decimal point (Israel, Japan, UK) or comma (Slovakia, France, Germany) as decimal separators. Persian uses a forward slash (/). So setting CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); This way parsing EDL file will work in any setting. You can refer to https://zetcode.com/csharp/cultureinfo/ for more info Thank you Link to comment Share on other sites More sharing options...
BillOatman 502 Posted January 19, 2022 Author Share Posted January 19, 2022 3 hours ago, reneboulard said: Is it possible to add in your code : System.Globalization so the EDL file will be parse correctly if the system is in a different culture than US. i.e. - Cultures use decimal point (Israel, Japan, UK) or comma (Slovakia, France, Germany) as decimal separators. Persian uses a forward slash (/). So setting CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); This way parsing EDL file will work in any setting. You can refer to https://zetcode.com/csharp/cultureinfo/ for more info Thank you Hi. Yes I can set the culture that way, thanks for the suggestion. I should have a test version available for you to try later today my time, Link to comment Share on other sites More sharing options...
BillOatman 502 Posted January 20, 2022 Author Share Posted January 20, 2022 14 hours ago, reneboulard said: Is it possible to add in your code : System.Globalization so the EDL file will be parse correctly if the system is in a different culture than US. i.e. - Cultures use decimal point (Israel, Japan, UK) or comma (Slovakia, France, Germany) as decimal separators. Persian uses a forward slash (/). So setting CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); This way parsing EDL file will work in any setting. You can refer to https://zetcode.com/csharp/cultureinfo/ for more info Thank you Please give this a try. ComSkipperCultureTest.zip Link to comment Share on other sites More sharing options...
reneboulard 31 Posted January 20, 2022 Share Posted January 20, 2022 8 hours ago, BillOatman said: Please give this a try. ComSkipperCultureTest.zip 824.9 kB · 1 download Worked like a charm. Thank you Link to comment Share on other sites More sharing options...
BillOatman 502 Posted January 20, 2022 Author Share Posted January 20, 2022 3 hours ago, reneboulard said: Worked like a charm. Thank you Sweet, thank you! I'll get it released. Link to comment Share on other sites More sharing options...
BillOatman 502 Posted January 20, 2022 Author Share Posted January 20, 2022 Release updated in first post. Link to comment Share on other sites More sharing options...
HarryMuscle 3 Posted January 21, 2022 Share Posted January 21, 2022 How soon after a commercial is marked to start can the plug-in skip it? Looking at the code it seems to be limited by how often the Emby server calls the plug-in via the the callback methods. For example, if the EDL file says a commercial starts at exactly 10:00 will the plug-in initiate the skipping within the second (ie: before 10:01) or is it more like within 5 to 10 seconds? Also curious how quickly the clients tend to react to this request to skip the commercial? Thanks, Harry Link to comment Share on other sites More sharing options...
BillOatman 502 Posted January 21, 2022 Author Share Posted January 21, 2022 10 hours ago, HarryMuscle said: How soon after a commercial is marked to start can the plug-in skip it? Looking at the code it seems to be limited by how often the Emby server calls the plug-in via the the callback methods. For example, if the EDL file says a commercial starts at exactly 10:00 will the plug-in initiate the skipping within the second (ie: before 10:01) or is it more like within 5 to 10 seconds? Also curious how quickly the clients tend to react to this request to skip the commercial? Thanks, Harry There is no logic around that at all. My eyeballing it during all the testing tells me it is within a second or 2 that it skips. But how much of that is delay in Emby versus what comskip detects I never looked as it operates as I expect. Link to comment Share on other sites More sharing options...
inzombyac 69 Posted February 1, 2022 Share Posted February 1, 2022 @BillOatman thanks for this plugin. It gives me hope in being able to use Emby for my live TV purposes. Is this plugin meant to work for any Emby client? I am able to get it to work with the web client, and the Samsung TV client, but not any of my Android TV clients (3 Nvidia Shield TV's). On the ATV client I see the commercial skip popup like it's going to work, but the skip doesn't do anything. I checked the logs and it doesn't report any error. Just checking to see if this is expected to work. Link to comment Share on other sites More sharing options...
BillOatman 502 Posted February 1, 2022 Author Share Posted February 1, 2022 1 hour ago, inzombyac said: @BillOatman thanks for this plugin. It gives me hope in being able to use Emby for my live TV purposes. Is this plugin meant to work for any Emby client? I am able to get it to work with the web client, and the Samsung TV client, but not any of my Android TV clients (3 Nvidia Shield TV's). On the ATV client I see the commercial skip popup like it's going to work, but the skip doesn't do anything. I checked the logs and it doesn't report any error. Just checking to see if this is expected to work. Yes, it should work with all Emby clients that can accept "RemoteControl" commands. It does work on my shields. If you want to turn on debug logging and run through one that does not work I'd be happy to take a look at it. Link to comment Share on other sites More sharing options...
inzombyac 69 Posted February 1, 2022 Share Posted February 1, 2022 @BillOatman here's a link to the server log https://www.dropbox.com/s/h5o7a8gzj23pdae/emby_log.txt?dl=0 I am not seeing any error reports as far as I can tell. In this case the file was remuxed from a .ts to .mkv, but I have tried before with standard .ts files. Link to comment Share on other sites More sharing options...
BillOatman 502 Posted February 1, 2022 Author Share Posted February 1, 2022 1 hour ago, inzombyac said: @BillOatman here's a link to the server log https://www.dropbox.com/s/h5o7a8gzj23pdae/emby_log.txt?dl=0 I am not seeing any error reports as far as I can tell. In this case the file was remuxed from a .ts to .mkv, but I have tried before with standard .ts files. The relevant parts are: Quote 2022-02-01 13:04:18.930 Debug Com Skipper: EDL file \\EMBY\Recordings\7 News at Noon\7 News at Noon 2022_02_01_12_00_00.edl found. 2022-02-01 13:04:18.936 Debug Com Skipper: parts 0.00 167.17 2022-02-01 13:04:18.936 Debug Com Skipper: parts 273.84 299.12 2022-02-01 13:04:18.937 Debug Com Skipper: Commmercial List in seconds for 7 News at Noon 2022_02_01_12_00_00.mkv: 2022-02-01 13:04:18.937 Debug Com Skipper: Start: 1 End: 167 2022-02-01 13:04:18.937 Debug Com Skipper: Start: 273 End: 299 2022-02-01 13:04:19.945 Debug Com Skipper: Skipping commercial. Session: 4c50e94d522dd421d52be6b6d497eac5 Start = 10000000 End = 1671699999 Everything looks happy. You got the on screen message and the session must state it is remote control capable or it would not try and send the command, so your client just isn't honoring the remote control command for some reason. I'll try and look later too, but look in your client settings and make sure remote control isn't disabled somehow. Link to comment Share on other sites More sharing options...
marcsimus 5 Posted February 2, 2022 Share Posted February 2, 2022 I've had the comskip and ffmpeg setup sitting on my to-do list for a while and this plugin makes me glad I waited. It was sounding a little painful to get the ffmpeg piece setup to mangle the video file to remove the commercials. No longer need to do that, just generate the edl and I'm all set! Thanks, @BillOatman! One thing I did notice pretty quickly though, it doesn't seem to handle skipping back in the video very well. On my first test I was skipping ahead to find a block of commercials and happened to skip to the middle of one of those blocks. The plugin did it's job and skipped to the end of the commercials. However, I wanted to test it during a normal playback session (one where I didn't just jump to the middle of a block of commercials) so I skipped back prior to the beginning of that same block of commercials to just let it play. This time when I got to the commercials, it didn't skip. So I played around with that a bit and was able to reproduce it consistently. After the plugin skips a block of commercials, if you back track it won't skip that same block again. The exception to that is if after rewinding you stop the playback and replay it. Doesn't seem to matter if you continue where you left off or start the playback from the beginning again. Upon replaying the recording again, it will skip those commercials again. After it fails to skip though, if you let it play or skip ahead to the next block of commercials it will then skip those. So it seems to me that perhaps the plugin keeps a placeholder in the edl which doesn't backtrack when you rewind? Or maybe another way to state that, maybe the plugin is only keeping track of the next set of timestamps from the edl which doesn't get corrected when you backtrack? I did also test the case where if my current playback is prior to the first block of commercials and I skip ahead to just before the second block, it does still skip that second block. So this does seem to only be an issue when rewinding to a point before (or during) a set of commercials that have already been skipped. This isn't a big deal since I don't, in practice, rewind all that often. Even when I do, it's not a big deal to have to sit through a few commercials once in a while. Just thought I'd bring it to your attention so you can decide if you'd like to do anything about it. Great work here! Link to comment Share on other sites More sharing options...
inzombyac 69 Posted February 2, 2022 Share Posted February 2, 2022 7 hours ago, BillOatman said: The relevant parts are: Everything looks happy. You got the on screen message and the session must state it is remote control capable or it would not try and send the command, so your client just isn't honoring the remote control command for some reason. I'll try and look later too, but look in your client settings and make sure remote control isn't disabled somehow. It turns out I had the beta client on my shields. Thanks for the assist and keep up the good work. Link to comment Share on other sites More sharing options...
marcsimus 5 Posted February 2, 2022 Share Posted February 2, 2022 11 hours ago, marcsimus said: I've had the comskip and ffmpeg setup sitting on my to-do list for a while and this plugin makes me glad I waited. It was sounding a little painful to get the ffmpeg piece setup to mangle the video file to remove the commercials. No longer need to do that, just generate the edl and I'm all set! Thanks, @BillOatman! One thing I did notice pretty quickly though, it doesn't seem to handle skipping back in the video very well. On my first test I was skipping ahead to find a block of commercials and happened to skip to the middle of one of those blocks. The plugin did it's job and skipped to the end of the commercials. However, I wanted to test it during a normal playback session (one where I didn't just jump to the middle of a block of commercials) so I skipped back prior to the beginning of that same block of commercials to just let it play. This time when I got to the commercials, it didn't skip. So I played around with that a bit and was able to reproduce it consistently. After the plugin skips a block of commercials, if you back track it won't skip that same block again. The exception to that is if after rewinding you stop the playback and replay it. Doesn't seem to matter if you continue where you left off or start the playback from the beginning again. Upon replaying the recording again, it will skip those commercials again. After it fails to skip though, if you let it play or skip ahead to the next block of commercials it will then skip those. So it seems to me that perhaps the plugin keeps a placeholder in the edl which doesn't backtrack when you rewind? Or maybe another way to state that, maybe the plugin is only keeping track of the next set of timestamps from the edl which doesn't get corrected when you backtrack? I did also test the case where if my current playback is prior to the first block of commercials and I skip ahead to just before the second block, it does still skip that second block. So this does seem to only be an issue when rewinding to a point before (or during) a set of commercials that have already been skipped. This isn't a big deal since I don't, in practice, rewind all that often. Even when I do, it's not a big deal to have to sit through a few commercials once in a while. Just thought I'd bring it to your attention so you can decide if you'd like to do anything about it. Great work here! Just noticed that the PDF states this, "Once ComSkipper skips a commercial, it will not skip it again unless you restart the playback of the recording." So I guess never mind. Link to comment Share on other sites More sharing options...
BillOatman 502 Posted February 2, 2022 Author Share Posted February 2, 2022 1 minute ago, marcsimus said: Just noticed that the PDF states this, "Once ComSkipper skips a commercial, it will not skip it again unless you restart the playback of the recording." So I guess never mind. Yeah that's because if comskip makes a mistake and causes the plugin to skip too far (rare, but could happen), you can manually go back to the correct spot and not have the plugin fight you on it Link to comment Share on other sites More sharing options...
BillOatman 502 Posted February 2, 2022 Author Share Posted February 2, 2022 11 hours ago, inzombyac said: It turns out I had the beta client on my shields. Thanks for the assist and keep up the good work. Ahh ok thanks for getting back to us Link to comment Share on other sites More sharing options...
marcsimus 5 Posted February 3, 2022 Share Posted February 3, 2022 On 2/2/2022 at 8:45 AM, BillOatman said: Yeah that's because if comskip makes a mistake and causes the plugin to skip too far (rare, but could happen), you can manually go back to the correct spot and not have the plugin fight you on it Sure. Once I sat down and put some more thought into it I assumed that's what was probably going on. Link to comment Share on other sites More sharing options...
Sw!sH 0 Posted February 8, 2022 Share Posted February 8, 2022 (edited) Hey there first off all, sorry for my english Secondly, I'll have some local text for you. Com Skipper:Locale = de Text could be: "Werbung übersprungen" Otherwise I'll get the english text "Commercial Skipped". Thanks for the really great work. I love that plugin!!!! Edited February 8, 2022 by Sw!sH Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now