Permalink
Browse files

Initial commit.

  • Loading branch information...
1 parent 461d8da commit 0de8f596ca24cdbca043db59bdb7d2cbd370b95b @postmodern committed Aug 11, 2012
Showing with 725 additions and 26 deletions.
  1. +339 −0 COPYING.txt
  2. +0 −20 LICENSE.txt
  3. +32 −3 README.md
  4. +11 −3 gemspec.yml
  5. +21 −0 lib/ffi/extractor.rb
  6. +45 −0 lib/ffi/extractor/extractor.rb
  7. +257 −0 lib/ffi/extractor/types.rb
  8. +20 −0 lib/ffi/extractor/version.rb
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,20 +0,0 @@
-Copyright (c) 2012 Postmodern
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -7,7 +7,17 @@
## Description
-TODO: Description
+Ruby FFI bindings to [libextractor], a library for extracting metadata from
+a variety of file formats.
+
+[libextractor] is a simple library for keyword extraction. libextractor
+does not support all formats but supports a simple plugging mechanism
+such that you can quickly add extractors for additional formats, even
+without recompiling libextractor. libextractor typically ships with a
+dozen helper-libraries that can be used to obtain keywords from common
+file-types.
+
+libextractor is a part of the [GNU project](http://www.gnu.org/).
## Features
@@ -17,12 +27,31 @@ TODO: Description
## Requirements
+* [ffi] ~> 1.0
+
## Install
$ gem install ffi-extractor
## Copyright
-Copyright (c) 2012 Postmodern
+ffi-extractor - Ruby FFI bindings for libextractor
+
+Copyright (c) 2012 - Hal Brodigan (postmodern.mod3 at gmail.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-See {file:LICENSE.txt} for details.
+[libextractor]: http://www.gnu.org/software/libextractor
+[ffi]: https://github.com/ffi/ffi#readme
View
@@ -1,11 +1,19 @@
name: ffi-extractor
-summary: "TODO: Summary"
-description: "TODO: Description"
-license: MIT
+summary: Ruby FFI bindings to libextractor
+description:
+ Ruby FFI bindings to libextractor, a library for extracting metadata from
+ a variety of file formats.
+
+license: GPLv2
authors: Postmodern
email: postmodern.mod3@gmail.com
homepage: https://github.com/postmodern/ffi-extractor#readme
+requirements: libextractor
+
+dependencies:
+ ffi: ~> 1.0
+
development_dependencies:
rspec: ~> 2.4
rubygems-tasks: ~> 0.2
View
@@ -1 +1,22 @@
+#
+# ffi-extractor - Ruby FFI bindings for libextractor
+#
+# Copyright (c) 2012 - Hal Brodigan (postmodern.mod3 at gmail.com)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+require 'ffi/extractor/extractor'
require 'ffi/extractor/version'
@@ -0,0 +1,45 @@
+#
+# ffi-extractor - Ruby FFI bindings for libextractor
+#
+# Copyright (c) 2012 - Hal Brodigan (postmodern.mod3 at gmail.com)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+require 'ffi/extractor/types'
+
+require 'ffi'
+
+module FFI
+ module Extractor
+ extend FFI::Library
+
+ ffi_lib ['extractor', 'libextractor.so.3']
+
+ attach_function :EXTRACTOR_metatype_to_string, [:extractor_meta_type], :string
+ attach_function :EXTRACTOR_metatype_to_description, [:extractor_meta_type], :string
+ attach_function :EXTRACTOR_metatype_get_max, [], :extractor_meta_type
+
+ attach_function :EXTRACTOR_plugin_add_defaults, [:extractor_options], :extractor_plugin_list
+ attach_function :EXTRACTOR_plugin_add, [:extractor_plugin_list, :string, :string, :extractor_options], :extractor_plugin_list
+ attach_function :EXTRACTOR_plugin_add_config, [:extractor_plugin_list, :string, :extractor_options], :extractor_plugin_list
+ attach_function :EXTRACTOR_plugin_remove, [:extractor_plugin_list, :string], :extractor_plugin_list
+ attach_function :EXTRACTOR_plugin_remove_all, [:extractor_plugin_list], :void
+
+ attach_function :EXTRACTOR_extract, [:extractor_plugin_list, :string, :pointer, :size_t, :extractor_meta_data_processor, :pointer], :void
+ attach_function :EXTRACTOR_meta_data_print, [:pointer, :string, :extractor_meta_type, :extractor_meta_format, :string, :string, :size_t], :int
+
+ end
+end
Oops, something went wrong.

0 comments on commit 0de8f59

Please sign in to comment.