mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 14:51:45 +00:00
fixing metada
This commit is contained in:
@@ -472,38 +472,41 @@ router.get('/assets/:photoId/info', authenticate, async (req: Request, res: Resp
|
|||||||
const result = await callSynologyApi<any>(targetUserId, {
|
const result = await callSynologyApi<any>(targetUserId, {
|
||||||
api: 'SYNO.Foto.Browse.Item',
|
api: 'SYNO.Foto.Browse.Item',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
version: 2,
|
version: 5,
|
||||||
id: Number(parsedId.id),
|
id: `[${parsedId.id}]`,
|
||||||
additional: ['thumbnail', 'resolution', 'exif', 'gps', 'address', 'orientation', 'description'],
|
additional: ['resolution', 'exif', 'gps', 'address', 'orientation', 'description'],
|
||||||
});
|
});
|
||||||
if (!result.success || !result.data) {
|
if (!result.success || !result.data) {
|
||||||
return res.status(404).json({ error: 'Photo not found' });
|
return res.status(404).json({ error: 'Photo not found' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const metadata = result.data.list[0];
|
||||||
const exif = result.data.additional?.exif || {};
|
console.log(metadata);
|
||||||
const address = result.data.additional?.address || {};
|
const exif = metadata.additional?.exif || {};
|
||||||
const gps = result.data.additional?.gps || {};
|
const address = metadata.additional?.address || {};
|
||||||
|
const gps = metadata.additional?.gps || {};
|
||||||
res.json({
|
res.json({
|
||||||
id: result.data.id,
|
id: photoId,
|
||||||
takenAt: result.data.time ? new Date(result.data.time * 1000).toISOString() : null,
|
takenAt: metadata.time ? new Date(metadata.time * 1000).toISOString() : null,
|
||||||
width: result.data.additional?.resolution?.width || null,
|
|
||||||
height: result.data.additional?.resolution?.height || null,
|
|
||||||
camera: exif.model || null,
|
|
||||||
lens: exif.lens_model || null,
|
|
||||||
focalLength: exif.focal_length ? `${exif.focal_length}mm` : null,
|
|
||||||
aperture: exif.f_number ? `f/${exif.f_number}` : null,
|
|
||||||
shutter: exif.exposure_time || null,
|
|
||||||
iso: exif.iso_speed_ratings || null,
|
|
||||||
city: address.city || null,
|
city: address.city || null,
|
||||||
state: address.state || null,
|
|
||||||
country: address.country || null,
|
country: address.country || null,
|
||||||
|
state: address.state || null,
|
||||||
|
camera: exif.camera || null,
|
||||||
|
lens: exif.lens || null,
|
||||||
|
focalLength: exif.focal_length || null,
|
||||||
|
aperture: exif.aperture || null,
|
||||||
|
shutter: exif.exposure_time || null,
|
||||||
|
iso: exif.iso || null,
|
||||||
lat: gps.latitude || null,
|
lat: gps.latitude || null,
|
||||||
lng: gps.longitude || null,
|
lng: gps.longitude || null,
|
||||||
orientation: result.data.additional?.orientation || null,
|
orientation: metadata.additional?.orientation || null,
|
||||||
description: result.data.additional?.description || null,
|
description: metadata.additional?.description || null,
|
||||||
fileSize: result.data.filesize || null,
|
filename: metadata.filename || null,
|
||||||
fileName: result.data.filename || null,
|
filesize: metadata.filesize || null,
|
||||||
|
width: metadata.additional?.resolution?.width || null,
|
||||||
|
height: metadata.additional?.resolution?.height || null,
|
||||||
|
fileSize: metadata.filesize || null,
|
||||||
|
fileName: metadata.filename || null,
|
||||||
});
|
});
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
res.status(502).json({ error: err instanceof Error ? err.message : 'Could not reach Synology'});
|
res.status(502).json({ error: err instanceof Error ? err.message : 'Could not reach Synology'});
|
||||||
|
|||||||
Reference in New Issue
Block a user