MediaPortal Automation

Discussion in 'MediaPortal 1 Plugins' started by JDWestoby, February 10, 2012.

  1. JDWestoby
    • Premium Supporter

    JDWestoby MP Donator

    Joined:
    April 9, 2008
    Messages:
    265
    Likes Received:
    30
    Gender:
    Male
    Occupation:
    Software Developer
    Location:
    Poltimore, Devon
    Ratings:
    +32 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    Automation MediaPortal Process Plugin
    =====================================

    This plugin enables MediaPortal to be driven by anything that can send strings
    over TCP/IP sockets. it expects vertical home, alhtough you >could< drive Titan with it.

    A response is sent (but can be ignored) and anything that does not end with a '!'
    has succeeded.


    The general format of the string sent is -
    <Request Opt="Arg"/>

    Opt is one of -
    Command, Key, Press, Run, Screen

    Arg depends on the Opt.


    Command Args -
    Quit - closes the connection cleanly
    Store - saves subsequent requests until a Quit received


    Key are just the remote button keys, Args -
    Back, Down, Enter, Home, Left, Mute, OK, Pause,
    Play, record, Resume, Return, Right, Stop, Up,
    Volume Down, Volume Up

    Press Arg is the label on the button (on the currently active screen)
    to press. If the button does not exist it is a no-op.


    Run allows running a named stored sequence or an external Bat/Cmd file.



    The path to the Bat/Cmd file is an option in the configuration
    screen (More/F9 while on New button).


    Screen is similar to Press but here the button is the name of a
    top-level menu option.


    To use, just send the XML fragments that correspond to the action
    you would do if you were using the remote control
    with some additional functionality.


    For example sending -
    <Request Screen="TV"/>
    <Request Press="Channel"
    <Request Press="BBC One"

    Will turn on the TV to BBC One.

    Note that it does not matter what TV Group 'BBC One' is in, it will
    find the channel regardless.


    (ASIDE - I use this to use MediaPortal as a clever Clock Radio driven by HomeSeer. The commands I send are -
    Screen="Internet Radio"
    Press="Radio 2"
    Screen="Clock"
    Press="Bright"
    Because it is driven by HomeSeer it copes with GMT/BST switchover, ignoring weekends etc.)

    It is possible to test this using Telnet or the Automator plugin.

    The default port number is 6573 (can be changed using the
    Automator windows plugin, see below).





    Automator MediaPortal Windows Plugin
    ====================================

    This windows plugin provides a way to test and demonstrate
    the use of the Automation Process plugin from within
    MediaPortal.

    It can drive both itself and a remote MediaPortal
    (as long as the Automation plugin is installed).

    It allows the Automation plugin options to be changed
    from inside MediaPortal (requires a restart).


    The main screen has just a New button, this allows a
    named automation sequence script to be created.

    Pressing More/F9 while on New brings up the Automation
    configuration screen.

    Here there are two options
    Port - port on which the automation plugin listens
    Path - path to any external Bat/Cmd files

    Save - saves the changes


    The [New] script window has buttons for -
    Name - just identifies the sequence
    Host/Port - for driving a remote MP Automation plugin
    Description - just a reminder shown at the bottom of the main screen
    List entries - for entering Opt="Arg" part of the request

    Click on any of these to bring up an on-screen keyboard and
    enter/change the values.

    There is no need to enter the Command="Store", Command="Quit"
    requests as these are automatically added when the requests
    are sent.


    When finished, press Save, this stores it in the Automation
    options file. (There is also a Delete button allowing unwanted
    script sequences to be deleted.)

    This will return to the main screen where the new script is
    now in the list.

    Pressing the list button will execute the script.

    Moving onto the list and pressing More/F9 will return to the
    script window allowing changes to be made or the sequence to
    be deleted.




    Installation
    ============


    Download, unzip and run (as Administrator on Win7) SetUp.Cmd.
    SetUp is designed for XP/Win7 and (should) pick up paths and the skin automatically.
     

    Attached Files:

    Last edited: August 2, 2013
    • Like Like x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. johanj
    • Premium Supporter

    johanj Well-Known Member

    Joined:
    January 31, 2009
    Messages:
    781
    Likes Received:
    270
    Gender:
    Male
    Ratings:
    +398 / 1
    Home Country:
    Sweden Sweden
  4. JDWestoby
    • Premium Supporter

    JDWestoby MP Donator

    Joined:
    April 9, 2008
    Messages:
    265
    Likes Received:
    30
    Gender:
    Male
    Occupation:
    Software Developer
    Location:
    Poltimore, Devon
    Ratings:
    +32 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    (I actually looked at that and MPClientController (which iPiMP uses) before I worked out what I actually wanted.)


    Anyway, answer -

    Because that doesn't know how to press buttons.


    More precisely it doesn't know WHAT button it is pressing.

    With this, you ask it to press "BBC ONE" and it finds it and presses it.

    Try doing that blind with anything else!

    That's why this is for automation - another computer can't look at the screen and say "oh, I need to go up" - you can.



    I've said that I use HomeSeer, but the truth is anything that sends massages could run this.
    Even bland old telnet can now turn on the Radio/TV onto the correct station (just give it an input file of commands to send).

    Literally I can GUARANTEE that the following will tune to 'BBC Radio One' on my set up

    <Auto Screen="Radio"/>
    <Auto Press=".."/>
    <Auto Press="FreeView Radio"/>
    <Auto Press="BBC Radion One"/>
     
  5. johanj
    • Premium Supporter

    johanj Well-Known Member

    Joined:
    January 31, 2009
    Messages:
    781
    Likes Received:
    270
    Gender:
    Male
    Ratings:
    +398 / 1
    Home Country:
    Sweden Sweden
    Hi

    It still feels like doing things in the blind, how do you know that the EPG is showing? It will take some time after a jump to a specific screen. The time to change screen will depend on the computer specs.

    You can retrieve all channels and their id with MPExtended TAS and then use WifiRemote to start a channel with a specific id. One do not need to be on a specific screen in MediaPortal to start the channel.

    I have not used HomeSeer myself and do not know it's limitation, maybe your way is the most straight forward.

    Cheers,

    Johan
     
  6. JDWestoby
    • Premium Supporter

    JDWestoby MP Donator

    Joined:
    April 9, 2008
    Messages:
    265
    Likes Received:
    30
    Gender:
    Male
    Occupation:
    Software Developer
    Location:
    Poltimore, Devon
    Ratings:
    +32 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    If you don't think it's worth looking at, fine.

    I KNOW there are limitations with how to drive MediaPortal - this effectively presses keys for you, that's about it.

    (Trust me. I never managed to get a TV channel to play for more than a few seconds using program calls - so it's doing something I don't understand in the background)

    You work out on YOUR system what you want to do and then duplicate it with the TCP/IP calls. No direct programming required.

    Don't worry about how it does things - do you care that MP starts up things called graphs when you watch TV? Or that the same player (g_Player) is used for Radio? Probably not.

    This solves a problem that ISN'T addressed.

    IT is not possible to ask MP to start up a specific TV channel without a lot of clever programming (and as mentioned above not always even then)


    It may not be the best solution, although until MP has this functionality built-in I can't see anything that does what this does.


    Heck, install it if you want to, try it and it it falls over - >then< complain.

    All I can say is that this does something that ISN'T 'out there', that means I can now turn a £200 netbook in to a £20 clock radio :D.

    I'd issue a challenge to duplicate this capability but that sounds too confrontational - I'm not trying to be 'in your face', honest.

    SO, Can you do/Do you know of anything that does what this does?

    No, thought not.

    Oh, just about to update it because the TV groups now work OK, even although it is using a 5 second delay rather than knowing that the [Channel] table has updated.

    Mute etc. all work now too!
     
  7. johanj
    • Premium Supporter

    johanj Well-Known Member

    Joined:
    January 31, 2009
    Messages:
    781
    Likes Received:
    270
    Gender:
    Male
    Ratings:
    +398 / 1
    Home Country:
    Sweden Sweden
    I just wanted to help you by pointing at existing plug-ins that can do control MP in a really nice way. I apologize if you interpreted my post differently. I will not bother you any more.

    I use both WifiRemote and MPExtended a lot in the development of a remote control for application for iPad called EVE.


    Good luck with your plug-in, I'm sure that someone will find it useful.

    Cheers,

    Johan
     
  8. JDWestoby
    • Premium Supporter

    JDWestoby MP Donator

    Joined:
    April 9, 2008
    Messages:
    265
    Likes Received:
    30
    Gender:
    Male
    Occupation:
    Software Developer
    Location:
    Poltimore, Devon
    Ratings:
    +32 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    Nothing can do this.

    Johan has (very nicely, patiently and kindly) been trying to show me that what I done is already there (in the various remote plugins).

    But I don't think this is the case.

    There is nothing that allows automating MP using simple commands - only extensive programming.
    (Try driving iPiMP [which uses MPClientController] by code. You'll need to learn/use JSON)


    If there were why isn't there (the reason I started this) a 'clock radio'?


    I have a simple clock plugin and I could add code to [try] to play the radio, but why bother?
    (I did try/manage to do this but it would only play for a few seconds and then stopped, heartbeat wasn't the problem but never did find out what was wrong.)

    Anyway, this is solving the wrong problem.


    Far better to have a button pushing robot - which is what this is.

    (I trundled through the MP source and guess what - it does a SendKeys.SendWait too, so all I've done is duplicate what MP does but in a way that is accessible from the 'outside'.)


    So, work out what buttons to press to achieve what you want and then replicate it in simple '<Auto...' telnet/socket calls.

    Now this can be done from another PC (hence automation)
    OR
    from the same PC (now my radio clock is trivial).

    I don't have to write media handling code (which I freely admit I can't do), just a few simple button pushes.

    If someone can show me a clock radio (not the one that plays a media file) then I'll still say this is better because I can change my 'clock radio' into a 'clock tv' or a 'clock media' or 'clock recording' by changing the calls - trivially!

    No heavy lifting required.

    I have now got easy access to anything that MP can do

    I repeat, all this does is press the right button.
     
  9. FreakyJ
    • Team MediaPortal

    FreakyJ Development Group

    Joined:
    July 25, 2010
    Messages:
    4,021
    Likes Received:
    839
    Gender:
    Male
    Ratings:
    +1,424 / 1
    Home Country:
    Germany Germany
    AW: MeadiaPortal Automation

    you're in MP2 section ;) Moved to MP1 section^^
     
  10. vuego
    • Team MediaPortal

    vuego Documentation Group

    Joined:
    August 5, 2006
    Messages:
    1,568
    Likes Received:
    658
    Occupation:
    Alchemist, Astrobiologist, Exotic dancer
    Location:
    Göteborg
    Ratings:
    +865 / 0
    Home Country:
    Sweden Sweden
    Show System Specs
    Hey James, this looks like it could be a powerful plugin together with an EventGhost plugin.

    I'm currently using Message Plugin for MP1.2 to control MP from EG and it's basically just pressing buttons. However it seems your plugin is more configurable and could make for example a button on my remote start playing a certain TV channel.

    If you haven't already, perhaps take a minute to check out EventGhost :)
     
  11. JDWestoby
    • Premium Supporter

    JDWestoby MP Donator

    Joined:
    April 9, 2008
    Messages:
    265
    Likes Received:
    30
    Gender:
    Male
    Occupation:
    Software Developer
    Location:
    Poltimore, Devon
    Ratings:
    +32 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    Netbook as the room IT
    ======================
    For me, this is initially to replace a clock radio with a MP netbook and a simple clock plugin.
    My home automation system (HomeSeer) currently turns on a separate radio at the right time.
    But using MediaPortal and this plugin (and a simple, dimmable, clock plugin I wrote), I replaced this and the clock with a netbook.
    Now HomeSeer can -
    turn on the radio or tv
    dim the clock at night
    turn if off a few minutes after lights off
    show the time on movement*

    This serves as the single point of IT in the room.
    Use bigger/better speakers/TV as necessary.

    (*Also uses the netbook webcam as a security camera,
    recording when there is movement and the house is vacant.)
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!