Sha256: f626ddb71c656672432308a36b95389de4b4ebd49bc0445f4bf8422b8891fa84
Contents?: true
Size: 1.88 KB
Versions: 1
Compression:
Stored size: 1.88 KB
Contents
# treevisitor require 'gf_utilities/md5' require 'treevisitor/leaf_node' # ralbum require 'ralbum' require 'ralbum/options' require 'ralbum/ralbum_exception' require 'ralbum/photo_tree/photo_file' # # PhotoTreeItem contains a "photo" # (it is different from image; only albums contains images) # class PhotoTreeItem < LeafNode attr_reader :photo_file attr_accessor :title attr_accessor :description def initialize( filename, photo_tree_node ) @title = nil @description = nil if photo_tree_node.nil? raise RAlbumException.new("photo_tree_node cannot be nil") end if File.dirname( filename ) == "." filename = File.join( photo_tree_node.path_with_prefix, filename ) end super( filename, photo_tree_node ) @photo_file = PhotoFile.new(filename) end def basename File.basename( name ) end def to_s if title and not title.empty? "'#{basename}': '#{title}'" else "'#{basename}'" end end ############################################################################ # configurations def write_xml( xml_el ) xml_photo = xml_el.add_element( "photo" ) xml_photo.add_element("md5").text = md5 xml_photo.add_element("title").text = name xml_photo.add_element("description").text = self["description"] xml_photo.add_element("file_date").text = time xml_exif = xml_photo.add_element("exif") xml_exif.add_element("model").text = self["model"] xml_exif.add_element("date_and_time").text = self["date_and_time"] xml_exif.add_element("FocalLength").text = self["FocalLength"] xml_exif.add_element("exposure_time").text = self["exposure_time"] xml_exif.add_element("white_balance").text = self["white_balance"] xml_exif.add_element("iso_speed").text = self["iso_speed"] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gf-ralbum-0.0.5 | lib/ralbum/photo_tree/photo_tree_item.rb |