Skip to content

feat(search): motion photo facet - #3200

Draft
dschmidt wants to merge 3 commits into
feat/search-tika-facetsfrom
feat/search-motion-photo-facet
Draft

feat(search): motion photo facet#3200
dschmidt wants to merge 3 commits into
feat/search-tika-facetsfrom
feat/search-motion-photo-facet

Conversation

@dschmidt

Copy link
Copy Markdown
Contributor

Stacked on #3198 (tika facets).

Draft: adds the Google Motion Photo facet (version, presentationTimestampUs, videoSize) end to end.

  • extracts the Motion Photo / legacy MicroVideo XMP in the tika extractor, and confirms the embedded video is actually present (a Google Photos share keeps the XMP but strips the appended video) by range-reading the file tail for an ftyp box.
  • adds the MotionPhoto search proto message + facet, wires it through the bleve and OpenSearch backends and the graph driveItem (@libre.graph.motionPhoto).

Two preparatory commits first: getFirstValue now tries multiple metadata keys (Motion Photo vs legacy MicroVideo), and the content retriever gains RetrieveRange (single HTTP range request, with a full-file skip fallback).

Needs a separate reva change, not includable here: the WebDAV PROPFIND handler must know the motionPhoto keys to expose the facet over WebDAV. It lives in vendored reva, so it needs its own reva PR + dependency bump. The required diff:

diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/propfind/propfind.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/propfind/propfind.go
index d86367a2c5..f40f4ec082 100644
--- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/propfind/propfind.go
+++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/propfind/propfind.go
@@ -107,6 +107,11 @@ var (
 		"orientation",
 		"takenDateTime",
 	}
+	motionPhotoKeys = []string{
+		"version",
+		"presentationTimestampUs",
+		"videoSize",
+	}
 )
 
 type countingReader struct {
@@ -887,6 +892,8 @@ func metadataKeys(pf XML) ([]string, []string) {
 					metadataKeys = append(metadataKeys, metadataKeysWithPrefix("libre.graph.image", imageKeys)...)
 				case "http://owncloud.org/ns/photo":
 					metadataKeys = append(metadataKeys, metadataKeysWithPrefix("libre.graph.photo", photoKeys)...)
+				case "http://owncloud.org/ns/motionPhoto":
+					metadataKeys = append(metadataKeys, metadataKeysWithPrefix("libre.graph.motionPhoto", motionPhotoKeys)...)
 				default:
 					metadataKeys = append(metadataKeys, key)
 				}
@@ -944,7 +951,7 @@ func requiresExplicitFetching(n *xml.Name) bool {
 		}
 	case net.NsOwncloud:
 		switch n.Local {
-		case "favorite", "share-types", "checksums", "size", "tags", "audio", "location", "image", "photo":
+		case "favorite", "share-types", "checksums", "size", "tags", "audio", "location", "image", "photo", "motionPhoto":
 			return true
 		default:
 			return false
@@ -1292,6 +1299,7 @@ func mdToPropResponse(ctx context.Context, pf *XML, md *provider.ResourceInfo, p
 			appendMetadataProp(k, "oc", "location", "libre.graph.location", locationKeys)
 			appendMetadataProp(k, "oc", "image", "libre.graph.image", imageKeys)
 			appendMetadataProp(k, "oc", "photo", "libre.graph.photo", photoKeys)
+			appendMetadataProp(k, "oc", "motionPhoto", "libre.graph.motionPhoto", motionPhotoKeys)
 		}
 
 		if md.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER {
@@ -1579,6 +1587,10 @@ func mdToPropResponse(ctx context.Context, pf *XML, md *provider.ResourceInfo, p
 					if k := md.GetArbitraryMetadata().GetMetadata(); k != nil {
 						appendMetadataProp(k, "oc", "photo", "libre.graph.photo", photoKeys)
 					}
+				case "motionPhoto":
+					if k := md.GetArbitraryMetadata().GetMetadata(); k != nil {
+						appendMetadataProp(k, "oc", "motionPhoto", "libre.graph.motionPhoto", motionPhotoKeys)
+					}
 				case "name":
 					appendToOK(prop.Escaped("oc:name", md.Name))
 				case "shareid":

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant