Sha256: 704b0679069e302e43e7f285035925b5a4db3efd3781e716b87eb58cb4ed041f

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

class Muri
  module Filter
    module Picasa

      private
      PICASA_PHOTO = 'photo'
      
      def self.included(base)
        base.class_eval do
          self::PARSERS[Muri::Filter::Picasa] = "picasa_parse"
        end
      end

      def self.parsable?(uri)
        uri.host =~ /^(www\.)?picasaweb\.google\.com$/i
      end

      def picasa_parse
        self.media_service = PICASA_SERVICE_NAME
        url_common = "http://picasaweb.google.com"
        
        if (self.uri.path =~ /^\/(.[^\/]+)\/(.[^\/]+)/i) && !self.uri.fragment.nil?
          username = $1
          album = $2 #album_photoid[0..-2].join("#") #in case other hash symbols exist
          
          album_photoid = self.uri.fragment.split("#")
          photoid = album_photoid.last
          self.media_id = photoid
          self.media_website = "#{url_common}/#{username}/#{album}##{photoid}"
          self.media_api_type = PICASA_PHOTO
          self.media_api_id = "#{username}/album/#{album}/photoid/#{photoid}"          
        else
          raise UnsupportedURI
        end

      end
    end
  end
end
# http://picasaweb.google.com/bananastalktome/TestForAPI#5450524726782297346
# API Call: http://picasaweb.google.com/data/feed/api/user/bananastalktome/album/TestForAPI/photoid/5450524726782297346
# #=%23
# http://picasaweb.google.com/data/entry/api/user/bananastalktome/photoid/5450524726782297346

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
muri-1.1.9 lib/muri/filters/picasa.rb
muri-1.1.8 lib/muri/filters/picasa.rb
muri-1.1.6 lib/muri/filters/picasa.rb
muri-1.1.5 lib/muri/filters/picasa.rb
muri-1.1.4 lib/muri/filters/picasa.rb