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.trashbinDeletionTime,
|
||||
this.metadataPhotosIfd0,
|
||||
this.metadataPhotosExif,
|
||||
this.metadataPhotosGps,
|
||||
this.customProperties,
|
||||
});
|
||||
|
||||
|
@ -108,6 +110,8 @@ class File with EquatableMixin {
|
|||
trashbinOriginalLocation,
|
||||
trashbinDeletionTime,
|
||||
metadataPhotosIfd0,
|
||||
metadataPhotosExif,
|
||||
metadataPhotosGps,
|
||||
customProperties,
|
||||
];
|
||||
|
||||
|
@ -126,6 +130,8 @@ class File with EquatableMixin {
|
|||
final String? trashbinOriginalLocation;
|
||||
final DateTime? trashbinDeletionTime;
|
||||
final Map<String, String>? metadataPhotosIfd0;
|
||||
final Map<String, String>? metadataPhotosExif;
|
||||
final Map<String, String>? metadataPhotosGps;
|
||||
final Map<String, String>? customProperties;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ extension _$FavoriteToString on Favorite {
|
|||
extension _$FileToString on File {
|
||||
String _$toString() {
|
||||
// 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;
|
||||
DateTime? trashbinDeletionTime;
|
||||
Map<String, String>? metadataPhotosIfd0;
|
||||
Map<String, String>? metadataPhotosExif;
|
||||
Map<String, String>? metadataPhotosGps;
|
||||
Map<String, String>? customProperties;
|
||||
|
||||
for (final child in element.children.whereType<XmlElement>()) {
|
||||
|
@ -68,6 +70,8 @@ class FileParser extends XmlResponseParser {
|
|||
trashbinOriginalLocation = propParser.trashbinOriginalLocation;
|
||||
trashbinDeletionTime = propParser.trashbinDeletionTime;
|
||||
metadataPhotosIfd0 = propParser.metadataPhotosIfd0;
|
||||
metadataPhotosExif = propParser.metadataPhotosExif;
|
||||
metadataPhotosGps = propParser.metadataPhotosGps;
|
||||
customProperties = propParser.customProperties;
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +92,8 @@ class FileParser extends XmlResponseParser {
|
|||
trashbinOriginalLocation: trashbinOriginalLocation,
|
||||
trashbinDeletionTime: trashbinDeletionTime,
|
||||
metadataPhotosIfd0: metadataPhotosIfd0,
|
||||
metadataPhotosExif: metadataPhotosExif,
|
||||
metadataPhotosGps: metadataPhotosGps,
|
||||
customProperties: customProperties,
|
||||
);
|
||||
}
|
||||
|
@ -145,8 +151,19 @@ class _PropParser {
|
|||
int.parse(child.innerText) * 1000);
|
||||
} else if (child.matchQualifiedName("metadata-photos-ifd0",
|
||||
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
|
||||
for (final ifd0_child in child.children.whereType<XmlElement>()) {
|
||||
(_metadataPhotosIfd0 ??= {})[ifd0_child.name.toString()] = ifd0_child.innerText;
|
||||
for (final ifd0Child in child.children.whereType<XmlElement>()) {
|
||||
(_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 {
|
||||
final key = child.name.prefix == null
|
||||
|
@ -171,6 +188,8 @@ class _PropParser {
|
|||
String? get trashbinOriginalLocation => _trashbinOriginalLocation;
|
||||
DateTime? get trashbinDeletionTime => _trashbinDeletionTime;
|
||||
Map<String, String>? get metadataPhotosIfd0 => _metadataPhotosIfd0;
|
||||
Map<String, String>? get metadataPhotosExif => _metadataPhotosExif;
|
||||
Map<String, String>? get metadataPhotosGps => _metadataPhotosGps;
|
||||
Map<String, String>? get customProperties => _customProperties;
|
||||
|
||||
final Map<String, String> namespaces;
|
||||
|
@ -189,6 +208,8 @@ class _PropParser {
|
|||
String? _trashbinOriginalLocation;
|
||||
DateTime? _trashbinDeletionTime;
|
||||
Map<String, String>? _metadataPhotosIfd0;
|
||||
Map<String, String>? _metadataPhotosExif;
|
||||
Map<String, String>? _metadataPhotosGps;
|
||||
Map<String, String>? _customProperties;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ class ApiFiles {
|
|||
trashbinOriginalLocation,
|
||||
trashbinDeletionTime,
|
||||
metadataPhotosIfd0,
|
||||
metadataPhotosExif,
|
||||
metadataPhotosGps,
|
||||
Map<String, String>? customNamespaces,
|
||||
List<String>? customProperties,
|
||||
}) async {
|
||||
|
@ -98,7 +100,9 @@ class ApiFiles {
|
|||
trashbinFilename != null ||
|
||||
trashbinOriginalLocation != null ||
|
||||
trashbinDeletionTime != null ||
|
||||
metadataPhotosIfd0 != null);
|
||||
metadataPhotosIfd0 != null ||
|
||||
metadataPhotosExif != null ||
|
||||
metadataPhotosGps != null);
|
||||
if (!hasDavNs && !hasOcNs && !hasNcNs) {
|
||||
// no body
|
||||
return await _api.request("PROPFIND", path);
|
||||
|
@ -180,6 +184,12 @@ class ApiFiles {
|
|||
if (metadataPhotosIfd0 != null) {
|
||||
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 ?? []) {
|
||||
builder.element(p);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue