summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Pässler <milan@petabyte.dev>2021-03-13 13:46:12 +0100
committerMilan Pässler <milan@petabyte.dev>2021-03-13 13:46:31 +0100
commit55c1ef17b528b7892caba6a69f8e4d79bce2dd85 (patch)
tree9ad02b1999a622bb50438348180d5753e0150ad3
parent6543530ab3297bbc052deaffc710d6c301ccefbe (diff)
downloadnimjpg-55c1ef17b528b7892caba6a69f8e4d79bce2dd85.tar.gz
nimjpg-55c1ef17b528b7892caba6a69f8e4d79bce2dd85.tar.bz2
nimjpg-55c1ef17b528b7892caba6a69f8e4d79bce2dd85.zip
add exifnim as dependency
-rw-r--r--exif.nim24
-rw-r--r--exif.nimble14
-rw-r--r--jpg.nim4
-rw-r--r--libexif.nim31
4 files changed, 2 insertions, 71 deletions
diff --git a/exif.nim b/exif.nim
deleted file mode 100644
index e5e7210..0000000
--- a/exif.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-import libexif
-import tables
-
-var buf {.threadvar.}: cstring
-
-# MUST be called once per thread
-proc init_exif*() =
- buf = cast[cstring](alloc(2001))
-
-proc deinit_exif*() =
- dealloc(buf)
-
-proc collect_exif_data*(ed: ptr ExifData): Table[string, string] {.gcsafe.} =
- proc process_entries(entry: ptr ExifEntry , callback_data: pointer) {.cdecl.} =
- let name = exif_tag_get_name(entry.tag)
- let val = exif_entry_get_value(entry, buf, 2000)
- let result_table = cast[ptr Table[string, string]](callback_data)
- result_table[][$name] = $val
-
- proc process_contents(content: ptr ExifContent, callback_data: pointer) {.cdecl.} =
- exif_content_foreach_entry(content, process_entries, callback_data)
-
- exif_data_foreach_content(ed, process_contents, addr result)
- exif_data_unref(ed)
diff --git a/exif.nimble b/exif.nimble
deleted file mode 100644
index 3f77f58..0000000
--- a/exif.nimble
+++ /dev/null
@@ -1,14 +0,0 @@
-# Package
-
-version = "0.1.0"
-author = "ctucx, Milan"
-description = "Read exif data using libexif"
-license = "GPL-3.0"
-srcDir = "./"
-bin = @["example"]
-
-
-
-# Dependencies
-requires "nim >= 1.4"
-requires "nimterop"
diff --git a/jpg.nim b/jpg.nim
index a0edfa5..57d3ee4 100644
--- a/jpg.nim
+++ b/jpg.nim
@@ -2,8 +2,8 @@ import os
import strutils
import asyncfile
import asyncdispatch
-import libexif
-import exif
+import exifnim/libexif
+import exifnim/helpers
import tables
import parseutils
import options
diff --git a/libexif.nim b/libexif.nim
deleted file mode 100644
index 0cecffc..0000000
--- a/libexif.nim
+++ /dev/null
@@ -1,31 +0,0 @@
-import os
-import nimterop/build
-import nimterop/cimport
-
-static:
- cDebug()
-
-cPlugin:
- import strutils
- # Strip leading and trailing underscores
- proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
- sym.name = sym.name.strip(chars={'_'})
-
-const
- baseDir = getProjectCacheDir("exif" / "libexif")
-
-when isDefined(libexifLocal):
- cIncludeDir("libexif/include")
- cImport("libexif/include/libexif/exif-data.h" , recurse = true, dynlib = "libexif/lib/libexif.so")
-
-else:
- getHeader(
- header = "libexif/exif-data.h",
- giturl = "https://github.com/libexif/libexif/",
- dlurl = "https://github.com/libexif/libexif/releases/download/libexif-0_6_22-release/libexif-0.6.22.tar.gz",
- outdir = baseDir,
- altNames = "exif"
- )
-
- cIncludeDir(exifdataPath.parentDir())
- cImport(exifdataPath, recurse = true, dynlib = exifdataLPath)