-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow easy configuration of supported file types and add support for …
…HEIC+MOV (#23)
- Loading branch information
1 parent
9d5b099
commit e272b53
Showing
8 changed files
with
71 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Config } from './models/config-models'; | ||
|
||
export const CONFIG: Config = { | ||
supportedMediaFileTypes: [ | ||
{ extension: '.jpeg', supportsExif: true }, | ||
{ extension: '.jpg', supportsExif: true }, | ||
{ extension: '.heic', supportsExif: true }, | ||
{ extension: '.gif', supportsExif: false }, | ||
{ extension: '.mp4', supportsExif: false }, | ||
{ extension: '.png', supportsExif: false }, | ||
{ extension: '.avi', supportsExif: false }, | ||
{ extension: '.mov', supportsExif: false }, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { extname } from 'path'; | ||
import { CONFIG } from '../config'; | ||
|
||
export function doesFileSupportExif(filePath: string): boolean { | ||
const extension = extname(filePath); | ||
return extension.toLowerCase() === '.jpeg' || extension.toLowerCase() === '.jpg'; | ||
const mediaFileType = CONFIG.supportedMediaFileTypes.find(fileType => fileType.extension.toLowerCase() === extension.toLowerCase()); | ||
return mediaFileType?.supportsExif ?? false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface Config { | ||
supportedMediaFileTypes: IMediaFileType[]; | ||
} | ||
|
||
export interface IMediaFileType { | ||
extension: string; | ||
supportsExif: boolean; | ||
} |
This file was deleted.
Oops, something went wrong.
e272b53
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked great for me. Thanks so much! Recursion would be nice, but that's just me being picky.