-
Notifications
You must be signed in to change notification settings - Fork 0
/
NikonLenses.ps1
84 lines (64 loc) · 2.5 KB
/
NikonLenses.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<#
Example queries for the Nikon Lens json data file.
#>
# Load the json data file.
[string]$jsonFile = "$PSScriptRoot\allData.json"
$lenses = (Get-Content $jsonFile -Raw) | ConvertFrom-Json
# Get the lens data.
$allLensData = $lenses.PsObject.Properties.Value
"$($allLensData.count) lenses"
# Filter the result for specific lens data.
# Get all 6/2.8 lenses with AI.
$ai = $allLensData.Where({ $_.Type.Contains("Ai") -and $_.Lens -eq "6/2.8" })
# Get all AI-S 6/2.8 lenses.
$ais = $allLensData.Where({ $_.Type -eq "Ai-S" -and $_.Lens -eq "6/2.8" })
# Get all 16mm Fisheye lenses.
$16mmFisheye = $allLensData.Where({ $_.Group -eq "Fisheye" -and $_.Lens.StartsWith("16/") })
foreach ($lens in $16mmFisheye) {
"$($lens.Lens) $($lens.Type)"
}
# Get all AF lenses out of the 16mm Fisheye lenses.
$AF16mmFisheye = $16mmFisheye.Where({ $_.Type -match "AF" })
# Get all 24-85 lenses.
$24_85 = $allLensData.Where({ $_.Lens.StartsWith("24-85/") })
# Get all light lenses <200g.
$lightLenses = $allLensData.Where({ $_.Weight.Length -gt 0 -and [int]($_.Weight) -lt 200 })
# Get all heavy lenses >2000g.
$heavyLenses = $allLensData.Where({ [int]($_.Weight) -gt 2000 })
# $test = $heavyLenses.GetEnumerator() | Sort-Object -Property @{
# expression = 'Weight'
# descending = $true
# } #| Select-Object -First 5
# Get the first 5 heaviest lenses.
$first5heavyLenses = $heavyLenses.GetEnumerator() | Sort-Object { [int]($_.Weight) } -Descending | Select-Object -First 5
# 1200-1700/5.6-8 IF-ED Ai-P (16000g)
# 1000/6.3 Reflex F (9900g)
# 50cm/5 T·C S, M39 (8500g)
# 360-1200/11 ED Ai-S (8250g)
# 2000/11 Reflex A,C (7500g)
foreach ($lens in $first5heavyLenses) {
"$($lens.Lens) $($lens.Type) ($($lens.Weight)g)"
}
# Get all constant f/2.8 aperture lenses.
$aperture_2_8 = $allLensData.Where({ $_.Lens -match "/2.8(\s|$)" })
# Get all Z mount VR lenses.
$vr = $allLensData.Where({ $_.Type.Contains("Z") -and $_.Lens.Contains("VR") })
# Get all DX lenses out of the Z mount VR lenses.
$vrdx = $vr.Where({ $_.Type -eq "Z DX" })
# Print result.
# 12-28/3.5-5.6 PZ VR Z DX
# 16-50/3.5-6.3 VR Z DX
# 18-140/3.5-6.3 VR Z DX
# 50-250/4.5-6.3 VR Z DX
foreach ($lens in $vrdx) {
"$($lens.Lens) $($lens.Type)"
}
# Print all lens data by group.
foreach ($lensGroup in $lenses.PsObject.Properties) {
"$($lensGroup.Name) ($($lensGroup.Value.count))"
$lensGroup.Name
foreach ($lens in $lensGroup.Value) {
$lens
#"$($lens.Lens)"
}
}