(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
    A couple of Q:
    On my STB I use one digit for the 1-9 ch, and two for above - followed by [OK] (to speed things up.

    Plugin: I use "simple" (one?) to avoid sendig unecessary "0"s. I use the "send select"-option (for the [OK]).

    Even so, somtimes when I use two digits, ie. 13, it seems that if first changes to "1" for a (very) breef moment, then 13. Any Ideas of why?

    Is the blasters seending:
    1 [OK] - 3 [OK] or 1 - 2 [OK] the way I hvae set it up?
    I belive that its the last, and perhaps the pause is too long (but shorter pause doesent work).

    The simple setting just sends the minimum number of digits required. So "8" = "8", "10" = "10", etc... No leading Zero's.

    When it blasts it will only send "OK" after the digits of the channel have been sent. For example, To tun to channel 12 it will send "1 ... 2 ... OK", the delay can be set by the up/down arrows on the number box, which moves in increments of 50 milliseconds, but you can type a number into the box and it doesn't have to be in 50 millisecond steps. This allows for very fine tuning of the delay. But be aware that (especially if the computer is under heavy load) it wont be 100% accurate to the millisecond.

    If your STB is tuning ahead of time then it's the STB's fault, not the plugin. I'd suggest fine tuning the delay between blasts, maybe even teaching the IR codes to the plugin again, try holding the button for different amounts of time when learning. Try a tap (which is the way you're meant to do it) but also try holding it down a bit longer and see if that makes a difference.

    At the end of the day, recording and re-transmitting IR codes isn't an exact science. There are certain tolerances and margins for error built into all the protocols and you should experiment to get the best results. It sounds like you've already done plenty of experimentation, but I say this as much for the benefit of others.

    I'm glad you like the plugin. I'm still looking for ways to improve it, so if you come up with any idea's let me know. I've been very busy working on the next incarnation of the plugin and hope to have something to show for it soon. I've also had an idea of how to break the plugin into a collection of smaller plugins and I'll be putting some effort into that soon too. Rest assured that I'm still working on this plugin and ways of making the whole IR control experience better.

    Cheers,
     

    trevor

    Portal Pro
    October 17, 2006
    1,601
    952
    Chelmsford
    Home Country
    United Kingdom United Kingdom
    External Channel Change problem

    Just in the process of finilising my HTPC build and use MCE Replacment (jumped for joy when I found this) as it does extactly what I require, which is to use an external program to change channels on two STB's using different command line parameters per card.

    The problem I have now, and think it may internal to MP and nothing to do with this plugin but wanted check if anyone else was having a similar problem before gernerating a bug report.

    Everything works fine changing channels via the remote while watching livetv, both boxes are controlled and all is sweet.

    The issue is with timed recordings, at this point channels are not changed and the following ends up in the Mediaport.log and error.log


    2006-12-08 15:45:18.109375 [ERROR][MPMain]: Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at MediaPortal.Plugins.MCEReplacement.ProcessExternalChannel(String externalChannel, String tunerCard)
    at MediaPortal.Plugins.MCEReplacement.OnMessage(GUIMessage msg)
    at MediaPortal.GUI.Library.SendMessageHandler.Invoke(GUIMessage message)
    at MediaPortal.GUI.Library.GUIWindowManager.SendMessage(GUIMessage message)

    I am using the lastest SVN version om MP.

    Did have to make one code change, added the line

    process.StartInfo.CreateNoWindow = True

    into ProcessRunCommand, creating a window, be hidden or otherwise, causes havoc but this also happens on the version from the zip.

    Thanks

    Trevor
     

    and-81

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

    I've built your No Window change into my local copy of the plugin and will include it in the next release of the plugin. I've also fixed the array index problem you're having. I've attached a modified plugin dll (SVN version only) to this post, can you try it out for me and let me know how you get on?

    You'll need to redo your existing program launching commands because I've added the No Window option.

    zombiepig:
    Try the attached plugin too, it should solve the problem with the skin button to blast ir codes stuff... You know what i'm talking about ... If you're using external apps in the plugin anywhere then you'll need to redo those commands like I mentioned above to Trevor. Let me know how you get on.

    Thanks,
     

    zombiepig

    Portal Pro
    March 21, 2005
    408
    0
    Melb, Aus
    Home Country
    perfect!! all working exactly as it should :D:D

    here's a couple of screenshots of my modified nowplaying screen:

    control1.jpg


    control2.jpg


    thanks for all the time you've put into this! it's really broadened what's possible with mediaportal :D

    (ps. when you're ready and have released the next stable version of this plugin, i'll write up a how-to instructing ppl how to add new buttons like this)
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    I'll package it up and post it to the download section now.

    I've put some simple instructions in the docs already, but a proper write up would be fantastic.

    Thanks.

    EDIT: Due to the ongoing issue with external channel changing I'll be delaying the next version for a few days until a fix is put into MediaPortal SVN. I'll then compile against that and make a note of it in the docs.
     

    trevor

    Portal Pro
    October 17, 2006
    1,601
    952
    Chelmsford
    Home Country
    United Kingdom United Kingdom
    External channel change, new version feedback

    First thanks for reposnding so quickly and adding the the 'No Window' option which works great, thats the good news....

    The chages you made for array index have stopped the plugin crashing but still have the/a problem.

    Been doing a few tests this end and still not sure if this is a plugin or MP problem but below is a summary of whats happens.

    Some background and setup info.

    I have the PVR-500MCE card installed and have 2 Sky STB's, one of these has the full Sky subscription and the second only a subset (Freesat). Both boxes are controlled by SkyControl, an i/f box that feeds commands via RF2 on the STB's.

    To test I have set the cards with different channels on each, Card 1 has channels 106-999 and card 2 has 101-105 (external numbers).

    Below are the results with notes, as I said not really sure if this is a plugin problem I lean towards a setup problem with the event when triggered by the background schedular thread...thats a pure guess btw.

    Thanks for any help and let me know if you agree it may be a problem with MP and I will submit a detailed bug report.

    Trevor

    First test.

    Reboot and start MP but do not go into MyTV - use the web i/f to schedule a recoding to start at 16:00, this being 'Ski Sunday' on BBC (Channel 102), a channel present only on card 2.

    Section from the recoder logfile that shows MP found the right channel and card.

    2006-12-10 15:58:03.812500 [Info.][7]: Recorder: Send announcement for recording:Record once Ski Sunday on BBC2 London & South East from 10/12/2006 16:00 - 10/12/2006 16:45
    2006-12-10 16:00:03.828125 [Info.][7]: Recorder: time to record 'Ski Sunday' on channel:BBC2 London & South East from 16:00:00-16:45:00 id:36 priority:0 quality:NotSet Once
    2006-12-10 16:00:03.828125 [Info.][7]: Recorder: program:16:00:00-16:45:00
    2006-12-10 16:00:03.828125 [Info.][7]: Recorder: using card:Hauppauge PVR500MCE (b) prio:1
    2006-12-10 16:00:05.359375 [Info.][7]: Recorder: recording started 'Ski Sunday' on channel:BBC2 London & South East from 16:00:00-16:45:00 id:36 priority:0 quality:NotSet
    2006-12-10 16:00:05.359375 [Info.][7]: Recorder: recording state changed
    2006-12-10 16:00:05.359375 [Info.][7]: Recorder: Card:Hauppauge PVR500MCE (a) idle
    2006-12-10 16:00:05.359375 [Info.][7]: Recorder: Card:Hauppauge PVR500MCE (b) recording tv channel:BBC2 London & South East

    And the corrsponding section from Mediaportal logfile, which shows the plugin picked up -1 as the card, so just reported and did nothing.

    2-10 15:58:03.812500 [Info.][7]: Recorder: Send announcement for recording:Record once Ski Sunday on BBC2 London & South East from 10/12/2006 16:00 - 10/12/2006 16:45
    2006-12-10 15:59:00.031250 [Info.][MPMain]: ###C.All logged property #time = 15:59
    2006-12-10 16:00:00.031250 [Info.][MPMain]: ###C.All logged property #time = 16:00
    2006-12-10 16:00:03.828125 [Info.][7]: Recorder: time to record 'Ski Sunday' on channel:BBC2 London & South East from 16:00:00-16:45:00 id:36 priority:0 quality:NotSet Once
    2006-12-10 16:00:03.828125 [Info.][7]: Recorder: program:16:00:00-16:45:00
    2006-12-10 16:00:03.828125 [Info.][7]: Recorder: using card:Hauppauge PVR500MCE (b) prio:1
    2006-12-10 16:00:03.828125 [Info.][7]: TVCapture.Record() Card:2 Ski Sunday on BBC2 London & South East from 16:00:00-16:45:00
    2006-12-10 16:00:03.828125 [Info.][7]: TVCapture.StartTimeShifting() Card:2 :BBC2 London & South East
    2006-12-10 16:00:03.828125 [Info.][7]: vmr9:Dispose
    2006-12-10 16:00:03.828125 [Info.][7]: SinkGraph:confused:tartTimeShifting()
    2006-12-10 16:00:03.843750 [Info.][MPMain]: WinLirc HWND is invalid. Check WinLirc is running
    2006-12-10 16:00:03.843750 [Info.][MPMain]: MCEReplacement: Tune External Channel: 102, Tuner card: -1
    2006-12-10 16:00:03.843750 [Info.][7]: SinkGraph:TuneChannel() tune to channel:250000 country:31 standard:None name:BBC2 London & South East
    2006-12-10 16:00:03.843750 [Info.][MPMain]: MCEReplacement: ProcessExternalChannel() Index was outside the bounds of the array.
    2006-12-10 16:00:03.843750 [Info.][MPMain]: MCEReplacement: Failed to process external channel request
    2006-12-10 16:00:03.843750 [Info.][7]: Twinhan: check for twinhan driver
    2006-1

    Second test.
    Live TV - channel SkyOne (106) Card 1
    Schedule recording BBC 1 Card 2 at 16:25

    This is the recorder logfile, again right channel/card chosen.


    2006-12-10 16:23:21.765625 [Info.][7]: Recorder: Send announcement for recording:Record once Robin Hood on BBC1 London & South East from 10/12/2006 16:25 - 10/12/2006 17:10
    2006-12-10 16:25:21.765625 [Info.][7]: Recorder: time to record 'Robin Hood' on channel:BBC1 London & South East from 16:25:00-17:10:00 id:36 priority:0 quality:NotSet Once
    2006-12-10 16:25:21.765625 [Info.][7]: Recorder: program:16:25:00-17:10:00
    2006-12-10 16:25:21.765625 [Info.][7]: Recorder: using card:Hauppauge PVR500MCE (b) prio:1
    2006-12-10 16:25:23.312500 [Info.][7]: Recorder: recording started 'Robin Hood' on channel:BBC1 London & South East from 16:25:00-17:10:00 id:36 priority:0 quality:NotSet
    2006-12-10 16:25:23.312500 [Info.][7]: Recorder: recording state changed
    2006-12-10 16:25:23.328125 [Info.][7]: Recorder: Card:Hauppauge PVR500MCE (a) timeshift tv channel:confused:ky One
    2006-12-10 16:25:23.328125 [Info.][7]: Recorder: Card:Hauppauge PVR500MCE (b) recording tv channel:BBC1 London & South East
    2006-12-10 16:25:23.328125 [Info.][7]: Recorder: currently playing:E:\TV\card1\live.tv pos:E:\TV\card1\live.tv/836.3730417

    And the corrersponding section from Mediaport logile file showing up to a point the right card was chosen but incorrect by the time it gets to the plugin, this results in the recoding being started and the external command called but for card 1

    2006-12-10 16:25:21.765625 [Info.][7]: Recorder: time to record 'Robin Hood' on channel:BBC1 London & South East from 16:25:00-17:10:00 id:36 priority:0 quality:NotSet Once
    2006-12-10 16:25:21.765625 [Info.][7]: Recorder: program:16:25:00-17:10:00
    2006-12-10 16:25:21.765625 [Info.][7]: Recorder: using card:Hauppauge PVR500MCE (b) prio:1
    2006-12-10 16:25:21.765625 [Info.][7]: TVCapture.Record() Card:2 Robin Hood on BBC1 London & South East from 16:25:00-17:10:00
    2006-12-10 16:25:21.765625 [Info.][7]: TVCapture.StartTimeShifting() Card:2 :BBC1 London & South East
    2006-12-10 16:25:21.781250 [Info.][7]: vmr9:Dispose
    2006-12-10 16:25:21.781250 [Info.][7]: SinkGraph:confused:tartTimeShifting()
    2006-12-10 16:25:21.781250 [Info.][7]: SinkGraph:TuneChannel() tune to channel:250000 country:31 standard:None name:BBC1 London & South East
    2006-12-10 16:25:21.781250 [Info.][7]: Twinhan: check for twinhan driver
    2006-12-10 16:25:21.781250 [Info.][7]: FixCrossbarRouting: use tuner:False use cvbs#1:False use cvbs#2:False use svhs:True use rgb:False
    2006-12-10 16:25:21.781250 [Info.][7]: Find crossbar:#1
    2006-12-10 16:25:21.781250 [Info.][7]: crossbar found:1
    2006-12-10 16:25:21.781250 [Info.][7]: crossbar has 8 inputs and 2 outputs
    2006-12-10 16:25:21.781250 [Info.][7]: check:in#0->out#0 / Video_Tuner -> Video_VideoDecoder
    2006-12-10 16:25:21.781250 [Info.][7]: check:in#2->out#0 / Video_SVideo -> Video_VideoDecoder
    2006-12-10 16:25:21.781250 [Info.][7]: connect
    2006-12-10 16:25:21.812500 [Info.][MPMain]: WinLirc HWND is invalid. Check WinLirc is running
    2006-12-10 16:25:21.812500 [Info.][MPMain]: MCEReplacement: Tune External Channel: 101, Tuner card: 0
    2006-12-10 16:25:21.812500 [Info.][MPMain]: MCEReplacement: Launching program D:\Program Files\Team MediaPortal\MediaPortal\sky-control-usb.exe
    2006-12-10 16:25:21.953125 [Info.][7]: connect success





    Hi Trevor,

    I've built your No Window change into my local copy of the plugin and will include it in the next release of the plugin. I've also fixed the array index problem you're having. I've attached a modified plugin dll (SVN version only) to this post, can you try it out for me and let me know how you get on?

    You'll need to redo your existing program launching commands because I've added the No Window option.

    @Zombiepig:
    Try the attached plugin too, it should solve the problem with the skin button to blast ir codes stuff... You know what i'm talking about ... If you're using external apps in the plugin anywhere then you'll need to redo those commands like I mentioned above to Trevor. Let me know how you get on.

    Thanks,
     

    and-81

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

    After a bit of poking around I've found it's a bug in MediaPortal's recording scheduler. It's not setting the tuner card for the external tune command to use. So your guess was right!

    If you look at this code from my plugin you can see that the log entry with the "-1" tuner card is getting that number straight out of the "Tune External Channel" message:

    void OnMessage(GUIMessage msg)
    {
    if (ControlExternalEnabled && msg.Message == GUIMessage.MessageType.GUI_MSG_TUNE_EXTERNAL_CHANNEL)
    {
    if (LogVerbose)
    Log.Info("MCEReplacement: Tune External Channel: {0}, Tuner card: {1}", msg.Label, msg.Label2);

    This means MediaPortal itself is reporting the card to be -1, and there's nothing I can do with that!

    If you look at the code in "MultiCardBase" in MediaPortal you'll see how it generates the "Tune External Channel" message in "TuneExternalChannel(string channelName, bool isViewing)" ...

    GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_TUNE_EXTERNAL_CHANNEL, 0, 0, 0, 0, 0, null);
    msg.Label = chan.ExternalTunerChannel;
    msg.Label2 = _currentCardIndex.ToString();
    GUIWindowManager.SendThreadMessage(msg);

    Earlier in "MultiCardBase" we can see that "_currentCardIndex" is initialised as "-1" ...

    protected int _currentCardIndex = -1;

    Looking at the MediaPortal's recording scheduler's code (TVCapture\Scheduler\Scheduler.cs) it looks like the scheduler isn't setting the card to record from and so the default value of -1 (or whatever the last value set was) is being used.

    Do you want to file a bug report for this? I'm about to head off for a few days.

    Thanks for your help!

    Cheers,
     

    trevor

    Portal Pro
    October 17, 2006
    1,601
    952
    Chelmsford
    Home Country
    United Kingdom United Kingdom
    Aaron,

    That was problem, I had gone through the code so it was an educated guess.

    Fixed it by adding one line to Scheduler.cs.
    This

    //finally start recording...
    handler.TuneExternalChannel(rec.Channel,false);
    card.Record(rec, currentProgram, iPreRecordInterval, iPostRecordInterval);

    to This

    //finally start recording...
    handler.CurrentCardIndex = cardNo; // Set chosen card
    handler.TuneExternalChannel(rec.Channel,false);
    card.Record(rec, currentProgram, iPreRecordInterval, iPostRecordInterval);



    in the process of testing the mod before either reporting it as a bug or uploading a patch, the best bit of this is I now have a system that fully works as I want and would not have been possible without your plugin and that no windows mod - thanks.

    Now settle down and actually enjoy the dam thing!

    Trevor
     

    VdR

    MP Donator
  • Premium Supporter
  • October 17, 2006
    612
    16
    Belgium
    Home Country
    Netherlands Netherlands
    And-81,

    I can see that you have many other issues on your plate and are being helpful as ever. So to add one:

    I'm using the message plugin together with HIP. Would it be possible to have the message plugin cancel the screen saver when a button on the remote is pressed (i.e. a message received)? Maybe this should be a configurable option.

    I find myself walking to the keyboard to give the trackball a swirl every time when the screensaver is on and I want to use the remote.

    Thx,

    VdR
     
    Status
    Not open for further replies.

    Users who are viewing this thread

    Top Bottom