mirror of
https://github.com/simon987/sist2.git
synced 2025-04-19 18:26:43 +00:00
Handle GPS metadata in the UI
This commit is contained in:
parent
efa4a06e56
commit
5b8c13fd13
@ -165,6 +165,30 @@
|
|||||||
"exif_user_comment": {
|
"exif_user_comment": {
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
|
"exif_gps_longitude_ref": {
|
||||||
|
"type": "keyword",
|
||||||
|
"index": false
|
||||||
|
},
|
||||||
|
"exif_gps_longitude_dms": {
|
||||||
|
"type": "keyword",
|
||||||
|
"index": false
|
||||||
|
},
|
||||||
|
"exif_gps_longitude_dec": {
|
||||||
|
"type": "keyword",
|
||||||
|
"index": false
|
||||||
|
},
|
||||||
|
"exif_gps_latitude_ref": {
|
||||||
|
"type": "keyword",
|
||||||
|
"index": false
|
||||||
|
},
|
||||||
|
"exif_gps_latitude_dms": {
|
||||||
|
"type": "keyword",
|
||||||
|
"index": false
|
||||||
|
},
|
||||||
|
"exif_gps_latitude_dec": {
|
||||||
|
"type": "keyword",
|
||||||
|
"index": false
|
||||||
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
|
File diff suppressed because one or more lines are too long
@ -192,6 +192,19 @@ function makeUserTag(tag, hit) {
|
|||||||
return userTag;
|
return userTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeGpsMetaRow(tbody, latitude, longitude) {
|
||||||
|
tbody.append($("<tr>")
|
||||||
|
.append($("<td>").text("Exif GPS"))
|
||||||
|
.append($("<td>")
|
||||||
|
.append($("<a>")
|
||||||
|
.text(`${latitude}, ${longitude}`)
|
||||||
|
.attr("href", `https://maps.google.com/?q=${latitude},${longitude}&ll=${latitude},${longitude}&t=k&z=17`)
|
||||||
|
.attr("target", "_blank")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function infoButtonCb(hit) {
|
function infoButtonCb(hit) {
|
||||||
return () => {
|
return () => {
|
||||||
getDocumentInfo(hit["_id"]).then(doc => {
|
getDocumentInfo(hit["_id"]).then(doc => {
|
||||||
@ -229,13 +242,25 @@ function infoButtonCb(hit) {
|
|||||||
.text(new Date(doc["mtime"] * 1000).toISOString().split(".")[0].replace("T", " "))
|
.text(new Date(doc["mtime"] * 1000).toISOString().split(".")[0].replace("T", " "))
|
||||||
.attr("title", doc["mtime"]))
|
.attr("title", doc["mtime"]))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Exif GPS
|
||||||
|
if ("exif_gps_longitude_dec" in doc) {
|
||||||
|
makeGpsMetaRow(tbody, doc["exif_gps_latitude_dec"], doc["exif_gps_longitude_dec"])
|
||||||
|
} else if ("exif_gps_longitude_dms" in doc) {
|
||||||
|
makeGpsMetaRow(
|
||||||
|
tbody,
|
||||||
|
dmsToDecimal(doc["exif_gps_latitude_dms"], doc["exif_gps_latitude_ref"]),
|
||||||
|
dmsToDecimal(doc["exif_gps_longitude_dms"], doc["exif_gps_longitude_ref"]),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const displayFields = new Set([
|
const displayFields = new Set([
|
||||||
"mime", "size", "path", "title", "width", "height", "duration", "audioc", "videoc",
|
"mime", "size", "path", "title", "width", "height", "duration", "audioc", "videoc",
|
||||||
"bitrate", "artist", "album", "album_artist", "genre", "title", "font_name", "tag", "author",
|
"bitrate", "artist", "album", "album_artist", "genre", "title", "font_name", "tag", "author",
|
||||||
"modified_by", "pages"
|
"modified_by", "pages"
|
||||||
]);
|
]);
|
||||||
Object.keys(doc)
|
Object.keys(doc)
|
||||||
.filter(key => key.startsWith("_keyword.") || key.startsWith("_text.") || displayFields.has(key) || key.startsWith("exif_"))
|
.filter(key => key.startsWith("_keyword.") || key.startsWith("_text.") || displayFields.has(key) || (key.startsWith("exif_") && !key.includes("gps")))
|
||||||
.forEach(key => {
|
.forEach(key => {
|
||||||
tbody.append($("<tr>")
|
tbody.append($("<tr>")
|
||||||
.append($("<td>").text(key))
|
.append($("<td>").text(key))
|
||||||
|
@ -236,3 +236,13 @@ function updateColumnStyle() {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dmsToDecimal(dms, ref) {
|
||||||
|
const tokens = dms.split(",")
|
||||||
|
|
||||||
|
const d = Number(tokens[0].trim().split(":")[0]) / Number(tokens[0].trim().split(":")[1])
|
||||||
|
const m = Number(tokens[1].trim().split(":")[0]) / Number(tokens[1].trim().split(":")[1])
|
||||||
|
const s = Number(tokens[2].trim().split(":")[0]) / Number(tokens[2].trim().split(":")[1])
|
||||||
|
|
||||||
|
return (d + (m / 60) + (s / 3600)) * (ref === "S" || ref === "W" ? -1 : 1)
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
2
third-party/libscan
vendored
2
third-party/libscan
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 598e748214fe0656d536e40bb9e056c058504d85
|
Subproject commit 9be4f02851107edac65894a1fdde16a80cad43ac
|
Loading…
x
Reference in New Issue
Block a user