MediaCoder XML-RPC API (Stanley posted on February 24th, 2008 )

Since 0.6.1.4060, MediaCoder comes with XML-RPC APIs through which MediaCoder can be controlled by any XML-RPC client both locally and remotely. The APIs are not yet finalized, here lists some of them and you can see their effects right now.




mc.prefs.get(string key)

  • Function: retrieving the value of a parameter
  • Parameter: parameter path
  • Return value: value of the parameter (string/int/double/boolean)


mc.prefs.set(string key, string/int/double/boolean value)

  • Function: retrieving the value of a parameter
  • Parameter 1: parameter path
  • Parameter 2: parameter value
  • Return value: successful or not (boolean)

=


mc.queue.get(int index)

  • Function: retrive information of an item in the queue
  • Parameter: 0-based index
  • Return value:
    information of the requested item (structure)

    • filename (string)
    • filesize (int)
    • duration (int)
    • begin (int)
    • end (int)


mc.queue.add(string filename, int index)

  • Function: retrieving the value of a parameter
  • Parameter 1: file name
  • Parameter 2: index for insertion in the queue, -1 for appending, -2 for clear before adding
  • Return value: successful or not (boolean)


ui.dialogs.showTime()

  • Function: show time dialog
  • Return value: successful or not (boolean)


ui.dialogs.showCropper()

  • Function: show cropper dialog
  • Return value: successful or not (boolean)


ui.dialogs.showMain(boolean shown)

  • Function: show/hide main window
  • Parameter: whether to show or to hide
  • Return value: successful or not (boolean)


ui.jobs.start()

  • Function: start jobs
  • Return value: successful or not (boolean)


ui.jobs.stop()

  • Function: stop jobs
  • Return value: successful or not (boolean)


COMMENTS: 10 Comments »

10 Responses

  1. SirAuron says:

    Does that mean I could remote control MediaCoder via the internet or from another server?

    When there is a guy (even if its simple) I will be sure to try it out.

  2. Zoominla says:

    Nice,so quick!
    Is XML-RPC API out already or until build 4060 ?
    The current version is 4050.

  3. Zoominla says:

    I tried the build 4050, there is no response.

  4. stanley says:

    To SirAuron: Yes, as long as MediaCoder is configured to listen on the correct NIC/IP address.

  5. nelson says:

    This is really cool! But it seems there is a bug somewhere in the mc.queue.add method. I sent the following message to it:

    mc.queue.add

    d:\movies\13th Warrior.avi
    -1

    And the return code was ‘1’, meaning that it was ok. However, the movie won’t show up in the GUI until I restart MediaCoder. As soon as I restart it, the movie is there, and then I can start the conversion.

    I’m using build 4100, and I’ve used ‘curl’ to send the xml-rpc method call to MC (via the ‘-d @-‘ switch and redirecting the stdin to a text file containing the xml message).

  6. stanley says:

    The UI is not refreshed in time after the xmlrpc request is made. But the file is really added. I will fix this later.

  7. nelson says:

    You’re right, the movie was added (hence it showed upon restart), however I could not add the movie to the queue AND start the conversion right on, because MC thought the queue was still empty upon receiving the ‘ui.jobs.start()’ call.

  8. nelson says:

    This is still not working properly… I add a movie with mc.queue.add(), but ui.queue.start() does not work, saying that the queue is empty… The ‘refresh’ problem makes this (great) feature pretty much useless, since you have to restart MC manually for the queue to be refreshed.

  9. nelson says:

    As of 0.6.1.4166, this has not been corrected yet. However, new features are implemented all the time. I would prefer that MC had fewer features, but less bugs.