2021-09-02 11:12:42 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// MarshalJSON returns the JSON encoding.
|
|
|
|
func (m *File) MarshalJSON() ([]byte, error) {
|
|
|
|
return json.Marshal(&struct {
|
|
|
|
UID string
|
|
|
|
PhotoUID string
|
|
|
|
Name string
|
|
|
|
Root string
|
|
|
|
Hash string
|
|
|
|
Size int64
|
|
|
|
Primary bool
|
2022-04-13 22:17:59 +02:00
|
|
|
TimeIndex *string `json:",omitempty"`
|
|
|
|
MediaID *string `json:",omitempty"`
|
2022-04-15 09:42:07 +02:00
|
|
|
MediaUTC int64 `json:",omitempty"`
|
2022-04-13 22:17:59 +02:00
|
|
|
InstanceID string `json:",omitempty"`
|
|
|
|
OriginalName string `json:",omitempty"`
|
|
|
|
Codec string `json:",omitempty"`
|
2022-04-15 09:42:07 +02:00
|
|
|
FileType string `json:",omitempty"`
|
|
|
|
MediaType string `json:",omitempty"`
|
2022-04-13 22:17:59 +02:00
|
|
|
Mime string `json:",omitempty"`
|
2021-09-02 11:12:42 +02:00
|
|
|
Sidecar bool `json:",omitempty"`
|
|
|
|
Missing bool `json:",omitempty"`
|
|
|
|
Portrait bool `json:",omitempty"`
|
|
|
|
Video bool `json:",omitempty"`
|
|
|
|
Duration time.Duration `json:",omitempty"`
|
2022-04-13 22:17:59 +02:00
|
|
|
FPS float64 `json:",omitempty"`
|
|
|
|
Frames int `json:",omitempty"`
|
2021-09-02 11:12:42 +02:00
|
|
|
Width int `json:",omitempty"`
|
|
|
|
Height int `json:",omitempty"`
|
|
|
|
Orientation int `json:",omitempty"`
|
|
|
|
Projection string `json:",omitempty"`
|
|
|
|
AspectRatio float32 `json:",omitempty"`
|
2021-12-09 07:00:39 +01:00
|
|
|
ColorProfile string `json:",omitempty"`
|
2021-09-02 11:12:42 +02:00
|
|
|
MainColor string `json:",omitempty"`
|
|
|
|
Colors string `json:",omitempty"`
|
|
|
|
Luminance string `json:",omitempty"`
|
2022-05-21 18:12:08 +02:00
|
|
|
Diff int `json:",omitempty"`
|
2022-06-16 06:30:59 +02:00
|
|
|
Chroma int16 `json:",omitempty"`
|
2022-01-05 16:37:19 +01:00
|
|
|
HDR bool `json:",omitempty"`
|
2022-04-13 22:17:59 +02:00
|
|
|
Watermark bool `json:",omitempty"`
|
|
|
|
Software string `json:",omitempty"`
|
2021-09-02 11:12:42 +02:00
|
|
|
Error string `json:",omitempty"`
|
|
|
|
ModTime int64 `json:",omitempty"`
|
|
|
|
CreatedAt time.Time `json:",omitempty"`
|
|
|
|
CreatedIn int64 `json:",omitempty"`
|
|
|
|
UpdatedAt time.Time `json:",omitempty"`
|
|
|
|
UpdatedIn int64 `json:",omitempty"`
|
|
|
|
DeletedAt *time.Time `json:",omitempty"`
|
|
|
|
Markers *Markers `json:",omitempty"`
|
|
|
|
}{
|
|
|
|
UID: m.FileUID,
|
|
|
|
PhotoUID: m.PhotoUID,
|
|
|
|
Name: m.FileName,
|
|
|
|
Root: m.FileRoot,
|
|
|
|
Hash: m.FileHash,
|
|
|
|
Size: m.FileSize,
|
2022-04-13 22:17:59 +02:00
|
|
|
Primary: m.FilePrimary,
|
2022-04-15 09:42:07 +02:00
|
|
|
MediaUTC: m.MediaUTC,
|
2022-04-13 22:17:59 +02:00
|
|
|
TimeIndex: m.TimeIndex,
|
|
|
|
MediaID: m.MediaID,
|
|
|
|
InstanceID: m.InstanceID,
|
|
|
|
OriginalName: m.OriginalName,
|
2021-09-02 11:12:42 +02:00
|
|
|
Codec: m.FileCodec,
|
2022-04-13 22:17:59 +02:00
|
|
|
FileType: m.FileType,
|
|
|
|
MediaType: m.MediaType,
|
2021-09-02 11:12:42 +02:00
|
|
|
Mime: m.FileMime,
|
|
|
|
Sidecar: m.FileSidecar,
|
|
|
|
Missing: m.FileMissing,
|
|
|
|
Portrait: m.FilePortrait,
|
|
|
|
Video: m.FileVideo,
|
|
|
|
Duration: m.FileDuration,
|
2022-04-13 22:17:59 +02:00
|
|
|
FPS: m.FileFPS,
|
|
|
|
Frames: m.FileFrames,
|
2021-09-02 11:12:42 +02:00
|
|
|
Width: m.FileWidth,
|
|
|
|
Height: m.FileHeight,
|
|
|
|
Orientation: m.FileOrientation,
|
|
|
|
Projection: m.FileProjection,
|
|
|
|
AspectRatio: m.FileAspectRatio,
|
2021-12-09 07:00:39 +01:00
|
|
|
ColorProfile: m.FileColorProfile,
|
2021-09-02 11:12:42 +02:00
|
|
|
MainColor: m.FileMainColor,
|
|
|
|
Colors: m.FileColors,
|
|
|
|
Luminance: m.FileLuminance,
|
|
|
|
Diff: m.FileDiff,
|
|
|
|
Chroma: m.FileChroma,
|
2022-01-05 16:37:19 +01:00
|
|
|
HDR: m.FileHDR,
|
2022-04-13 22:17:59 +02:00
|
|
|
Watermark: m.FileWatermark,
|
|
|
|
Software: m.FileSoftware,
|
2021-09-02 11:12:42 +02:00
|
|
|
Error: m.FileError,
|
|
|
|
ModTime: m.ModTime,
|
|
|
|
CreatedAt: m.CreatedAt,
|
|
|
|
CreatedIn: m.CreatedIn,
|
|
|
|
UpdatedAt: m.UpdatedAt,
|
|
|
|
UpdatedIn: m.UpdatedIn,
|
|
|
|
DeletedAt: m.DeletedAt,
|
|
|
|
Markers: m.Markers(),
|
|
|
|
})
|
|
|
|
}
|