$: << "../../libphotordf-ruby/lib"


require 'rdfjpegimage'

class RdfBrowserApplication
    include Zoy::Rdf
    def initialize(param = nil)

        if ( param = ARGV[0]) != nil && 
            FileTest.exists?(param) && 
            FileTest.file?(param)
            
            @file = param

        end
    end
    def to_s
        return "No Valid Parameter given" if @file == nil
        out ="Information for \"#{@file}\"\n"
        image = RichImage.new(@file)
        image.load
        if image.rdf_data.length > 0
            out += "Rdf Information found:\n"
            image.rdf_data.each do |rdf_comment|
                out += rdf_comment.to_s
            end
        elsif image.normal_comments.length > 0
            image.normal_comments.each{ |comment| out+= comment.to_s }
        else
            out += "No comment information in this picture.\n"
        end
        return out
    end

end
if __FILE__ == $0
    puts RdfBrowserApplication.new(ARGV[0]).to_s
    
  
    puts "Press a key to exit"
    $stdin.getc
end



