Skip to content

Commit

Permalink
feat: add some new media metadata properties (#3)
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <[email protected]>
  • Loading branch information
genaris authored Apr 4, 2024
1 parent e6a9213 commit 7a8dd9a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/controllers/message/MessageController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,13 @@ export class MessageController {
fileName: item.filename,
metadata: {
preview: item.preview,
width: item.width,
height: item.height,
duration: item.duration,
title: item.title,
icon: item.icon,
openingMode: item.openingMode,
screenOrientation: item.screenOrientation,
},
})),
})
Expand Down
8 changes: 8 additions & 0 deletions src/events/MessageEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ export const messageEvents = async (agent: ServiceAgent, config: ServerConfig) =
byteCount: item.byteCount,
description: item.description,
filename: item.fileName,
duration: item.metadata?.duration as string,
preview: item.metadata?.preview as string,
width: item.metadata?.width as number,
height: item.metadata?.height as number,
title: item.metadata?.title as string,
icon: item.metadata?.icon as string,
openingMode: item.metadata?.openingMode as string,
screenOrientation: item.metadata?.screenOrientation as string,
})),
})

Expand Down
16 changes: 16 additions & 0 deletions src/model/messages/MediaMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ export interface MediaItemOptions {
uri: string
ciphering?: CipheringInfo
preview?: string
width?: number
height?: number
duration?: string
title?: string
icon?: string
openingMode?: string
screenOrientaton?: string
}

export class MediaItem {
Expand All @@ -36,10 +39,13 @@ export class MediaItem {
this.uri = options.uri
this.ciphering = options.ciphering
this.preview = options.preview
this.width = options.width
this.height = options.height
this.duration = options.duration
this.title = options.title
this.icon = options.icon
this.openingMode = options.openingMode
this.screenOrientation = options.screenOrientaton
}
}

Expand Down Expand Up @@ -68,6 +74,12 @@ export class MediaItem {
@IsString()
public preview?: string

@IsOptional()
public width?: number

@IsOptional()
public height?: number

@IsOptional()
@IsString()
public duration?: string
Expand All @@ -84,6 +96,10 @@ export class MediaItem {
@IsString()
public openingMode?: string

@IsOptional()
@IsString()
public screenOrientation?: string

@IsOptional()
public ciphering?: CipheringInfo
}
Expand Down

0 comments on commit 7a8dd9a

Please sign in to comment.