Skip to content

Commit

Permalink
Merge pull request #809 from photonia-io/camera-info-updates-2
Browse files Browse the repository at this point in the history
Camera utilities and camera info updates
  • Loading branch information
janosrusiczki authored Nov 21, 2024
2 parents 797782b + bb02990 commit eb76712
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/camera_utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def initialize(exif_make, exif_model)

def friendly_name
camera_make_model_lookup_table
.fetch(@exif_make.downcase) { report_missing_make(@exif_make) }
.fetch(@exif_model.downcase) { report_missing_model(@exif_make, @exif_model) }
.fetch(@exif_make.strip.downcase) { report_missing_make(@exif_make) }
.fetch(@exif_model.strip.downcase) { report_missing_model(@exif_make, @exif_model) }
.fetch('friendly_name', "#{@exif_make} #{@exif_model}")
end

Expand Down
35 changes: 35 additions & 0 deletions lib/camera_utilities/json/camera_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@
"friendly_name": "Canon PowerShot S2 IS"
}
},
"DJI": {
"FC1102": {
"friendly_name": "DJI Spark",
"launch_year": "2017",
"launch_month": "5"
}
},
"GoPro": {
"YHDC5170": {
"launch_year": "2010",
Expand Down Expand Up @@ -234,6 +241,13 @@
"friendly_name": "LG Nexus 5"
}
},
"NIKON": {
"NIKON D60": {
"launch_year": "2008",
"launch_month": "2",
"friendly_name": "Nikon D60"
}
},
"NIKON CORPORATION": {
"NIKON D700": {
"launch_year": "2008",
Expand Down Expand Up @@ -263,6 +277,27 @@
"friendly_name": "Olympus PEN E-P5"
}
},
"PENTAX Corporation": {
"PENTAX K100D": {
"launch_year": "2006",
"launch_month": "5",
"friendly_name": "Pentax K100D"
}
},
"Samsung": {
"Galaxy S24 Ultra": {
"launch_year": "2023",
"launch_month": "2",
"friendly_name": "Samsung Galaxy S24 Ultra"
}
},
"Sony": {
"Cybershot": {
"launch_year": "?",
"launch_month": "?",
"friendly_name": "Sony Cybershot"
}
},
"Sony Ericsson": {
"G502": {
"launch_year": "2008",
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/camera_utilities_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
expect(subject).to eq(expected_friendly_name)
end
end

context 'when there are leading or trailing spaces in the make and model' do
let(:make) { ' OLYMPUS IMAGING CORP. ' }
let(:model) { ' E-P5 ' }

it 'returns the friendly name' do
expect(subject).to eq(expected_friendly_name)
end
end
end

context 'when the camera make and model are not found in the lookup table' do
Expand Down

0 comments on commit eb76712

Please sign in to comment.