expose the ParseFile function.

This commit is contained in:
Stephen McQuay 2017-07-23 14:06:28 -07:00
parent b4ee62151d
commit 13cd30b46c
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D

View File

@ -92,7 +92,7 @@ func Parse(in <-chan string) <-chan Media {
out := make(chan Media) out := make(chan Media)
go func() { go func() {
for path := range in { for path := range in {
f, err := _parse(path) f, err := ParseFile(path)
if err != nil { if err != nil {
switch err.(type) { switch err.(type) {
case NotMedia: case NotMedia:
@ -149,7 +149,8 @@ func Move(in <-chan Media, root string) <-chan error {
return out return out
} }
func _parse(path string) (Media, error) { // ParseFile extracts metadata from single file.
func ParseFile(path string) (Media, error) {
ext := strings.ToLower(filepath.Ext(path)) ext := strings.ToLower(filepath.Ext(path))
var r Media var r Media
hash := md5.New() hash := md5.New()