making flickr's "blog this" work with mephisto

marcus • September 7th, 2007

this article refers to mephisto edge release 2983

i noticed this afternoon that i wasn’t able to configure my new flickr account to accept this blog for its “blog this” feature. digging down into mephisto’s logs, i was able to get it working by adding only a couple of things in vendors/plugins/mephisto_xmlrpc ...

since i have no clue how to create a proper patch-file, i wrote a little step by step guide detailing the changes:

in backend_controller.rb add a new web-service description (because flickr identifies itself as blogger)

web_service(:blogger)    { MetaWeblogService.new(self)  }

in meta_weblog_api.rb add the missing getUsersBlogs method definition:

# get a list of blogs that a user can access
api_method :getUsersBlogs,
   :expects => [ {:appkey => :string}, {:username => :string}, {:password => :string} ],
   :returns => [[MetaWeblogStructs::Blog]]

create a new file struct /vender/plugins/mephisto_xmlrpc/meta_weblog_structs/blog.rb

module MetaWeblogStructs
  class Blog < ActionWebService::Struct
    member :blogName,   :string
    member :blogid,     :string
    member :url,        :string
    member :isAdmin,    :boolean
  end
end

and finally don’t forget to add the actual method implementation in meta_weblog_service.rb

  def getUsersBlogs(appkey, username, password)   
    user = User.find_by_login(username)
    return if user.nil?

    blogs = Array.new

    for site in user.sites
      isAdmin = false
      for membership in user.memberships
        isAdmin = true if membership.site === site    
      end

      blogs << MetaWeblogStructs::Blog.new(
        :blogName => site.title,
        :blogid => site.id,
        :url => "http://#{site.host}",
        :isAdmin => isAdmin
      )
    end

    return blogs
  end

You should be now able to add your mephisto blog as a “MetaWeblogAPI enabled Blog” to your flickr account and start posting!

Tags

+hacks +ruby
3d 4-space abstract aesthetic system aesthetics algorithm alien ambient ambisonics animation architecture art artificial audio audio research black&white book caskets classic clicks & cuts code color computer-vision conceptual art consoles cpp culture ddr design devices digtial fabrication documenta documentation drawing dynamics electricity electromagnetism electronics environment event exhibition experimental exploration fashion festival film flocking folk food fractal furniture gamedev generative genetic geometry glitch graphic hacks haptics hardware history hyperspace ideas illustration images inspiration installation instrument intelligence interactive interieur japan java knowledge management landscape library life light liquid live london math micro minimal modernism monochrome motion motion graphics multiples music naming nature nervous ink networked networking opensource osx painting paper particles performance personal photography physics playful politics press print processing processing.org programming quotes recipes research retro romance ruby scripts sculpture SENDUNG.net shopping snippets social software sound space space exploration craft space exploration craft orbiter supercollider swiss systems technology theory theremin toys transformed travel tricks typography universe video visual vj water web2.0 xcode