This commit is contained in:
Michał 2023-04-09 15:53:55 +00:00
parent 8e8bee800e
commit 7b6ad443a1
2 changed files with 10 additions and 16 deletions

View file

@ -77,10 +77,9 @@ class Metadata:
"raw": value, "raw": value,
"formatted": ( "formatted": (
getattr( getattr(
helpers, mapping_val[key][1] # pylint: disable=E0602 helpers,
)( mapping_val[key][1], # pylint: disable=E0602
value )(value)
)
), ),
} }
else: else:

View file

@ -53,7 +53,7 @@ def focal_length(value):
calculated = value[0] / value[1] calculated = value[0] / value[1]
except TypeError: except TypeError:
calculated = value calculated = value
return str(round(calculated, 1)) + " mm" return str(round(calculated, 1)) + " mm"
@ -68,11 +68,7 @@ def color_space(value):
""" """
Maps the value of the color space to a human readable format Maps the value of the color space to a human readable format
""" """
value_map = { value_map = {0: "Reserved", 1: "sRGB", 65535: "Uncalibrated"}
0: "Reserved",
1: "sRGB",
65535: "Uncalibrated"
}
try: try:
return value_map[int(value)] return value_map[int(value)]
except KeyError: except KeyError:
@ -158,11 +154,7 @@ def resolution_unit(value):
""" """
Maps the value of the resolution unit to a human readable format Maps the value of the resolution unit to a human readable format
""" """
value_map = { value_map = {1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter"}
1: "No absolute unit of measurement",
2: "Inch",
3: "Centimeter"
}
try: try:
return value_map[int(value)] return value_map[int(value)]
except KeyError: except KeyError:
@ -398,18 +390,21 @@ def pixel_dimension(value):
""" """
return str(value) + " px" return str(value) + " px"
def title(value): def title(value):
""" """
Maps the value of the title to a human readable format Maps the value of the title to a human readable format
""" """
return str(value.title()) return str(value.title())
def subject_distance(value): def subject_distance(value):
""" """
Maps the value of the subject distance to a human readable format Maps the value of the subject distance to a human readable format
""" """
return str(value) + " m" return str(value) + " m"
def subject_distance_range(value): def subject_distance_range(value):
""" """
Maps the value of the subject distance range to a human readable format Maps the value of the subject distance range to a human readable format
@ -423,4 +418,4 @@ def subject_distance_range(value):
try: try:
return value_map[int(value)] return value_map[int(value)]
except KeyError: except KeyError:
return None return None