92e6c4fe1e
Extends DownloadSettings with 4 additional options: - Name: File name pattern for downloaded files (existed) - Disabled: Disables downloads - Originals: Only download files stored in "originals" folder - MediaRaw: Include RAW image files - MediaSidecar: Include metadata sidecar files (JSON, XMP, YAML)
25 lines
512 B
Go
25 lines
512 B
Go
package media
|
|
|
|
import (
|
|
"github.com/photoprism/photoprism/pkg/fs"
|
|
)
|
|
|
|
// FromName returns the content type matching the file extension.
|
|
func FromName(fileName string) Type {
|
|
if fileName == "" {
|
|
return Unknown
|
|
}
|
|
|
|
// Find media type based on the file type.
|
|
if result, found := Formats[fs.FileType(fileName)]; found {
|
|
return result
|
|
}
|
|
|
|
// Default.
|
|
return Other
|
|
}
|
|
|
|
// MainFile checks if the filename belongs to a main content type.
|
|
func MainFile(fileName string) bool {
|
|
return FromName(fileName).Main()
|
|
}
|