home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Catch Standby event.
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="magnuje2" data-source="post: 52427" data-attributes="member: 20493"><p>A plugin like this should be fairly easy to impliment . This could open for all sorts of cool things in MP. I have seen a command line program for X-10 devices, so with the code below you could easily implement a system that dims your lights if a movie is played, but not for music, and dims it up again when you press pause. </p><p></p><p>To find these handles you could just search after "handle" (i think) in the MSDN.</p><p></p><p>i don't have the MCEIR program on this PC but if anyone wan't to impliment this i would be happy to send them over.</p><p></p><p>so, anyway. Here's the myscript code. The on.bat and off.bat are the programs i run and just contains a MCEIR.EXE cammand with some parameters and the learned IR file. </p><p></p><p>This script will turn your amp on if media is played and turn it off when you press stop (Not when media ended but this is easy. Just add another trigger). Hope this will be of some help:</p><p></p><p><xml></p><p><MyScript></p><p> <This></p><p> <Name>Amplifier</Name></p><p> <Description>Turns on the amp when needed</Description></p><p> <Author>Magnus</Author></p><p> <Version>1</Version></p><p> <Code>using System;</p><p>using System.Diagnostics;</p><p>using System.Windows.Forms;</p><p>using MediaPortal.MyScript;</p><p>using MediaPortal.GUI.Library;</p><p>using MediaPortal.Dialogs;</p><p>using MyScript;</p><p>using MediaPortal.Player;</p><p>using System.Threading;</p><p></p><p></p><p></p><p>class Main : Script</p><p>{ </p><p></p><p> </p><p> public void Start() </p><p> {</p><p> g_Player.PlayBackStarted += new g_Player.StartedHandler(Started);</p><p> g_Player.PlayBackStopped += new g_Player.StoppedHandler(Stopped);</p><p> </p><p> }</p><p> </p><p> public void Stop() </p><p> { </p><p> g_Player.PlayBackStarted -= new g_Player.StartedHandler(Started);</p><p> g_Player.PlayBackStopped -= new g_Player.StoppedHandler(Stopped);</p><p> }</p><p> </p><p> private void Started(g_Player.MediaType type, string filename)</p><p> {</p><p> </p><p> Process p=null;</p><p> try</p><p> {</p><p> string targetDir;</p><p> targetDir = string.Format(@"C:\IR");</p><p> p= new Process();</p><p> p.StartInfo.WorkingDirectory = targetDir;</p><p> p.StartInfo.FileName = "on.bat";</p><p></p><p> p.StartInfo.Arguments = string.Format("Test");</p><p> p.StartInfo.CreateNoWindow = true;</p><p> p.Start();</p><p> p.WaitForExit();</p><p> } </p><p> catch (Exception ex)</p><p> {</p><p> Console.WriteLine("Exception Occurred :{0},{1}", </p><p> ex.Message,ex.StackTrace.ToString());</p><p> } </p><p> </p><p> </p><p> </p><p> }</p><p></p><p>private void Stopped(g_Player.MediaType type, int tid, string filename)</p><p> {</p><p> </p><p> </p><p> Process p=null;</p><p> try</p><p> {</p><p> string targetDir;</p><p> targetDir = string.Format(@"C:\IR");</p><p> p= new Process();</p><p> p.StartInfo.WorkingDirectory = targetDir;</p><p> p.StartInfo.FileName = "off.bat";</p><p></p><p> p.StartInfo.Arguments = string.Format("Test");</p><p> p.StartInfo.CreateNoWindow = true;</p><p> p.Start();</p><p> p.WaitForExit();</p><p> } </p><p> catch (Exception ex)</p><p> {</p><p> Console.WriteLine("Exception Occurred :{0},{1}", </p><p> ex.Message,ex.StackTrace.ToString());</p><p> } </p><p> </p><p> </p><p> }</p><p></p><p></p><p>}</Code></p><p> <ExternalCodeFile></p><p> <Language>C#</Language></p><p> <AutoStart>Application</AutoStart></p><p> <WarningLevel>4</WarningLevel></p><p> <TreatWarningsAsErrors>False</TreatWarningsAsErrors></p><p> <IncludeDebugInformation>False</IncludeDebugInformation></p><p> <AdditionalAssemblies></p><p></MyScript></p></blockquote><p></p>
[QUOTE="magnuje2, post: 52427, member: 20493"] A plugin like this should be fairly easy to impliment . This could open for all sorts of cool things in MP. I have seen a command line program for X-10 devices, so with the code below you could easily implement a system that dims your lights if a movie is played, but not for music, and dims it up again when you press pause. To find these handles you could just search after "handle" (i think) in the MSDN. i don't have the MCEIR program on this PC but if anyone wan't to impliment this i would be happy to send them over. so, anyway. Here's the myscript code. The on.bat and off.bat are the programs i run and just contains a MCEIR.EXE cammand with some parameters and the learned IR file. This script will turn your amp on if media is played and turn it off when you press stop (Not when media ended but this is easy. Just add another trigger). Hope this will be of some help: <xml> <MyScript> <This> <Name>Amplifier</Name> <Description>Turns on the amp when needed</Description> <Author>Magnus</Author> <Version>1</Version> <Code>using System; using System.Diagnostics; using System.Windows.Forms; using MediaPortal.MyScript; using MediaPortal.GUI.Library; using MediaPortal.Dialogs; using MyScript; using MediaPortal.Player; using System.Threading; class Main : Script { public void Start() { g_Player.PlayBackStarted += new g_Player.StartedHandler(Started); g_Player.PlayBackStopped += new g_Player.StoppedHandler(Stopped); } public void Stop() { g_Player.PlayBackStarted -= new g_Player.StartedHandler(Started); g_Player.PlayBackStopped -= new g_Player.StoppedHandler(Stopped); } private void Started(g_Player.MediaType type, string filename) { Process p=null; try { string targetDir; targetDir = string.Format(@"C:\IR"); p= new Process(); p.StartInfo.WorkingDirectory = targetDir; p.StartInfo.FileName = "on.bat"; p.StartInfo.Arguments = string.Format("Test"); p.StartInfo.CreateNoWindow = true; p.Start(); p.WaitForExit(); } catch (Exception ex) { Console.WriteLine("Exception Occurred :{0},{1}", ex.Message,ex.StackTrace.ToString()); } } private void Stopped(g_Player.MediaType type, int tid, string filename) { Process p=null; try { string targetDir; targetDir = string.Format(@"C:\IR"); p= new Process(); p.StartInfo.WorkingDirectory = targetDir; p.StartInfo.FileName = "off.bat"; p.StartInfo.Arguments = string.Format("Test"); p.StartInfo.CreateNoWindow = true; p.Start(); p.WaitForExit(); } catch (Exception ex) { Console.WriteLine("Exception Occurred :{0},{1}", ex.Message,ex.StackTrace.ToString()); } } }</Code> <ExternalCodeFile> <Language>C#</Language> <AutoStart>Application</AutoStart> <WarningLevel>4</WarningLevel> <TreatWarningsAsErrors>False</TreatWarningsAsErrors> <IncludeDebugInformation>False</IncludeDebugInformation> <AdditionalAssemblies> </MyScript> [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Catch Standby event.
Contact us
RSS
Top
Bottom