(original thread) MCE Replacement Plugin v1.0.0 (1 Viewer)

Status
Not open for further replies.

and-81

Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    hi mahnuje2,

    I'm glad you like the plugin. Could you send me your "myscript" to control your amp, I'd be interested to see it. I'll try to fix the media started event too.

    Thanks,
     

    magnuje2

    Portal Member
    May 11, 2006
    23
    0
    sure, well myscript is a plugin where you can write code without compiling. Just do a search for dl link. Then you can write code directly in the plugins config screen. Very useful. My code below:

    <?xml version="1.0" encoding="utf-8"?>

    <MyScript>

    <!--This file generated by the MediaPortal MyScript Plugin.-->

    <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);

    }

    public void Stop()

    {

    g_Player.PlayBackStarted -= new g_Player.StartedHandler(Started);

    }

    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("C-Sharp Console application");

    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>


    The on.bat triggers the program that blasts the amp. MCEIr i think its called.

    Good luck mate, hope this helps
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    Thanks magnuje2,

    I'd heard of "MyScript" before but I had never looked into it. I guess I didn't realise it would be so powerful.

    I wonder, could it link to the public methods of my plugin and let you blast from a script? Hmmm. Something to play with ...

    Cheers,
     

    mikethefin

    Portal Member
    October 3, 2006
    23
    0
    55
    Home Country
    Finland Finland
    Hi Aaron!

    I'm using hibernation as sleep mode and suddenly (don't ask me how) it started to blast IR when it was going to sleep but with the same problem as magnuje2, it doesn't start my tv. I'm using the Multi-STB. Using IRTrans as my primary IR receiver (Zalman HD-160). Using your program to blast IR.

    Mike
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    Mike:
    You might need to get original codes for your TV from somewhere like remotecentral.com or the jp1 yahoo group. It sounds like the recorded code isn't close enough a match to what the TV is expecting. Or are you saying that it blasts when sleeping but not resuming?

    I've got a new version of the plugin coming real soon. I was suddenly inspired to write a serial comms command type into it. :) And I've reworked the Multi-STB Gui a little.

    I've included what I hope will control Nokia 9800s and 9902s boxes by serial port as a set top box quick setup option ... fingers crossed it works.

    Watch this space.

    Cheers,
     

    mikethefin

    Portal Member
    October 3, 2006
    23
    0
    55
    Home Country
    Finland Finland
    Nice work Aaron!

    It doesn't even try to blast when i'm resuming windows. It blasts when its going to hibernation (turns off the tv OK).

    I'll test Nokias serialcodes when you have the plugin ready

    Mike
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    ok Mike,

    It sounds like something I have noticed in my testing. Sometimes when resuming from hibernate the plugin tries to blast too soon. It tries to blast before the hardware, windows, or something is ready.

    I'm thinking of putting the blasting on another thread and delaying the start of that thread when it's launching from a resume ... But I would like to have MediaPortal itself send messages to my plugin to tell it when to resume and suspend, instead of listening for Windows Messages. That would solve all my problems ... maybe :) Basically, if MediaPortal only told my plugin to resume when MediaPortal had fully resumed then it would be safe to blast or whatever ...

    I've made some changes in my local copy that might fix the problem though, so please check it out when I post the next version. Which should be within a couple of hours ... I'm just trying to fix a bug where configuration.exe wont close ... but I'm not sure if it's my fault...

    cheers,
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    Test version for Serial Comms

    Hey folks,

    New feature time.

    I've added Serial Comms, and I've re-worked the GUI for STB setup as well as the file format. You will lose your current STB setup when you switch to this version. Can't be helped, sorry. There's also minor bug fixes and some work on the suspend and resume (no promises at this stage).

    If all is well I'll make a final release. EDIT: Plugin is now on the main download section.

    Thanks for your help guys.

    Cheers,
     

    mikethefin

    Portal Member
    October 3, 2006
    23
    0
    55
    Home Country
    Finland Finland
    Hi Aaron! The correct codes for my Nokia as an attachment. Channel change worked right away when using these codes and remembering that you have to choose the right tv card for analog ;) that sends codes...

    Mike
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    Thanks Mike, I was taking a risk putting the e$ts\r\n in the PreChange field, I thought it would work from what I read on the web, but apparently not.

    That's great news that the serial comms code is working in the plugin. I'll put your codes into the Quick Setup list and release a "final" version of the plugin onto the main download site. Probably within a day. I just want to be 100% sure of it.

    On other news, I just got the MceIrApi (Bruno Fleurette's code) to compile on my machine, so I'll start looking at extending it... But I have to brush up on my C/C++ skills to do that ... So don't expect anything soon.

    Thanks Mike,
     
    Status
    Not open for further replies.

    Users who are viewing this thread

    Top Bottom