« Tomcat Management: Jmx4Perl Makes it Easier | Main | Link: Perl – How to install Perl module using CPAN shell »

09/09/2009

Bling v0.3 Released - Groovy-Based Blog Ping Tool

Bling v0.4 is out. Check out the main bling page for more information.

I have released version 0.3, a new update for Bling, which brings the endpoint count up to 21 from the 17 that were included with v0.2.  Services added in this release include Twingly, WeBlogALot, Spinn3r, PostRank, and WasaLive.  WeBlogALot has a provisional status as my pings don't seem to work but I have not been able to tell if the WeBlogALot directory is still active or not.  

Ping-O-Matic has been removed from the script as well because most of the services that ping-o-matic pings are already included in Bling.

The other change included in this script is additional traps for IO Exceptions.  The script will no longer halt unexpectedly if HTTP errors are encountered with any of the endpoints.  

Please let me know what you think of this script.  Source code is below and you can download compressed copies of the script from the Downloads page.  The main Bling page has a complete version history and other information on this tool.

#!/usr/bin/env groovy
/* bling.groovy - Written by Chris Mahns. 
 http://blog.techstacks.com/

You will need to modify the values for 
blogTitle and blogURL so that they match 
your own blog info.

This script pings 21 different blog 
directories. Run it after you 
update your blog.

v0.1 Initial release targeting 18 services.

v0.2 Reworked the output so that everything 
  is nice and lined up. Added basic 
  exception handling when service responds 
  with a connection refused. 
  
  Also added logic branch so that if the
  service responds with an error, I now 
  just display a generic 'ping failed' error. 
  
  Removed TopicExchange as a service
  so now there are only 17 services getting 
  pinged.

v0.3 Added trap for IOException.

  Added Twingly

  Added WeBlogALot (but it might not last long)

  Added Spinn3r

  Added PostRank

  Added WasaLive

  Removed Ping-o-Matic. Ping-o-matic pings
  all of the same services this script 
  already pings.

To-Do: Add some kind of debug option. 
  Add additional exception catches.
*/

import groovy.net.xmlrpc.*
import groovy.util.slurpersupport.GPathResult

// You'll want to make this next section your own
def blogTitle = "YOUR_BLOG_TITLE_HERE"
def blogURL = "YOUR_BLOG_URL_OR_FEED_URL_HERE"

// Set up a map (hash) of popular rpc endpoints
// It is too bad for my syntax highlighter, but some of 
// the blogs containing periods in their names necessitated
// placing them in quotes. 

def trackbacks = [
 'Google':  'http://blogsearch.google.com/ping/RPC2',
 'Weblogs':   'http://rpc.weblogs.com/RPC2',
 FeedBurner:  'http://ping.feedburner.com/',
 Moreover:   'http://api.moreover.com/RPC2',
 'Syndic8':   'http://ping.syndic8.com/xmlrpc.php' ,
 BlogRolling:  'http://rpc.blogrolling.com/pinger/',
 Technorati:  'http://rpc.technorati.com/rpc/ping' ,
 PingoMatic:  'http://rpc.pingomatic.com/',
 NewsGator:  'http://services.newsgator.com/ngws/xmlrpcping.aspx',
 Bloglines:  'http://www.bloglines.com/ping',
 'Blo.gs':  'http://ping.blo.gs/',
 BlogCatalog:  'http://rpc.blogcatalog.com/',
 'PubSub':  'http://xping.pubsub.com/ping/',
 'MyBlog.jp':  'http://ping.myblog.jp/',
 'Goo\t':   'http://blog.goo.ne.jp/XMLRPC',
 BlogPeople:  'http://www.blogpeople.net/servlet/weblogUpdates',
 Twingly:   'http://rpc.twingly.com/',
 WeBlogALot:  'http://ping.weblogalot.com/rpc.php',
 Spinn3r:   'http://rpc.spinn3r.com/open/RPC2',
 PostRank:   'http://api.postrank.com/v2/ping',
 WasaLive:   'http://www.wasalive.com/ping/',
 ]

// Set up canned responses to make the outputted responses nicer.
// Previously, the output used the literal response from the endpoint
// which did not look all that nice in a terminal window.
def weal = "Thanks for the ping!"
def woe = "PING ATTEMPT FAILED."

// IceRocket is separate because their ping method call
// is different from everyone else's--go figure...


// Here is the section responsible for iterating through each ping
// url in the trackbacks map.

println "====PING RESULTS===="

try{
 def icerocketURL = 'http://rpc.icerocket.com:10080/'
 def icerocketServer = new XMLRPCServerProxy(icerocketURL)
 resp = icerocketServer.ping(blogTitle, blogURL)
 resp.data instanceof GPathResult

 if (!resp.flerror) 
 println " Icerocket\t${weal}"
 else
 println " IceRocket\t${woe}"

}catch(ConnectException ex){
 println " IceRocket\t${woe}" 
}catch(IOException ex){
 println " IceRocket\t${woe}"
}

trackbacks.each {
 try{
 def url = it.value
 def proxy = new XMLRPCServerProxy(url)
 response = proxy.weblogUpdates.ping(blogTitle, blogURL)
  response.data instanceof GPathResult

 if (!resp.flerror)
  println " ${it.key}\t${weal}"
  else
  println " ${it.key}\t${woe}"

 }catch(ConnectException ex) {
  println " ${it.key}\t${woe}"  
 }catch(IOException ex){
  println " ${it.key}\t${woe}"
 }
  
 
}

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a01156fbc6fe6970c0120a55ad222970b

Listed below are links to weblogs that reference Bling v0.3 Released - Groovy-Based Blog Ping Tool:

Comments