BillOatman 500 Posted June 18, 2019 Author Share Posted June 18, 2019 @@BillOatman, This sounds like playback progress EventArgs. Has the playback started scene been connected to sessionManager.PlaybackStartedEvent. Otherwise it will trigger every second. Yup: _sessionManager.PlaybackStart += PlaybackStart; _sessionManager.PlaybackStopped += PlaybackStopped; _sessionManager.PlaybackProgress += PlaybackProgress; 1 Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 18, 2019 Author Share Posted June 18, 2019 You want to monitor the playback progress event for things like pausing and unpause in sessions. Also, it is good to check mediaItem.Type = "Movie" Or "Series", "Episode" etc Yup do that too I'm thinking in his setup unexpected devices are coming through. So I put this at the start of all 3 routines: var DeviceOptions = Plugin.Instance.Configuration.Options.Where(i => i.embyDeviceID == e.DeviceId && i.Enabled); if (DeviceOptions.Count() == 0) { return; } So any devices that I don't care about, and that aren't enabled for this plugin, kicks out of the callback immediately. We'll see. If that's it, it's a good optimization for everyone. 1 Link to comment Share on other sites More sharing options...
chef 3745 Posted June 18, 2019 Share Posted June 18, 2019 (edited) Yup do that too I'm thinking in his setup unexpected devices are coming through. So I put this at the start of all 3 routines: var DeviceOptions = Plugin.Instance.Configuration.Options.Where(i => i.embyDeviceID == e.DeviceId && i.Enabled); if (DeviceOptions.Count() == 0) { return; }So any devices that I don't care about, and that aren't enabled for this plugin, kicks out of the callback immediately.We'll see. If that's it, it's a good optimization for everyone. Nice! The problem with device IDs are that clients like Chrome and Xbox One ,will change IDs Everytime they load. This is why emby's device tab has duplicate, upon duplicates of registered chrome entries. LOL. Edited June 18, 2019 by chef Link to comment Share on other sites More sharing options...
pir8radio 1292 Posted June 18, 2019 Share Posted June 18, 2019 Nice! The problem with device IDs are that clients like Chrome and Xbox One ,will change IDs Everytime they load. This is why emby's device tab has duplicate, upon duplicates of registered chrome entries. LOL. Hopefully no one is using a browser for their tv/theater setup. [emoji846] Sent from my iPhone using Tapatalk Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 18, 2019 Author Share Posted June 18, 2019 New version in original post. Link to comment Share on other sites More sharing options...
pir8radio 1292 Posted June 19, 2019 Share Posted June 19, 2019 2019-06-18 21:09:48.532 Error SessionManager: Error in event handler *** Error Report *** Version: 4.2.0.17 Command line: C:\Users\nam\AppData\Roaming\Emby-Server\System\EmbyServer.dll -noautorunwebapp Operating system: Microsoft Windows NT 6.2.9200.0 64-Bit OS: True 64-Bit Process: True User Interactive: True Runtime: file:///C:/Users/nam/AppData/Roaming/Emby-Server/System/System.Private.CoreLib.dll Processor count: 40 Program data path: C:\Users\nam\AppData\Roaming\Emby-Server Application directory: C:\Users\nam\AppData\Roaming\Emby-Server\System System.MissingMethodException: System.MissingMethodException: Method not found: 'Boolean MediaBrowser.Model.Dto.BaseItemDto.IsType(System.String)'. at Emby.HueMoodLighting.HueMoodLighting.PlaybackProgress(Object sender, PlaybackProgressEventArgs e) at MediaBrowser.Common.Events.EventHelper.FireEventIfNotNull[T](EventHandler`1 handler, Object sender, T args, ILogger logger) Source: Emby.HueMoodLighting TargetSite: Void PlaybackProgress(System.Object, MediaBrowser.Controller.Library.PlaybackProgressEventArgs) 2019-06-18 21:09:49.532 Error SessionManager: Error in event handler *** Error Report *** Version: 4.2.0.17 Command line: C:\Users\nam\AppData\Roaming\Emby-Server\System\EmbyServer.dll -noautorunwebapp Operating system: Microsoft Windows NT 6.2.9200.0 64-Bit OS: True 64-Bit Process: True User Interactive: True Runtime: file:///C:/Users/nam/AppData/Roaming/Emby-Server/System/System.Private.CoreLib.dll Processor count: 40 Program data path: C:\Users\nam\AppData\Roaming\Emby-Server Application directory: C:\Users\nam\AppData\Roaming\Emby-Server\System System.MissingMethodException: System.MissingMethodException: Method not found: 'Boolean MediaBrowser.Model.Dto.BaseItemDto.IsType(System.String)'. at Emby.HueMoodLighting.HueMoodLighting.PlaybackProgress(Object sender, PlaybackProgressEventArgs e) at MediaBrowser.Common.Events.EventHelper.FireEventIfNotNull[T](EventHandler`1 handler, Object sender, T args, ILogger logger) Source: Emby.HueMoodLighting TargetSite: Void PlaybackProgress(System.Object, MediaBrowser.Controller.Library.PlaybackProgressEventArgs) Link to comment Share on other sites More sharing options...
pir8radio 1292 Posted June 19, 2019 Share Posted June 19, 2019 (edited) @@BillOatman every second error non-stop stopped... However if any user is playing anything, I get the error every second until everyone stops. IE browser worked too.. But getting the above error, and no light control. Edited June 19, 2019 by pir8radio Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 19, 2019 Author Share Posted June 19, 2019 (edited) @@BillOatman every second error non-stop stopped... However if any user is playing anything, I get the error every second until everyone stops. IE browser worked too.. But getting the above error, and no light control. Well that's good about IE anyway. Safari is working too now. It's so weird, Emby is sending something very different in your case for some reason. Edited June 19, 2019 by BillOatman Link to comment Share on other sites More sharing options...
chef 3745 Posted June 19, 2019 Share Posted June 19, 2019 (edited) 2019-06-18 21:09:48.532 Error SessionManager: Error in event handler *** Error Report *** Version: 4.2.0.17 Command line: C:\Users\nam\AppData\Roaming\Emby-Server\System\EmbyServer.dll -noautorunwebapp Operating system: Microsoft Windows NT 6.2.9200.0 64-Bit OS: True 64-Bit Process: True User Interactive: True Runtime: file:///C:/Users/nam/AppData/Roaming/Emby-Server/System/System.Private.CoreLib.dll Processor count: 40 Program data path: C:\Users\nam\AppData\Roaming\Emby-Server Application directory: C:\Users\nam\AppData\Roaming\Emby-Server\System System.MissingMethodException: System.MissingMethodException: Method not found: 'Boolean MediaBrowser.Model.Dto.BaseItemDto.IsType(System.String)'. at Emby.HueMoodLighting.HueMoodLighting.PlaybackProgress(Object sender, PlaybackProgressEventArgs e) at MediaBrowser.Common.Events.EventHelper.FireEventIfNotNull[T](EventHandler`1 handler, Object sender, T args, ILogger logger) Source: Emby.HueMoodLighting TargetSite: Void PlaybackProgress(System.Object, MediaBrowser.Controller.Library.PlaybackProgressEventArgs) 2019-06-18 21:09:49.532 Error SessionManager: Error in event handler *** Error Report *** Version: 4.2.0.17 Command line: C:\Users\nam\AppData\Roaming\Emby-Server\System\EmbyServer.dll -noautorunwebapp Operating system: Microsoft Windows NT 6.2.9200.0 64-Bit OS: True 64-Bit Process: True User Interactive: True Runtime: file:///C:/Users/nam/AppData/Roaming/Emby-Server/System/System.Private.CoreLib.dll Processor count: 40 Program data path: C:\Users\nam\AppData\Roaming\Emby-Server Application directory: C:\Users\nam\AppData\Roaming\Emby-Server\System System.MissingMethodException: System.MissingMethodException: Method not found: 'Boolean MediaBrowser.Model.Dto.BaseItemDto.IsType(System.String)'. at Emby.HueMoodLighting.HueMoodLighting.PlaybackProgress(Object sender, PlaybackProgressEventArgs e) at MediaBrowser.Common.Events.EventHelper.FireEventIfNotNull[T](EventHandler`1 handler, Object sender, T args, ILogger logger) Source: Emby.HueMoodLighting TargetSite: Void PlaybackProgress(System.Object, MediaBrowser.Controller.Library.PlaybackProgressEventArgs) That exception says that the PlaybackProgress event arguments doesn't understand IsType(string) on the baseItem. Use the PlaybackProgress to check for paused Sessions. Use sessionManager to check all sessions in the Progress event. It will report that there is a list of Paused, or Unpaused sessions, and return those session IDs. There is a gotcha in the Emby API to be mindful of: If a session is playing media then it is flagged as "Unpaused". So in Vera plugin there is a internal boolean that switches from true or false. Or else the unpause event will trigger again and again while playing media, because it is technically Unpaused. To handle this the best I could I create a List<string>. session IDs. If the session becomes Paused I add the ID to the list and trigger a paused scene. Then check each event trigger to see if the playing sessions are in the list. If they are, then the session is no longer paused and a scene can trigger Unpaused, and remove the ID from the list. Other wise ignore the events. _----------------- But Playprogress events will also return NowPlayingItem which is an itemDto, and will contain info. Not sure if this helps pinpoint an issue. Edited June 20, 2019 by chef 1 Link to comment Share on other sites More sharing options...
WilhelmStroker 96 Posted June 20, 2019 Share Posted June 20, 2019 Not sure how to workaround this but when I watch a playlist of TV shows, my lights come on, and then turn down again when a new episode starts. Probably due to the fact that it is a stop and start of an episode. Also noticed that when I back out of an episode with the back key of my harmony remote, my lights stay dimmed, I guess because Emby doesn't register that as a stop event. Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 20, 2019 Author Share Posted June 20, 2019 Not sure how to workaround this but when I watch a playlist of TV shows, my lights come on, and then turn down again when a new episode starts. Probably due to the fact that it is a stop and start of an episode. Also noticed that when I back out of an episode with the back key of my harmony remote, my lights stay dimmed, I guess because Emby doesn't register that as a stop event. Yeah that would be my guess, no stop event on the back out. Same behavior for a movie? What client are you using for this? @@Luke and/or @@chef ... Is there or should there be a stop event sent on a back button if a video is playing? Or is there a different event to subscribe to for this? Link to comment Share on other sites More sharing options...
chef 3745 Posted June 20, 2019 Share Posted June 20, 2019 (edited) Backing out of playback should stop the stream so the PlaybackStopped event would fire. Which client is the item being played on? Also, I have run into the same issues while watching episodes from Vera where each episode change causes scenes to run. I'm currently looking at logic to fix that and I will share or we can work together to refactor something that fixes it, I'm sure. Edited June 20, 2019 by chef Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 20, 2019 Author Share Posted June 20, 2019 (edited) Sounds good. By the way @@WilhelmStroker, you can set the movies only checkbox so the plugin won't control lights at all for tv episodes. Edited June 20, 2019 by BillOatman Link to comment Share on other sites More sharing options...
WilhelmStroker 96 Posted June 21, 2019 Share Posted June 21, 2019 OK so I tested this again on both Xbox and Fire TV stick and for some reason the backout now triggers the stop event correctly for both movies and TV shows. Didn't make any changes to my setup.. I'm aware of the movies setting but most of my watching is TV shows so I'd like the lights to trigger all the time Happy to test any new versions! Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 21, 2019 Author Share Posted June 21, 2019 OK so I tested this again on both Xbox and Fire TV stick and for some reason the backout now triggers the stop event correctly for both movies and TV shows. Didn't make any changes to my setup.. I'm aware of the movies setting but most of my watching is TV shows so I'd like the lights to trigger all the time Happy to test any new versions! Thanks for the update! I noticed over this past weekend I think that a few times after the firmware updated on my bridge that the bridge seemed to ignore some scene setting commands. I went to debug thinking I had broken something, then it started working and has worked since then. Maybe you had a similar situation. Glad it's working through I have one current fairly minor bug I'm working/testing now with another user. Then I think it will be ready to release. Hopefully I'll be posting another release candidate soon Link to comment Share on other sites More sharing options...
WilhelmStroker 96 Posted June 21, 2019 Share Posted June 21, 2019 Yeah I reckon it started working after I rebooted my router, I've noticed a few times that my hub gets in a weird state. Working fine now though Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 22, 2019 Author Share Posted June 22, 2019 Release candidate 4 now in original post. No outstanding bugs that I know of 2 Link to comment Share on other sites More sharing options...
pir8radio 1292 Posted June 23, 2019 Share Posted June 23, 2019 (edited) Release candidate 4 now in original post. No outstanding bugs that I know of I would like to note, that it works over the internet (hue is at a different location than the emby server) and its instant. Thanks for taking on this plugin, hope to see it in the emby lineup soon! Edited June 23, 2019 by pir8radio 1 Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 23, 2019 Author Share Posted June 23, 2019 Should be in the catalog now, enjoy! Link to comment Share on other sites More sharing options...
pir8radio 1292 Posted June 23, 2019 Share Posted June 23, 2019 Should be in the catalog now, enjoy! Do I have to remove and install from there to get auto updates? Sent from my iPhone using Tapatalk Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 23, 2019 Author Share Posted June 23, 2019 (edited) Do I have to remove and install from there to get auto updates? Sent from my iPhone using Tapatalk I do not know the answer to that. But the version in the catalog is 1.0.0.0 so you might need to update from the catalog, even though the only difference will be that version number. I suspect @@ebr knows, Edited June 23, 2019 by BillOatman 1 Link to comment Share on other sites More sharing options...
chef 3745 Posted June 23, 2019 Share Posted June 23, 2019 (edited) I do not know the answer to that. But the version in the catalog is 1.0.0.0 so you might need to update from the catalog, even though the only difference will be that version number. I suspect @@ebr knows, Make sure you change the cspoj file for updates when you release.Match the file and version numbers. Then match the version and file number for the cspoj to the admin page release data. If the cspoj file and admin site have bigger version number then what people have installed they will get a notification about the new install. Then people can restart emby server to force the update if they want or wait for emby to check for new plugin updates hidden task to run. Edited June 23, 2019 by chef 1 Link to comment Share on other sites More sharing options...
pir8radio 1292 Posted June 23, 2019 Share Posted June 23, 2019 looks like it worked, I didn't have to do anything, came home to this on my dashboard. 1 Link to comment Share on other sites More sharing options...
BillOatman 500 Posted June 24, 2019 Author Share Posted June 24, 2019 Cool! Link to comment Share on other sites More sharing options...
WilhelmStroker 96 Posted June 24, 2019 Share Posted June 24, 2019 Yup mine did this too, and it's successfully showing as version 1 now. Apart from the setting to control the lights only by night, i think it would be good to also be able to have the option to control the lights on a timed basis. Sunset is too late for me as my house is quite dark.... 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