From: tak Date: Wed, 2 Jan 2008 17:16:32 +0000 (+0000) Subject: Ruby binding X-Git-Url: https://vcs.maemo.org/git/?p=lms;a=commitdiff_plain;h=f6b1222d2fa9e57e14017efa9e6f525080344dcb Ruby binding --- diff --git a/packages/ruby-lightmediascanner/debian/changelog b/packages/ruby-lightmediascanner/debian/changelog new file mode 100644 index 0000000..0d33451 --- /dev/null +++ b/packages/ruby-lightmediascanner/debian/changelog @@ -0,0 +1,6 @@ +ruby-lightmediascanner (0.1.0-maemo.1) unstable; urgency=low + + * Initial release + + -- Levi Bard Fri, 14 Dec 2007 01:51:37 -0500 + diff --git a/packages/ruby-lightmediascanner/debian/compat b/packages/ruby-lightmediascanner/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/packages/ruby-lightmediascanner/debian/compat @@ -0,0 +1 @@ +4 diff --git a/packages/ruby-lightmediascanner/debian/control b/packages/ruby-lightmediascanner/debian/control new file mode 100644 index 0000000..5a285fa --- /dev/null +++ b/packages/ruby-lightmediascanner/debian/control @@ -0,0 +1,20 @@ +Source: ruby-lightmediascanner +Priority: optional +Maintainer: Levi Bard +Build-Depends: debhelper, cdbs, liblightmediascanner-dev, libruby1.8-dev | ruby1.8-dev +Standards-Version: 3.6.1 + +Package: ruby1.8-lightmediascanner +Section: libs +Priority: optional +Architecture: any +Depends: ${shlibs:Depends}, libruby1.8, liblightmediascanner0 +Description: Lightweight library to scan media. + Light Media Scanner scans media, parsing and storing data in + a SQLite3 database. Provides safe execution by executing the + parsers in another process, that will be monitored and killed + if it takes more time than allowed. + . + This package contains the ruby bindings for lightmediascanner. + . + Homepage: http://lms.garage.maemo.org diff --git a/packages/ruby-lightmediascanner/debian/copyright b/packages/ruby-lightmediascanner/debian/copyright new file mode 100644 index 0000000..606857b --- /dev/null +++ b/packages/ruby-lightmediascanner/debian/copyright @@ -0,0 +1,27 @@ +This package was debianized by Eduardo Lima (Etrunko) +on Tue, 11 Dec 2007 02:45:40 -0200. + +The source is downloaded from the light media scanner maemo garage SVN tree. +For more information, see: + + http://lms.garage.maemo.org + +Upstream Authors: Gustavo Sverzut Barbieri + +Copyright: + +Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser 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 Lesser General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. diff --git a/packages/ruby-lightmediascanner/debian/rules b/packages/ruby-lightmediascanner/debian/rules new file mode 100755 index 0000000..ac5b988 --- /dev/null +++ b/packages/ruby-lightmediascanner/debian/rules @@ -0,0 +1,60 @@ +#!/usr/bin/make -f + +#PYVER=2.5 +#PYTHON=python$(PYVER) +# +#p_base=$(PYTHON)-lightmediascanner +#d_base=debian/$(p_base) +# +DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) + +ifneq (,$(findstring armel,$(DEB_BUILD_ARCH))) + CFLAGS += -DNDEBUG=1 -fomit-frame-pointer -O2 -ffast-math -funsafe-math-optimizations -fno-math-errno -fsingle-precision-constant + ifneq (,$(findstring n8x0,$(DEB_BUILD_OPTIONS))) + CFLAGS += -mfpu=vfp -mfloat-abi=softfp -mcpu=arm1136jf-s + endif + ifneq (,$(findstring n770,$(DEB_BUILD_OPTIONS))) + CFLAGS += -mcpu=arm926ej-s + endif +endif + +configure: configure-stamp +configure-stamp: + ./extconf.rb + +build: configure build-stamp +build-stamp: + dh_testdir + CFLAGS="$(CFLAGS)" $(MAKE) + touch build-stamp +clean: + dh_testdir + dh_testroot + if test -f Makefile ; then $(MAKE) clean; rm Makefile; fi + -rm -f build-stamp + -rm -rf build dist + dh_clean + +install: build + dh_testdir + dh_testroot + dh_installdirs + $(MAKE) install DESTDIR=$(CURDIR)/debian/ruby1.8-lightmediascanner + + #$(PYTHON) setup.py install --root=$(d_base) + +binary: binary-indep binary-arch +binary-indep: install +binary-arch: install + dh_testdir + dh_testroot + dh_strip + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +.PHONY: build install clean binary binary-indep binary-arch diff --git a/ruby-lightmediascanner/extconf.rb b/ruby-lightmediascanner/extconf.rb new file mode 100755 index 0000000..8ba5263 --- /dev/null +++ b/ruby-lightmediascanner/extconf.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby +# +# Copyright (C) 2007 by Levi Bard +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser 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 Lesser General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# @author Levi Bard +# + +require 'mkmf' + +ExtensionName = 'lightmediascanner' +$CFLAGS = `pkg-config --cflags lightmediascanner` +$LDFLAGS = `pkg-config --libs lightmediascanner` +$prefix = '/usr' + +dir_config(ExtensionName) +create_makefile(ExtensionName) diff --git a/ruby-lightmediascanner/lightmediascanner-unittest.rb b/ruby-lightmediascanner/lightmediascanner-unittest.rb new file mode 100755 index 0000000..508cce6 --- /dev/null +++ b/ruby-lightmediascanner/lightmediascanner-unittest.rb @@ -0,0 +1,90 @@ +#!/usr/bin/env ruby +# +# Copyright (C) 2007 by Levi Bard +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser 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 Lesser General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# @author Levi Bard +# + + +require 'lightmediascanner' + +if(__FILE__ == $0) + require 'test/unit' + + class LightMediaScanner::Test < Test::Unit::TestCase + include LightMediaScanner + + def test_module() + assert(LightMediaScanner::constants.include?('Scanner')) + assert(LightMediaScanner::constants.include?('Parser')) + end + + def test_scanner_gooddata() + dbPath = '/' + timeout = 60000 + commitInterval = 1000 + + lms = nil + assert_nothing_raised(){ lms = Scanner.new(dbPath) } + assert_equal(dbPath, lms.db_path) + + lms.timeout=timeout + assert_equal(lms.timeout, timeout) + + assert(!lms.processing?) + + lms.commit_interval = commitInterval + assert_equal(lms.commit_interval, commitInterval) + + assert_raise(RuntimeError){ lms.process('/') } + assert_raise(RuntimeError){ lms.check('/') } + assert_nothing_raised(){ lms.add_charset('ISO-8859-1') } + assert_nothing_raised(){ lms.remove_charset('ISO-8859-1') } + assert_raise(RuntimeError){ Parser.new(lms, 'blah') } + end + + def test_scanner_baddata() + dbPath = '/' + timeout = 60000 + commitInterval = 1000 + + lms = nil + assert_raise(TypeError){ lms = Scanner.new(nil) } + assert_nothing_raised(){ lms = Scanner.new(dbPath) } + assert_equal(dbPath, lms.db_path) + + assert_raise(TypeError){ lms.timeout = 'Jared' } + assert_raise(TypeError){ lms.timeout = 3.14159 } + + assert_raise(TypeError){ lms.commit_interval = 2.72 } + assert_raise(TypeError){ lms.commit_interval = nil } + + assert_raise(TypeError){ lms.process(nil) } + assert_raise(TypeError){ lms.process(3) } + + assert_raise(TypeError){ lms.check(lms) } + assert_raise(TypeError){ lms.check(5.43) } + + assert_raise(TypeError){ lms.add_charset(nil) } + assert_raise(TypeError){ lms.add_charset(42) } + assert_raise(RuntimeError){ lms.add_charset('I CAN HAZ CHARSET?') } + + assert_raise(RuntimeError){ lms.remove_charset('EBCDIC') } + assert_raise(TypeError){ lms.remove_charset(nil) } + end + end +end diff --git a/ruby-lightmediascanner/lightmediascanner_parser.c b/ruby-lightmediascanner/lightmediascanner_parser.c new file mode 100644 index 0000000..d23c66f --- /dev/null +++ b/ruby-lightmediascanner/lightmediascanner_parser.c @@ -0,0 +1,112 @@ +/** + * Copyright (C) 2007 by Levi Bard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * @author Levi Bard + */ + +#include "lightmediascanner_parser.h" + +typedef struct { + lms_plugin_t *plugin; + lms_t *parent; +} ParserRuby; + +/** + * Native memory deletion function + * @param self The current Parser instance + * @return nil + */ +static VALUE parser_free(VALUE self) { + ParserRuby *parser; + Data_Get_Struct(self, ParserRuby, parser); + + if(parser->plugin) { + lms_parser_del(parser->parent, parser->plugin); + }// delete plugin + + free(parser); + + return Qnil; +}// parser_free + +#if 0 +// Obsolete +/** + * Add parser plugin, given its shared object path. + * @param self The current Parser instance + * @param name path to shared object (usable by dlopen(3)). + * @return A new Parser + */ +static VALUE scanner_add_parser(VALUE self, VALUE name) { + lms_t *lms; + lms_plugin_t *plugin = NULL; + char *cname = NULL; + + Check_Type(name, T_STRING); + + Data_Get_Struct(self, lms_t, lms); + cname = StringValuePtr(name); + + if(!(plugin = lms_parser_add(lms, cname))) { + plugin = lms_parser_find_and_add(lms, cname); + if(!plugin) { + rb_raise(rb_eRuntimeError, "Unable to load plugin '%s'", cname); + }// throw! + }// search + + //wrap and return plugin + return lightmediascanner_parser_new(lms, plugin); +}// scanner_add_parser +#endif + +/** + * Parser#new + * constructor + * @param obj The LightMediaScanner::Parser class + * @param parent The Scanner to which the parser belongs + * @param name path to shared object (usable by dlopen(3)). + * @return A new Parser + */ +static VALUE parser_new(VALUE obj, VALUE parent, VALUE name) { + lms_t *lms; + char *cname = NULL; + ParserRuby *parser = NULL; + lms_plugin_t *plugin = NULL; + + Check_Type(name, T_STRING); + + Data_Get_Struct(parent, lms_t, lms); + cname = StringValuePtr(name); + + if(!(plugin = lms_parser_add(lms, cname))) { + plugin = lms_parser_find_and_add(lms, cname); + if(!plugin) { + rb_raise(rb_eRuntimeError, "Unable to load plugin '%s'", cname); + }// throw! + }// search + + parser = (ParserRuby*)malloc(sizeof(ParserRuby)); + parser->parent = lms; + parser->plugin = plugin; + + return Data_Wrap_Struct(lightmediascanner_parser, 0, parser_free, parser); +}// scanner_new + +void Init_lightmediascanner_parser() { + lightmediascanner_parser = rb_define_class_under(lightmediascanner_module, "Parser", rb_cObject); + rb_define_singleton_method(lightmediascanner_parser, "new", parser_new, 2); +}// Init_lightmediaparser_parser diff --git a/ruby-lightmediascanner/lightmediascanner_parser.h b/ruby-lightmediascanner/lightmediascanner_parser.h new file mode 100644 index 0000000..411236b --- /dev/null +++ b/ruby-lightmediascanner/lightmediascanner_parser.h @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2007 by Levi Bard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * @author Levi Bard + */ + +#ifndef LIGHTMEDIAPARSER_LIGHTMEDIAPARSER_LIGHTMEDIAPARSER_H +#define LIGHTMEDIAPARSER_LIGHTMEDIAPARSER_LIGHTMEDIAPARSER_H + +#include "ruby-lightmediascanner.h" + +VALUE lightmediascanner_parser; + +#endif +//LIGHTMEDIAPARSER_LIGHTMEDIAPARSER_LIGHTMEDIAPARSER_H + diff --git a/ruby-lightmediascanner/lightmediascanner_scanner.c b/ruby-lightmediascanner/lightmediascanner_scanner.c new file mode 100644 index 0000000..af953c8 --- /dev/null +++ b/ruby-lightmediascanner/lightmediascanner_scanner.c @@ -0,0 +1,231 @@ +/** + * Copyright (C) 2007 by Levi Bard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * @author Levi Bard + */ + +#include "lightmediascanner_scanner.h" + +/** + * Scanner#new + * constructor + * @param obj The LightMediaScanner::Scanner class + * @param db_path The path to the sqlite3 db to be used + * @return A new Scanner instance + */ +static VALUE scanner_new(VALUE obj, VALUE db_path) { + Check_Type(db_path, T_STRING); + return Data_Wrap_Struct(lightmediascanner_scanner, 0, lms_free, lms_new(StringValuePtr(db_path))); +}// scanner_new + +/** + * Scanner::process + * This will add or update media found in the given directory or its children. + * @param self The current Scanner instance + * @param top_path The top directory to scan. + * @return 0 on success + */ +static VALUE scanner_process(VALUE self, VALUE top_path) { + lms_t *lms; + int rv = 0; + char *ctop_path = NULL; + + Check_Type(top_path, T_STRING); + Data_Get_Struct(self, lms_t, lms); + ctop_path = StringValuePtr(top_path); + + rv = lms_process(lms, ctop_path); + + if(rv) { + rb_raise(rb_eRuntimeError, "Failure processing %s", ctop_path); + }// FAIL + + return INT2FIX(lms_process(lms, StringValuePtr(top_path))); +}// scanner_process + +/** + * Scanner::check + * Check consistency of the given directory. + * @param self The current Scanner instance + * @param top_path The top directory to scan. + * @return 0 on success + */ +static VALUE scanner_check(VALUE self, VALUE top_path) { + lms_t *lms; + int rv = 0; + char *ctop_path = NULL; + + Check_Type(top_path, T_STRING); + Data_Get_Struct(self, lms_t, lms); + ctop_path = StringValuePtr(top_path); + + rv = lms_process(lms, ctop_path); + + if(rv) { + rb_raise(rb_eRuntimeError, "Failure checking %s", ctop_path); + }// FAIL + + return INT2FIX(lms_check(lms, StringValuePtr(top_path))); +}// scanner_check + +/** + * Scanner::db_path + * Accessor for LMS DB path. + * @param self The current Scanner instance + * @return The database path given at creation time + */ +static VALUE scanner_db_path(VALUE self) { + lms_t *lms; + Data_Get_Struct(self, lms_t, lms); + + return rb_tainted_str_new2(lms_get_db_path(lms)); +}// scanner_db_path + +/** + * Scanner::processing? + * Checks if Light Media Scanner is being used in a processing operation like lms_process() or lms_check(). + * @param self The current Scanner instance + * @return Boolean representing the instance's processing state + */ +static VALUE scanner_processing(VALUE self) { + lms_t *lms; + Data_Get_Struct(self, lms_t, lms); + + return (lms_is_processing(lms)? Qtrue: Qfalse); +}// scanner_processing + +/** + * Scanner::timeout + * Get the maximum amount of milliseconds the slave can take to serve one file. + * If a slave takes more than this amount of milliseconds, it will be killed and the scanner will continue with the next file. + * @param self The current Scanner instance + * @return The timeout in milliseconds, or -1 on error + */ +static VALUE scanner_get_slave_timeout(VALUE self) { + lms_t *lms; + Data_Get_Struct(self, lms_t, lms); + + return INT2FIX(lms_get_slave_timeout(lms)); +}// scanner_get_slave_timeout + +/** + * Scanner::timeout= + * Set the maximum amount of milliseconds the slave can take to serve one file. + * If a slave takes more than this amount of milliseconds, it will be killed and the scanner will continue with the next file. + * @param self The current Scanner instance + * @param timeout_ms The timeout in milliseconds + * @return The new timeout, in milliseconds + */ +static VALUE scanner_set_slave_timeout(VALUE self, VALUE timeout_ms) { + lms_t *lms; + + Check_Type(timeout_ms, T_FIXNUM); + Data_Get_Struct(self, lms_t, lms); + + lms_set_slave_timeout(lms, FIX2INT(timeout_ms)); + return INT2FIX(lms_get_slave_timeout(lms)); +}// scanner_set_slave_timeout + +/** + * Scanner::commit_interval + * Get the number of files served between database transactions. + * @param self The current Scanner instance + * @return The number of files served between database transactions + */ +static VALUE scanner_get_commit_interval(VALUE self) { + lms_t *lms; + Data_Get_Struct(self, lms_t, lms); + + return INT2FIX(lms_get_commit_interval(lms)); +}// scanner_get_commit_interval + +/** + * Scanner::commit_interval= + * Set the number of files to be served between database transactions. + * @param self The current Scanner instance + * @param transactions The number of files between commits + * @return The new number of files to be served between database transactions + */ +static VALUE scanner_set_commit_interval(VALUE self, VALUE transactions) { + lms_t *lms; + + Check_Type(transactions, T_FIXNUM); + Data_Get_Struct(self, lms_t, lms); + + lms_set_commit_interval(lms, FIX2INT(transactions)); + return INT2FIX(lms_get_commit_interval(lms)); +}// scanner_set_commit_interval + +/** + * Scanner::add_charset + * Register a new charset encoding to be used. + * Throws a RuntimeError if LMS is unable to add the charset. + * @param self The current Scanner instance + * @param charset charset name as understood by iconv_open(3). + * @return charset + */ +static VALUE scanner_add_charset(VALUE self, VALUE charset) { + lms_t *lms; + char *ccharset = NULL; + + Check_Type(charset, T_STRING); + Data_Get_Struct(self, lms_t, lms); + ccharset = StringValuePtr(charset); + + if(lms_charset_add(lms, ccharset)) { + rb_raise(rb_eRuntimeError, "Unable to add charset %s", ccharset); + }//FAIL + + return charset; +}// scanner_add_charset + +/** + * Scanner::remove_charset + * Forget about a registered charset encoding. + * Throws a RuntimeError if LMS is unable to remove the charset. + * @param self The current Scanner instance + * @param charset charset name as understood by iconv_open(3). + * @return charset + */ +static VALUE scanner_remove_charset(VALUE self, VALUE charset) { + lms_t *lms; + char *ccharset = NULL; + + Check_Type(charset, T_STRING); + Data_Get_Struct(self, lms_t, lms); + ccharset = StringValuePtr(charset); + if(lms_charset_del(lms, ccharset)) { + rb_raise(rb_eRuntimeError, "Unable to remove charset %s", ccharset); + }//FAIL + + return charset; +}// scanner_remove_charset + +void Init_lightmediascanner_scanner() { + lightmediascanner_scanner = rb_define_class_under(lightmediascanner_module, "Scanner", rb_cObject); + rb_define_singleton_method(lightmediascanner_scanner, "new", scanner_new, 1); + rb_define_method(lightmediascanner_scanner, "process", scanner_process, 1); + rb_define_method(lightmediascanner_scanner, "check", scanner_check, 1); + rb_define_method(lightmediascanner_scanner, "db_path", scanner_db_path, 0); + rb_define_method(lightmediascanner_scanner, "processing?", scanner_processing, 0); + rb_define_method(lightmediascanner_scanner, "timeout", scanner_get_slave_timeout, 0); + rb_define_method(lightmediascanner_scanner, "timeout=", scanner_set_slave_timeout, 1); + rb_define_method(lightmediascanner_scanner, "commit_interval", scanner_get_commit_interval, 0); + rb_define_method(lightmediascanner_scanner, "commit_interval=", scanner_set_commit_interval, 1); + rb_define_method(lightmediascanner_scanner, "add_charset", scanner_add_charset, 1); + rb_define_method(lightmediascanner_scanner, "remove_charset", scanner_remove_charset, 1); +}// Init_lightmediascanner diff --git a/ruby-lightmediascanner/lightmediascanner_scanner.h b/ruby-lightmediascanner/lightmediascanner_scanner.h new file mode 100644 index 0000000..d56617a --- /dev/null +++ b/ruby-lightmediascanner/lightmediascanner_scanner.h @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2007 by Levi Bard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * @author Levi Bard + */ + +#ifndef LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_H +#define LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_H + +#include "ruby-lightmediascanner.h" + +/// Holds the class for LightMediaScanner::Scanner +VALUE lightmediascanner_scanner; + +#endif +//LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_H + diff --git a/ruby-lightmediascanner/ruby-lightmediascanner.c b/ruby-lightmediascanner/ruby-lightmediascanner.c new file mode 100644 index 0000000..b707af1 --- /dev/null +++ b/ruby-lightmediascanner/ruby-lightmediascanner.c @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2007 by Levi Bard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * @author Levi Bard + */ + +#include "ruby-lightmediascanner.h" + +void Init_lightmediascanner() { + lightmediascanner_module = rb_define_module("LightMediaScanner"); + Init_lightmediascanner_scanner(); + Init_lightmediascanner_parser(); +}// Init_lightmediascanner diff --git a/ruby-lightmediascanner/ruby-lightmediascanner.h b/ruby-lightmediascanner/ruby-lightmediascanner.h new file mode 100644 index 0000000..5d87eff --- /dev/null +++ b/ruby-lightmediascanner/ruby-lightmediascanner.h @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2007 by Levi Bard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * @author Levi Bard + */ + +#ifndef LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_H +#define LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_H + +#include +#include +#include + +/** + * LightMediaScanner module + * Namespacing module for all LMS classes + */ +VALUE lightmediascanner_module; + +/// Initializes the LightMediaScanner module +void Init_lightmediascanner(); + +/// Initializes the LightMediaScanner::Scanner class +void Init_lightmediascanner_scanner(); + +#endif +//LIGHTMEDIASCANNER_LIGHTMEDIASCANNER_H +