Advertisement
Guest User

Untitled

a guest
May 1st, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # encoding: UTF-8
  2. # call like: ruby script.rb <filename>
  3. require 'xmlrpc/client'
  4.  
  5. $filename = ARGV[0]
  6.  
  7. # build a post
  8.  
  9.  
  10.  
  11. post = {
  12.   'title'       =>  $filename,
  13.   'description' => " [video][track kind=\"captions\" src=\"http://127.0.0.1/#{$filename}\" srclang=\"en\" label=\"English\" default=\"true\"][/video]",
  14.   'mt_keywords' => ['a', 'list', 'of', 'tags'],
  15.   'categories'  => ['a', 'list', 'of', 'categories']
  16. }
  17.  
  18. # initialize the connection
  19.  
  20. connection = XMLRPC::Client.new('127.0.0.1', '/xmlrpc.php')
  21.  
  22. # make the call to publish a new post
  23.  
  24. connection.call(
  25.   'metaWeblog.newPost',
  26.   1,
  27.   'root',
  28.   'root',
  29.   post,
  30.   true
  31. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement