Metadata
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using MetadataExtractor;
|
||||
using View_by_Distance.Metadata.Models.Stateless.Methods;
|
||||
using View_by_Distance.Shared.Models;
|
||||
|
||||
namespace View_by_Distance.Metadata.Models.Stateless;
|
||||
|
||||
@ -85,34 +87,36 @@ internal abstract class GPS
|
||||
return result;
|
||||
}
|
||||
|
||||
// internal static GeoLocation? GeoLocation(ReadOnlyDictionary<string, MetadataExtractorDirectory> metadataExtractorDirectories)
|
||||
// {
|
||||
// GeoLocation? result;
|
||||
// if (!metadataExtractorDirectories.TryGetValue("GPS", out MetadataExtractorDirectory? metadataExtractorDirectory))
|
||||
// result = null;
|
||||
// else
|
||||
// {
|
||||
// MetadataExtractorTag? metadataExtractorTag;
|
||||
// if (!metadataExtractorDirectory.Tags.TryGetValue((int)Shared.Models.Stateless.IExif.Tags.GPSLatitude, out metadataExtractorTag) || string.IsNullOrEmpty(metadataExtractorTag.Description))
|
||||
// result = null;
|
||||
// else
|
||||
// {
|
||||
// string latitudeDMS = metadataExtractorTag.Description;
|
||||
// double latitude = ParseValueFromDmsString(latitudeDMS);
|
||||
// if (!metadataExtractorDirectory.Tags.TryGetValue((int)Shared.Models.Stateless.IExif.Tags.GPSLongitude, out metadataExtractorTag) || string.IsNullOrEmpty(metadataExtractorTag.Description))
|
||||
// result = null;
|
||||
// else
|
||||
// {
|
||||
// string longitudeDMS = metadataExtractorTag.Description;
|
||||
// double longitude = ParseValueFromDmsString(longitudeDMS);
|
||||
// result = new(latitude, longitude);
|
||||
// string dms = result.ToDmsString();
|
||||
// if ($"{latitudeDMS}, {longitudeDMS}" != dms)
|
||||
// result = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
internal static GeoLocation? GeoLocation(GpsDirectory[]? gpsDirectories)
|
||||
{
|
||||
GeoLocation? result = null;
|
||||
if (gpsDirectories is not null)
|
||||
{
|
||||
foreach (GpsDirectory gpsDirectory in gpsDirectories)
|
||||
{
|
||||
if (string.IsNullOrEmpty(gpsDirectory?.Latitude))
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
string latitudeDMS = gpsDirectory.Latitude;
|
||||
double latitude = ParseValueFromDmsString(latitudeDMS);
|
||||
if (string.IsNullOrEmpty(gpsDirectory.Longitude))
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
string longitudeDMS = gpsDirectory.Longitude;
|
||||
double longitude = ParseValueFromDmsString(longitudeDMS);
|
||||
result = new(latitude, longitude);
|
||||
string dms = result.ToDmsString();
|
||||
if ($"{latitudeDMS}, {longitudeDMS}" != dms)
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
if (result is not null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user