Support » Plugin: podPress » XML-RPC support?

  • Resolved darkelink


    I am currently trying to make a program that automatically adds new posts. I was wondering if it possible to create a post with podPress support using the XML-RPC interface. If it is, is it a case of adding custom_fields to the wp.NewPost method, or do I have to call a new method?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ntm


    I*m not very familiar with this interface and I’m not sure whether the original author of this plugin has built-in full support for this interface. There are some functions in the podpress.php and podpress_class.php files regarding this technique. But I have not tested them so far and they are approx. 4 years old. It would not surprise me if they don’t work any mor with the current version of WP. But I’m sure.

    That is what I can say so far.

    I have had a look at the source, not knowing much php myself makes it very difficult. It looks like the xmlrpc functions that already exist do not have any hooks to call them and only work for a really old version of WordPress. I have also discovered that I can call any function and pass arguments by adding some code to podpress.php:

    add_filter('xmlrpc_methods', 'add_new_xmlrpc_methods');
    function add_new_xmlrpc_methods( $methods ) {
    	$methods['podPress.DoSomething'] = 'DoSomething';
    	return $methods;

    This will allow me to call the function DoSomething from my client. This only leaves me to figure out what function(s) I should call.

    I’m guessing it would be easier to create a post using WordPress native functions, then call another function from podPress to add media to it. However I don’t completely know how this plugin works, so what function(s) would I need to call to add media to an existing post?

    Plugin Author ntm


    The function which adds the file to the post is post_edit in podpress_admin_class.php. But I would say it is not easy call that function other then the usual way. But you can see what it does: it recieve the meta data an hands them to podPress_add_post_meta (podpress_function.php). This function adds entries to the wp_postmeta db table. It uses the meta_keys _podPressMedia and _podPressPostSpecific . The first one contains all the informations about the media file. If this entry exists then podPresss will add it to the post on the blog pages.
    That es why should probably try to create such wp_postmeta entries with a custom function.

    the structure of the wp_postmeta entries is meta_id, post_id, meta_key and meta_value. meta_id is an index. post_id is the ID number of the post. meta_key is _podPressMedia and _podPressPostSpecific (for the podPress data) and meta_value is in these to cases a serialized array.
    The _podPressMedia meta_value array has this structure:

    	0 => Array(
    		"URI" => "http://... .mp3",
    		"title" => "",
    		"type" => "audio_mp3",
    		"size" => 76292598,
    		"duration" => "158:57",
    		"previewImage" => "http:// ... /images/vpreview_center.png",
    		"dimensionW" => 320,
    		"dimensionH" => 3,
    		"rss" => "on",
    		"atom" => "on")
    	1 => Array(
    	n => Array(

    (Size is in byte and the duration value needs to be in one of the suggested formats)
    If you have such an array you could give it to podPress_add_post_meta (podpress_functions.php). It will serialize the array and add the wp_postmeta entry.

    Thanks for the help, I am happy to say I have got it working. All that needs to be changed is in podPress.php:

    Add to the podPress_class_init function:

    add_filter('xmlrpc_methods', 'add_new_xmlrpc_methods');

    and then add two new functions:

    function add_new_xmlrpc_methods ($methods) {
        $methods ['podPress.addNewXmlrpcPost'] = 'addNewXmlrpcPost';
        return $methods;
    function addNewXmlrpcPost ($args) {
        $xmlPostID = (int) $args[0];
        $xmlContent = $args[1];
        podPress_add_post_meta($xmlPostID, '_podPressMedia', $xmlContent, true);

    Then data can be added by just calling RPclient.execute(“podPress.addNewXmlrpcPost”, params); on the client where params is an array: [int PostID, Hashtable xmlContent] and xmlContent has the structure that you have shown above.

    Obviously this is very limited, but it does what I need it to do. I am also amusing all checks to make sure the data is correct is happening client side.

    It looks like the already existing function (xmlrpc_post_addMedia in podpress_class.php) tries to achieve the same aim, but it expects a php style array as input and you can’t pass those via xml-rpc so there was no way successfully to call it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘XML-RPC support?’ is closed to new replies.