info: XMP dwc namespace format
This commit is contained in:
parent
c1b742b9d6
commit
2a5aefa7af
4 changed files with 99 additions and 0 deletions
|
@ -56,6 +56,9 @@ android {
|
||||||
// minSdkVersion constraints:
|
// minSdkVersion constraints:
|
||||||
// - Flutter & other plugins: 16
|
// - Flutter & other plugins: 16
|
||||||
// - google_maps_flutter v2.1.1: 20
|
// - google_maps_flutter v2.1.1: 20
|
||||||
|
// - to build XML documents from XMP data, `metadata-extractor` and `PixyMeta` rely on `DocumentBuilder`,
|
||||||
|
// which implementation `DocumentBuilderImpl` is provided by the OS and is not customizable on Android,
|
||||||
|
// but the implementation on API <19 is not robust enough and fails to build XMP documents
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
|
|
|
@ -13,6 +13,7 @@ class XMP {
|
||||||
'crs': 'Camera Raw Settings',
|
'crs': 'Camera Raw Settings',
|
||||||
'dc': 'Dublin Core',
|
'dc': 'Dublin Core',
|
||||||
'drone-dji': 'DJI Drone',
|
'drone-dji': 'DJI Drone',
|
||||||
|
'dwc': 'Darwin Core',
|
||||||
'exif': 'Exif',
|
'exif': 'Exif',
|
||||||
'exifEX': 'Exif Ex',
|
'exifEX': 'Exif Ex',
|
||||||
'GettyImagesGIFT': 'Getty Images',
|
'GettyImagesGIFT': 'Getty Images',
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:aves/widgets/common/identity/highlight_title.dart';
|
||||||
import 'package:aves/widgets/viewer/info/common.dart';
|
import 'package:aves/widgets/viewer/info/common.dart';
|
||||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/crs.dart';
|
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/crs.dart';
|
||||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/darktable.dart';
|
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/darktable.dart';
|
||||||
|
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/dwc.dart';
|
||||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/exif.dart';
|
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/exif.dart';
|
||||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/google.dart';
|
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/google.dart';
|
||||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/iptc.dart';
|
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/iptc.dart';
|
||||||
|
@ -38,6 +39,8 @@ class XmpNamespace extends Equatable {
|
||||||
return XmpCrsNamespace(rawProps);
|
return XmpCrsNamespace(rawProps);
|
||||||
case XmpDarktableNamespace.ns:
|
case XmpDarktableNamespace.ns:
|
||||||
return XmpDarktableNamespace(rawProps);
|
return XmpDarktableNamespace(rawProps);
|
||||||
|
case XmpDwcNamespace.ns:
|
||||||
|
return XmpDwcNamespace(rawProps);
|
||||||
case XmpExifNamespace.ns:
|
case XmpExifNamespace.ns:
|
||||||
return XmpExifNamespace(rawProps);
|
return XmpExifNamespace(rawProps);
|
||||||
case XmpGAudioNamespace.ns:
|
case XmpGAudioNamespace.ns:
|
||||||
|
|
92
lib/widgets/viewer/info/metadata/xmp_ns/dwc.dart
Normal file
92
lib/widgets/viewer/info/metadata/xmp_ns/dwc.dart
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
import 'package:aves/widgets/viewer/info/metadata/xmp_namespaces.dart';
|
||||||
|
import 'package:aves/widgets/viewer/info/metadata/xmp_structs.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
class XmpDwcNamespace extends XmpNamespace {
|
||||||
|
static const ns = 'dwc';
|
||||||
|
|
||||||
|
static final dcTermsLocationPattern = RegExp(ns + r':dctermsLocation/(.*)');
|
||||||
|
static final eventPattern = RegExp(ns + r':Event/(.*)');
|
||||||
|
static final geologicalContextPattern = RegExp(ns + r':GeologicalContext/(.*)');
|
||||||
|
static final identificationPattern = RegExp(ns + r':Identification/(.*)');
|
||||||
|
static final measurementOrFactPattern = RegExp(ns + r':MeasurementOrFact/(.*)');
|
||||||
|
static final occurrencePattern = RegExp(ns + r':Occurrence/(.*)');
|
||||||
|
static final recordPattern = RegExp(ns + r':Record/(.*)');
|
||||||
|
static final resourceRelationshipPattern = RegExp(ns + r':ResourceRelationship/(.*)');
|
||||||
|
static final taxonPattern = RegExp(ns + r':Taxon/(.*)');
|
||||||
|
|
||||||
|
final dcTermsLocation = <String, String>{};
|
||||||
|
final event = <String, String>{};
|
||||||
|
final identification = <String, String>{};
|
||||||
|
final geologicalContext = <String, String>{};
|
||||||
|
final measurementOrFact = <String, String>{};
|
||||||
|
final occurrence = <String, String>{};
|
||||||
|
final record = <String, String>{};
|
||||||
|
final resourceRelationship = <String, String>{};
|
||||||
|
final taxon = <String, String>{};
|
||||||
|
|
||||||
|
XmpDwcNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool extractData(XmpProp prop) {
|
||||||
|
var hasStructs = extractStruct(prop, dcTermsLocationPattern, dcTermsLocation);
|
||||||
|
hasStructs |= extractStruct(prop, eventPattern, event);
|
||||||
|
hasStructs |= extractStruct(prop, geologicalContextPattern, geologicalContext);
|
||||||
|
hasStructs |= extractStruct(prop, measurementOrFactPattern, measurementOrFact);
|
||||||
|
hasStructs |= extractStruct(prop, identificationPattern, identification);
|
||||||
|
hasStructs |= extractStruct(prop, occurrencePattern, occurrence);
|
||||||
|
hasStructs |= extractStruct(prop, recordPattern, record);
|
||||||
|
hasStructs |= extractStruct(prop, resourceRelationshipPattern, resourceRelationship);
|
||||||
|
hasStructs |= extractStruct(prop, taxonPattern, taxon);
|
||||||
|
return hasStructs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Widget> buildFromExtractedData() => [
|
||||||
|
if (dcTermsLocation.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'DC Terms Location',
|
||||||
|
struct: dcTermsLocation,
|
||||||
|
),
|
||||||
|
if (event.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'Event',
|
||||||
|
struct: event,
|
||||||
|
),
|
||||||
|
if (geologicalContext.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'Geological Context',
|
||||||
|
struct: geologicalContext,
|
||||||
|
),
|
||||||
|
if (identification.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'Identification',
|
||||||
|
struct: identification,
|
||||||
|
),
|
||||||
|
if (measurementOrFact.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'Measurement Or Fact',
|
||||||
|
struct: measurementOrFact,
|
||||||
|
),
|
||||||
|
if (occurrence.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'Occurrence',
|
||||||
|
struct: occurrence,
|
||||||
|
),
|
||||||
|
if (record.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'Record',
|
||||||
|
struct: record,
|
||||||
|
),
|
||||||
|
if (resourceRelationship.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'Resource Relationship',
|
||||||
|
struct: resourceRelationship,
|
||||||
|
),
|
||||||
|
if (taxon.isNotEmpty)
|
||||||
|
XmpStructCard(
|
||||||
|
title: 'Taxon',
|
||||||
|
struct: taxon,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue