read distances
This commit is contained in:
parent
6695575762
commit
eec5743381
|
@ -94,14 +94,14 @@ module AVM
|
||||||
end
|
end
|
||||||
|
|
||||||
if node = refs[:avm].at_xpath('./avm:Distance')
|
if node = refs[:avm].at_xpath('./avm:Distance')
|
||||||
list_values = node.search('.//ref:li').collect { |li| li.text }
|
list_values = node.search('.//rdf:li').collect { |li| li.text }
|
||||||
|
|
||||||
case list_values.length
|
case list_values.length
|
||||||
when 1
|
when 1
|
||||||
options[:light_years] = list_values.first
|
options[:light_years] = list_values.first
|
||||||
when 2
|
when 2
|
||||||
options[:light_years] = (list_values.first == '-') ? nil : list_values.first
|
options[:light_years] = (list_values.first == '-') ? nil : list_values.first
|
||||||
options[:redshift] = list_valueslast
|
options[:redshift] = list_values.last
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -90,23 +90,27 @@ describe AVM::Image do
|
||||||
has_most_options
|
has_most_options
|
||||||
|
|
||||||
its(:redshift) { should be_nil }
|
its(:redshift) { should be_nil }
|
||||||
|
its(:light_years) { should == light_years }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "distaince in redshift" do
|
context "distaince in redshift" do
|
||||||
|
|
||||||
let(:file_path) { 'spec/sample_files/image/redshift.xmp' }
|
let(:file_path) { 'spec/sample_files/image/redshift.xmp' }
|
||||||
end
|
|
||||||
context "distance in both" do
|
|
||||||
|
|
||||||
|
has_most_options
|
||||||
|
|
||||||
|
its(:light_years) { should be_nil }
|
||||||
|
its(:redshift) { should == redshift }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "distance in both" do
|
||||||
let(:file_path) { 'spec/sample_files/image/both.xmp' }
|
let(:file_path) { 'spec/sample_files/image/both.xmp' }
|
||||||
|
|
||||||
end
|
has_most_options
|
||||||
context "distance in neither" do
|
|
||||||
|
|
||||||
let(:file_path) { 'spec/sample_files/image/neither.xmp' }
|
its(:light_years) { should == light_years }
|
||||||
|
its(:redshift) { should == redshift }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#to_xml' do
|
describe '#to_xml' do
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.2-c063 53.352624, 2008/07/30-18:05:41 ">
|
||||||
|
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||||
|
<dc:title>:
|
||||||
|
<rdf:Alt>
|
||||||
|
<rdf:li xml:lang="x-default">My title</rdf:li>
|
||||||
|
</rdf:Alt>
|
||||||
|
</dc:title>
|
||||||
|
<dc:description>
|
||||||
|
<rdf:Alt>
|
||||||
|
<rdf:li xml:lang="x-default">Description</rdf:li>
|
||||||
|
</rdf:Alt>
|
||||||
|
</dc:description>
|
||||||
|
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">
|
||||||
|
<Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource">
|
||||||
|
</Iptc4xmpCore:CreatorContactInfo>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
|
||||||
|
<photoshop:Headline>Headline</photoshop:Headline>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:avm="http://www.communicatingastronomy.org/avm/1.0/">
|
||||||
|
<avm:Distance.Notes>Distance Notes</avm:Distance.Notes>
|
||||||
|
<avm:ReferenceURL>Reference URL</avm:ReferenceURL>
|
||||||
|
<avm:Credit>Credit</avm:Credit>
|
||||||
|
<avm:Date>2010-01-01</avm:Date>
|
||||||
|
<avm:ID>ID</avm:ID>
|
||||||
|
<avm:Type>Observation</avm:Type>
|
||||||
|
<avm:Image.ProductQuality>Good</avm:Image.ProductQuality>
|
||||||
|
<avm:Distance>
|
||||||
|
<rdf:Seq>
|
||||||
|
<rdf:li>Light years</rdf:li>
|
||||||
|
<rdf:li>Redshift</rdf:li>
|
||||||
|
</rdf:Seq>
|
||||||
|
</avm:Distance>
|
||||||
|
</rdf:Description>
|
||||||
|
</rdf:RDF>
|
||||||
|
</x:xmpmeta>
|
|
@ -32,6 +32,7 @@
|
||||||
<avm:ID>ID</avm:ID>
|
<avm:ID>ID</avm:ID>
|
||||||
<avm:Type>Observation</avm:Type>
|
<avm:Type>Observation</avm:Type>
|
||||||
<avm:Image.ProductQuality>Good</avm:Image.ProductQuality>
|
<avm:Image.ProductQuality>Good</avm:Image.ProductQuality>
|
||||||
|
<avm:Distance><rdf:Seq><rdf:li>Light years</rdf:li></rdf:Seq></avm:Distance>
|
||||||
</rdf:Description>
|
</rdf:Description>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
</x:xmpmeta>
|
</x:xmpmeta>
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.2-c063 53.352624, 2008/07/30-18:05:41 ">
|
||||||
|
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||||
|
<dc:title>:
|
||||||
|
<rdf:Alt>
|
||||||
|
<rdf:li xml:lang="x-default">My title</rdf:li>
|
||||||
|
</rdf:Alt>
|
||||||
|
</dc:title>
|
||||||
|
<dc:description>
|
||||||
|
<rdf:Alt>
|
||||||
|
<rdf:li xml:lang="x-default">Description</rdf:li>
|
||||||
|
</rdf:Alt>
|
||||||
|
</dc:description>
|
||||||
|
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">
|
||||||
|
<Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource">
|
||||||
|
</Iptc4xmpCore:CreatorContactInfo>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
|
||||||
|
<photoshop:Headline>Headline</photoshop:Headline>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:avm="http://www.communicatingastronomy.org/avm/1.0/">
|
||||||
|
<avm:Distance.Notes>Distance Notes</avm:Distance.Notes>
|
||||||
|
<avm:ReferenceURL>Reference URL</avm:ReferenceURL>
|
||||||
|
<avm:Credit>Credit</avm:Credit>
|
||||||
|
<avm:Date>2010-01-01</avm:Date>
|
||||||
|
<avm:ID>ID</avm:ID>
|
||||||
|
<avm:Type>Observation</avm:Type>
|
||||||
|
<avm:Image.ProductQuality>Good</avm:Image.ProductQuality>
|
||||||
|
<avm:Distance>
|
||||||
|
<rdf:Seq>
|
||||||
|
<rdf:li>-</rdf:li>
|
||||||
|
<rdf:li>Redshift</rdf:li>
|
||||||
|
</rdf:Seq>
|
||||||
|
</avm:Distance>
|
||||||
|
</rdf:Description>
|
||||||
|
</rdf:RDF>
|
||||||
|
</x:xmpmeta>
|
Loading…
Reference in New Issue