aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--post/post.go29
1 files changed, 24 insertions, 5 deletions
diff --git a/post/post.go b/post/post.go
index c43b9e3..8f96c8d 100644
--- a/post/post.go
+++ b/post/post.go
@@ -143,12 +143,27 @@ func (p *Post) AbsoluteFilePath() string {
Try to extract metadata from EXIF
*/
func (p *Post) parseExif() {
- // TODO: full exif parsing / metadata propogation
- // TODO: error checking
- f, _ := os.Open(p.AbsoluteFilePath())
- x, _ := exif.Decode(f)
- tm, _ := x.DateTime()
+ f, err := os.Open(p.AbsoluteFilePath())
+ if err != nil {
+ vlog.Printf("%v", err)
+ return
+ }
+
+ x, err := exif.Decode(f)
+ if err != nil {
+ vlog.Printf("%v", err)
+ return
+ }
+
+ tm, err := x.DateTime()
+ if err != nil {
+ vlog.Printf("%v", err)
+ return
+ }
p.Time = tm
+
+ // TODO: full exif parsing | metadata propogation but exif is ugh
+ p.Meta["Exif"] = x.String()
}
/*
@@ -203,6 +218,10 @@ func NormalizeTag(tag string) string {
splitText splits up p.Unparsed into p.Text and p.Meta[attr][value]
*/
func (p *Post) splitTextMeta() {
+ if p.Unparsed == "" {
+ p.Text = ""
+ return
+ }
SEPARATOR := ":"
lines := strings.Split(p.Unparsed, "\n")
for _, line := range lines {