mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 08:46:18 +01:00
Add nc:metadata-photos-exif and nc:metadata-photos-gps to files api
This commit is contained in:
parent
09ff2ec54a
commit
76cf08d6fb
4 changed files with 41 additions and 4 deletions
|
@ -85,6 +85,8 @@ class File with EquatableMixin {
|
||||||
this.trashbinOriginalLocation,
|
this.trashbinOriginalLocation,
|
||||||
this.trashbinDeletionTime,
|
this.trashbinDeletionTime,
|
||||||
this.metadataPhotosIfd0,
|
this.metadataPhotosIfd0,
|
||||||
|
this.metadataPhotosExif,
|
||||||
|
this.metadataPhotosGps,
|
||||||
this.customProperties,
|
this.customProperties,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -108,6 +110,8 @@ class File with EquatableMixin {
|
||||||
trashbinOriginalLocation,
|
trashbinOriginalLocation,
|
||||||
trashbinDeletionTime,
|
trashbinDeletionTime,
|
||||||
metadataPhotosIfd0,
|
metadataPhotosIfd0,
|
||||||
|
metadataPhotosExif,
|
||||||
|
metadataPhotosGps,
|
||||||
customProperties,
|
customProperties,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -126,6 +130,8 @@ class File with EquatableMixin {
|
||||||
final String? trashbinOriginalLocation;
|
final String? trashbinOriginalLocation;
|
||||||
final DateTime? trashbinDeletionTime;
|
final DateTime? trashbinDeletionTime;
|
||||||
final Map<String, String>? metadataPhotosIfd0;
|
final Map<String, String>? metadataPhotosIfd0;
|
||||||
|
final Map<String, String>? metadataPhotosExif;
|
||||||
|
final Map<String, String>? metadataPhotosGps;
|
||||||
final Map<String, String>? customProperties;
|
final Map<String, String>? customProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ extension _$FavoriteToString on Favorite {
|
||||||
extension _$FileToString on File {
|
extension _$FileToString on File {
|
||||||
String _$toString() {
|
String _$toString() {
|
||||||
// ignore: unnecessary_string_interpolations
|
// ignore: unnecessary_string_interpolations
|
||||||
return "File {href: $href, ${lastModified == null ? "" : "lastModified: $lastModified, "}${etag == null ? "" : "etag: $etag, "}${contentType == null ? "" : "contentType: $contentType, "}${isCollection == null ? "" : "isCollection: $isCollection, "}${contentLength == null ? "" : "contentLength: $contentLength, "}${fileId == null ? "" : "fileId: $fileId, "}${favorite == null ? "" : "favorite: $favorite, "}${ownerId == null ? "" : "ownerId: $ownerId, "}${ownerDisplayName == null ? "" : "ownerDisplayName: $ownerDisplayName, "}${hasPreview == null ? "" : "hasPreview: $hasPreview, "}${trashbinFilename == null ? "" : "trashbinFilename: $trashbinFilename, "}${trashbinOriginalLocation == null ? "" : "trashbinOriginalLocation: $trashbinOriginalLocation, "}${trashbinDeletionTime == null ? "" : "trashbinDeletionTime: $trashbinDeletionTime, "}${customProperties == null ? "" : "customProperties: $customProperties"}}";
|
return "File {href: $href, ${lastModified == null ? "" : "lastModified: $lastModified, "}${etag == null ? "" : "etag: $etag, "}${contentType == null ? "" : "contentType: $contentType, "}${isCollection == null ? "" : "isCollection: $isCollection, "}${contentLength == null ? "" : "contentLength: $contentLength, "}${fileId == null ? "" : "fileId: $fileId, "}${favorite == null ? "" : "favorite: $favorite, "}${ownerId == null ? "" : "ownerId: $ownerId, "}${ownerDisplayName == null ? "" : "ownerDisplayName: $ownerDisplayName, "}${hasPreview == null ? "" : "hasPreview: $hasPreview, "}${trashbinFilename == null ? "" : "trashbinFilename: $trashbinFilename, "}${trashbinOriginalLocation == null ? "" : "trashbinOriginalLocation: $trashbinOriginalLocation, "}${trashbinDeletionTime == null ? "" : "trashbinDeletionTime: $trashbinDeletionTime, "}${metadataPhotosIfd0 == null ? "" : "metadataPhotosIfd0: $metadataPhotosIfd0, "}${metadataPhotosExif == null ? "" : "metadataPhotosExif: $metadataPhotosExif, "}${metadataPhotosGps == null ? "" : "metadataPhotosGps: $metadataPhotosGps, "}${customProperties == null ? "" : "customProperties: $customProperties"}}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ class FileParser extends XmlResponseParser {
|
||||||
String? trashbinOriginalLocation;
|
String? trashbinOriginalLocation;
|
||||||
DateTime? trashbinDeletionTime;
|
DateTime? trashbinDeletionTime;
|
||||||
Map<String, String>? metadataPhotosIfd0;
|
Map<String, String>? metadataPhotosIfd0;
|
||||||
|
Map<String, String>? metadataPhotosExif;
|
||||||
|
Map<String, String>? metadataPhotosGps;
|
||||||
Map<String, String>? customProperties;
|
Map<String, String>? customProperties;
|
||||||
|
|
||||||
for (final child in element.children.whereType<XmlElement>()) {
|
for (final child in element.children.whereType<XmlElement>()) {
|
||||||
|
@ -68,6 +70,8 @@ class FileParser extends XmlResponseParser {
|
||||||
trashbinOriginalLocation = propParser.trashbinOriginalLocation;
|
trashbinOriginalLocation = propParser.trashbinOriginalLocation;
|
||||||
trashbinDeletionTime = propParser.trashbinDeletionTime;
|
trashbinDeletionTime = propParser.trashbinDeletionTime;
|
||||||
metadataPhotosIfd0 = propParser.metadataPhotosIfd0;
|
metadataPhotosIfd0 = propParser.metadataPhotosIfd0;
|
||||||
|
metadataPhotosExif = propParser.metadataPhotosExif;
|
||||||
|
metadataPhotosGps = propParser.metadataPhotosGps;
|
||||||
customProperties = propParser.customProperties;
|
customProperties = propParser.customProperties;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +92,8 @@ class FileParser extends XmlResponseParser {
|
||||||
trashbinOriginalLocation: trashbinOriginalLocation,
|
trashbinOriginalLocation: trashbinOriginalLocation,
|
||||||
trashbinDeletionTime: trashbinDeletionTime,
|
trashbinDeletionTime: trashbinDeletionTime,
|
||||||
metadataPhotosIfd0: metadataPhotosIfd0,
|
metadataPhotosIfd0: metadataPhotosIfd0,
|
||||||
|
metadataPhotosExif: metadataPhotosExif,
|
||||||
|
metadataPhotosGps: metadataPhotosGps,
|
||||||
customProperties: customProperties,
|
customProperties: customProperties,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -145,8 +151,19 @@ class _PropParser {
|
||||||
int.parse(child.innerText) * 1000);
|
int.parse(child.innerText) * 1000);
|
||||||
} else if (child.matchQualifiedName("metadata-photos-ifd0",
|
} else if (child.matchQualifiedName("metadata-photos-ifd0",
|
||||||
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
|
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
|
||||||
for (final ifd0_child in child.children.whereType<XmlElement>()) {
|
for (final ifd0Child in child.children.whereType<XmlElement>()) {
|
||||||
(_metadataPhotosIfd0 ??= {})[ifd0_child.name.toString()] = ifd0_child.innerText;
|
(_metadataPhotosIfd0 ??= {})[ifd0Child.localName] =
|
||||||
|
ifd0Child.innerText;
|
||||||
|
}
|
||||||
|
} else if (child.matchQualifiedName("metadata-photos-exif",
|
||||||
|
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
|
||||||
|
for (final c in child.children.whereType<XmlElement>()) {
|
||||||
|
(_metadataPhotosExif ??= {})[c.localName] = c.innerText;
|
||||||
|
}
|
||||||
|
} else if (child.matchQualifiedName("metadata-photos-gps",
|
||||||
|
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
|
||||||
|
for (final c in child.children.whereType<XmlElement>()) {
|
||||||
|
(_metadataPhotosGps ??= {})[c.localName] = c.innerText;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final key = child.name.prefix == null
|
final key = child.name.prefix == null
|
||||||
|
@ -171,6 +188,8 @@ class _PropParser {
|
||||||
String? get trashbinOriginalLocation => _trashbinOriginalLocation;
|
String? get trashbinOriginalLocation => _trashbinOriginalLocation;
|
||||||
DateTime? get trashbinDeletionTime => _trashbinDeletionTime;
|
DateTime? get trashbinDeletionTime => _trashbinDeletionTime;
|
||||||
Map<String, String>? get metadataPhotosIfd0 => _metadataPhotosIfd0;
|
Map<String, String>? get metadataPhotosIfd0 => _metadataPhotosIfd0;
|
||||||
|
Map<String, String>? get metadataPhotosExif => _metadataPhotosExif;
|
||||||
|
Map<String, String>? get metadataPhotosGps => _metadataPhotosGps;
|
||||||
Map<String, String>? get customProperties => _customProperties;
|
Map<String, String>? get customProperties => _customProperties;
|
||||||
|
|
||||||
final Map<String, String> namespaces;
|
final Map<String, String> namespaces;
|
||||||
|
@ -189,6 +208,8 @@ class _PropParser {
|
||||||
String? _trashbinOriginalLocation;
|
String? _trashbinOriginalLocation;
|
||||||
DateTime? _trashbinDeletionTime;
|
DateTime? _trashbinDeletionTime;
|
||||||
Map<String, String>? _metadataPhotosIfd0;
|
Map<String, String>? _metadataPhotosIfd0;
|
||||||
|
Map<String, String>? _metadataPhotosExif;
|
||||||
|
Map<String, String>? _metadataPhotosGps;
|
||||||
Map<String, String>? _customProperties;
|
Map<String, String>? _customProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,8 @@ class ApiFiles {
|
||||||
trashbinOriginalLocation,
|
trashbinOriginalLocation,
|
||||||
trashbinDeletionTime,
|
trashbinDeletionTime,
|
||||||
metadataPhotosIfd0,
|
metadataPhotosIfd0,
|
||||||
|
metadataPhotosExif,
|
||||||
|
metadataPhotosGps,
|
||||||
Map<String, String>? customNamespaces,
|
Map<String, String>? customNamespaces,
|
||||||
List<String>? customProperties,
|
List<String>? customProperties,
|
||||||
}) async {
|
}) async {
|
||||||
|
@ -98,7 +100,9 @@ class ApiFiles {
|
||||||
trashbinFilename != null ||
|
trashbinFilename != null ||
|
||||||
trashbinOriginalLocation != null ||
|
trashbinOriginalLocation != null ||
|
||||||
trashbinDeletionTime != null ||
|
trashbinDeletionTime != null ||
|
||||||
metadataPhotosIfd0 != null);
|
metadataPhotosIfd0 != null ||
|
||||||
|
metadataPhotosExif != null ||
|
||||||
|
metadataPhotosGps != null);
|
||||||
if (!hasDavNs && !hasOcNs && !hasNcNs) {
|
if (!hasDavNs && !hasOcNs && !hasNcNs) {
|
||||||
// no body
|
// no body
|
||||||
return await _api.request("PROPFIND", path);
|
return await _api.request("PROPFIND", path);
|
||||||
|
@ -180,6 +184,12 @@ class ApiFiles {
|
||||||
if (metadataPhotosIfd0 != null) {
|
if (metadataPhotosIfd0 != null) {
|
||||||
builder.element("nc:metadata-photos-ifd0");
|
builder.element("nc:metadata-photos-ifd0");
|
||||||
}
|
}
|
||||||
|
if (metadataPhotosExif != null) {
|
||||||
|
builder.element("nc:metadata-photos-exif");
|
||||||
|
}
|
||||||
|
if (metadataPhotosGps != null) {
|
||||||
|
builder.element("nc:metadata-photos-gps");
|
||||||
|
}
|
||||||
for (final p in customProperties ?? []) {
|
for (final p in customProperties ?? []) {
|
||||||
builder.element(p);
|
builder.element(p);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue