export parsers and their informations.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Tue, 21 Oct 2008 18:50:22 +0000 (16:50 -0200)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Tue, 21 Oct 2008 19:18:39 +0000 (17:18 -0200)
It is now possible to list all known parsers and retrieve information
about them, like category and description.

19 files changed:
src/bin/.gitignore
src/bin/Makefile.am
src/bin/list-parsers.c [new file with mode: 0644]
src/lib/lightmediascanner.c
src/lib/lightmediascanner.h
src/lib/lightmediascanner_plugin.h
src/plugins/asf/asf.c
src/plugins/audio-dummy/audio-dummy.c
src/plugins/dummy/dummy.c
src/plugins/flac/flac.c
src/plugins/id3/id3.c
src/plugins/jpeg/jpeg.c
src/plugins/m3u/m3u.c
src/plugins/mp4/mp4.c
src/plugins/ogg/ogg.c
src/plugins/pls/pls.c
src/plugins/png/png.c
src/plugins/rm/rm.c
src/plugins/video-dummy/video-dummy.c

index 9daeafb..eee8ab6 100644 (file)
@@ -1 +1,2 @@
 test
+list-parsers
index d6b7e4f..174c3a3 100644 (file)
@@ -4,9 +4,16 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/lib
 
 noinst_PROGRAMS = \
-       test
+       test \
+       list-parsers
 
 
 test_SOURCES = test.c
 test_LDADD = $(top_builddir)/src/lib/liblightmediascanner.la @SQLITE3_LIBS@
 test_DEPENDENCIES = $(top_builddir)/src/lib/liblightmediascanner.la
+
+
+list_parsers_SOURCES = list-parsers.c
+list_parsers_LDADD = $(top_builddir)/src/lib/liblightmediascanner.la \
+       @SQLITE3_LIBS@
+list_parsers_DEPENDENCIES = $(top_builddir)/src/lib/liblightmediascanner.la
diff --git a/src/bin/list-parsers.c b/src/bin/list-parsers.c
new file mode 100644 (file)
index 0000000..0c28402
--- /dev/null
@@ -0,0 +1,90 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <lightmediascanner.h>
+
+static void
+usage(const char *prgname)
+{
+    fprintf(stderr,
+            "Usage:\n"
+            "\t%s [category]\n"
+            "no category means all parsers.\n",
+            prgname);
+}
+
+static void
+print_array(const char * const *array)
+{
+    if (!array)
+        return;
+
+    for (; *array != NULL; array++)
+        printf("\t\t%s\n", *array);
+}
+
+static void
+print_parser(const char *path, const struct lms_parser_info *info)
+{
+    printf("parser: %s", path);
+
+    if (!info) {
+        fputs(" --- no information\n", stdout);
+        return;
+    }
+
+    fputc('\n', stdout);
+    printf("\tname.......: %s\n", info->name);
+    printf("\tcategories.:\n");
+    print_array(info->categories);
+    printf("\tdescription: %s\n", info->description);
+    printf("\tversion....: %s\n", info->version);
+    printf("\tauthors....:\n");
+    print_array(info->authors);
+    printf("\turi........: %s\n", info->uri);
+    fputc('\n', stdout);
+}
+
+static int
+list_by_category(void *data, const char *path, const struct lms_parser_info *info)
+{
+    print_parser(path, info);
+    return 1;
+}
+
+static int
+list_parser(void *data, const char *path)
+{
+    struct lms_parser_info *info;
+
+    info = lms_parser_info(path);
+    print_parser(path, info);
+    lms_parser_info_free(info);
+    return 1;
+}
+
+int
+main(int argc, char *argv[])
+{
+    int i;
+    char *category = NULL;
+
+    for (i = 1; i < argc; i++)
+        if (argv[i][0] == '-') {
+            if (strcmp(argv[i], "-h") == 0 ||
+                strcmp(argv[i], "--help") == 0) {
+                usage(argv[0]);
+                return 1;
+            } else {
+                fprintf(stderr, "ERROR: unknown option %s\n", argv[i]);
+                return 1;
+            }
+        } else
+            category = argv[i];
+
+    if (category)
+        lms_parsers_list_by_category(category, list_by_category, NULL);
+    else
+        lms_parsers_list(list_parser, NULL);
+    return 0;
+}
index c85c735..4e675ef 100644 (file)
@@ -26,6 +26,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <dirent.h>
+#include <errno.h>
 
 #include "lightmediascanner.h"
 #include "lightmediascanner_private.h"
@@ -248,6 +250,19 @@ lms_parser_add(lms_t *lms, const char *so_path)
     return parser->plugin;
 }
 
+static int
+lms_parser_find(char *buf, int buf_size, const char *name)
+{
+    int r;
+
+    r = snprintf(buf, buf_size, "%s/%s.so", PLUGINSDIR, name);
+    if (r >= buf_size)
+        return 0;
+
+    return 1;
+}
+
+
 /**
  * Add parser plugin given it's name.
  *
@@ -270,7 +285,8 @@ lms_parser_find_and_add(lms_t *lms, const char *name)
     if (!name)
         return NULL;
 
-    snprintf(so_path, sizeof(so_path), "%s/%s.so", PLUGINSDIR, name);
+    if (!lms_parser_find(so_path, sizeof(so_path), name))
+        return NULL;
     return lms_parser_add(lms, so_path);
 }
 
@@ -509,3 +525,316 @@ lms_charset_del(lms_t *lms, const char *charset)
 
     return lms_charset_conv_del(lms->cs_conv, charset);
 }
+
+/**
+ * List all known parsers on the system.
+ *
+ * No information is retrieved, you might like to call lms_parser_info()
+ * on the callback path.
+ *
+ * @param cb function to call for each path found. If it returns 0,
+ *        it stops iteraction.
+ * @param data extra data to pass to @a cb on every call.
+ */
+void
+lms_parsers_list(int (*cb)(void *data, const char *path), const void *data)
+{
+    void *datap = (void *)data;
+    char path[PATH_MAX] = PLUGINSDIR;
+    int base;
+    DIR *d;
+    struct dirent *de;
+
+    if (!cb)
+        return;
+
+    base = sizeof(PLUGINSDIR) - 1;
+    if (base + sizeof("/.so") >= PATH_MAX) {
+        fprintf(stderr, "ERROR: path is too long '%s'\n", path);
+        return;
+    }
+
+    d = opendir(path);
+    if (!d) {
+        fprintf(stderr, "ERROR: could not open directory %s: %s\n",
+                path, strerror(errno));
+        return;
+    }
+
+    path[base] = '/';
+    base++;
+
+    while ((de = readdir(d)) != NULL) {
+        int len;
+
+        if (de->d_name[0] == '.')
+            continue;
+
+        len = strlen(de->d_name);
+        if (len < 3 || memcmp(de->d_name + len - 3, ".so", 3) != 0)
+            continue;
+
+        memcpy(path + base, de->d_name, len + 1); /* copy \0 */
+        if (!cb(datap, path))
+            break;
+    }
+    closedir(d);
+}
+
+struct lms_parsers_list_by_category_data {
+    const char *category;
+    int (*cb)(void *data, const char *path, const struct lms_parser_info *info);
+    void *data;
+};
+
+static int
+_lms_parsers_list_by_category(void *data, const char *path)
+{
+    struct lms_parsers_list_by_category_data *d = data;
+    struct lms_parser_info *info;
+    int r;
+
+    info = lms_parser_info(path);
+    if (!info)
+        return 1;
+
+    r = 1;
+    if (info->categories) {
+        const char * const *itr;
+        for (itr = info->categories; *itr != NULL; itr++)
+            if (strcmp(d->category, *itr) == 0) {
+                r = d->cb(d->data, path, info);
+                break;
+            }
+    }
+
+    lms_parser_info_free(info);
+
+    return r;
+}
+
+/**
+ * List all known parsers of a given category.
+ *
+ * Since we need information to figure out parser category, these are
+ * passed as argument to callback, but you should NOT modify or reference it
+ * after callback function returns since it will be released after that.
+ *
+ * @param category which category to match.
+ * @param cb function to call for each path found. If it returns 0,
+ *        it stops iteraction.
+ * @param data extra data to pass to @a cb on every call.
+ */
+void
+lms_parsers_list_by_category(const char *category, int (*cb)(void *data, const char *path, const struct lms_parser_info *info), const void *data)
+{
+    struct lms_parsers_list_by_category_data d;
+
+    if (!category || !cb)
+        return;
+
+    d.category = category;
+    d.cb = cb;
+    d.data = (void *)data;
+
+    lms_parsers_list(_lms_parsers_list_by_category, &d);
+}
+
+static int
+_lms_string_array_count(const char * const *array, int *size)
+{
+    int count, align_overflow;
+
+    *size = 0;
+    if (!array)
+        return 0;
+
+    count = 0;
+    for (; *array != NULL; array++) {
+        *size += sizeof(char *) + strlen(*array) + 1;
+        count++;
+    }
+    if (count) {
+        /* count NULL terminator */
+        count++;
+        *size += sizeof(char *);
+    }
+
+    align_overflow = *size % sizeof(char *);
+    if (align_overflow)
+        *size += sizeof(char *) - align_overflow;
+
+    return count;
+}
+
+static void
+_lms_string_array_copy(char **dst, const char * const *src, int count)
+{
+    char *d;
+
+    d = (char *)(dst + count);
+
+    for (; count > 1; count--, dst++, src++) {
+        int len;
+
+        len = strlen(*src) + 1;
+        *dst = d;
+        memcpy(*dst, *src, len);
+        d += len;
+    }
+
+    *dst = NULL;
+}
+
+/**
+ * Get parser information.
+ *
+ * Information can be used to let user choose parsers on Graphical User
+ * Interfaces.
+ *
+ * @param so_path full path to module.
+ * @see lms_parser_info_find()
+ */
+struct lms_parser_info *
+lms_parser_info(const char *so_path)
+{
+    const struct lms_plugin_info *(*plugin_info)(void);
+    const struct lms_plugin_info *pinfo;
+    struct lms_parser_info *ret;
+    const char *errmsg;
+    void *dl_handle;
+    int len, name_len, desc_len, ver_len, uri_len;
+    int cats_count, cats_size, authors_count, authors_size;
+
+    if (!so_path)
+        return NULL;
+
+    dl_handle = dlopen(so_path, RTLD_NOW | RTLD_LOCAL);
+    errmsg = dlerror();
+    if (errmsg) {
+        fprintf(stderr, "ERROR: could not dlopen() %s\n", errmsg);
+        return NULL;
+    }
+
+    ret = NULL;
+    plugin_info = dlsym(dl_handle, "lms_plugin_info");
+    errmsg = dlerror();
+    if (errmsg) {
+        fprintf(stderr, "ERROR: could not find plugin info function %s\n",
+                errmsg);
+        goto close_and_exit;
+    }
+
+    if (!plugin_info) {
+        fprintf(stderr, "ERROR: lms_plugin_info is NULL\n");
+        goto close_and_exit;
+    }
+
+    pinfo = plugin_info();
+    if (!pinfo) {
+        fprintf(stderr, "ERROR: lms_plugin_info() returned NULL\n");
+        goto close_and_exit;
+    }
+
+    name_len = pinfo->name ? strlen(pinfo->name) + 1 : 0;
+    desc_len = pinfo->description ? strlen(pinfo->description) + 1 : 0;
+    ver_len = pinfo->version ? strlen(pinfo->version) + 1 : 0;
+    uri_len = pinfo->uri ? strlen(pinfo->uri) + 1 : 0;
+
+    cats_count = _lms_string_array_count(pinfo->categories, &cats_size);
+    authors_count = _lms_string_array_count(pinfo->authors, &authors_size);
+
+    len = name_len + desc_len + ver_len + uri_len + cats_size + authors_size;
+    ret = malloc(sizeof(*ret) + len);
+    if (!ret) {
+      fprintf(stderr, "ERROR: could not alloc %d bytes: %s",
+              sizeof(*ret) + len, strerror(errno));
+      goto close_and_exit;
+    }
+
+    len = 0;
+
+    if (cats_count) {
+        ret->categories = (const char * const *)
+            ((char *)ret + sizeof(*ret) + len);
+        _lms_string_array_copy(
+            (char **)ret->categories, pinfo->categories, cats_count);
+        len += cats_size;
+    } else
+        ret->categories = NULL;
+
+    if (authors_count) {
+        ret->authors = (const char * const *)
+            ((char *)ret + sizeof(*ret) + len);
+        _lms_string_array_copy(
+            (char **)ret->authors, pinfo->authors, authors_count);
+        len += authors_size;
+    } else
+        ret->authors = NULL;
+
+    if (pinfo->name) {
+        ret->name = (char *)ret + sizeof(*ret) + len;
+        memcpy((char *)ret->name, pinfo->name, name_len);
+        len += name_len;
+    } else
+        ret->name = NULL;
+
+    if (pinfo->description) {
+        ret->description = (char *)ret + sizeof(*ret) + len;
+        memcpy((char *)ret->description, pinfo->description, desc_len);
+        len += desc_len;
+    } else
+        ret->description = NULL;
+
+    if (pinfo->version) {
+        ret->version = (char *)ret + sizeof(*ret) + len;
+        memcpy((char *)ret->version, pinfo->version, ver_len);
+        len += ver_len;
+    } else
+        ret->version = NULL;
+
+    if (pinfo->uri) {
+        ret->uri = (char *)ret + sizeof(*ret) + len;
+        memcpy((char *)ret->uri, pinfo->uri, uri_len);
+        len += uri_len;
+    } else
+        ret->uri = NULL;
+
+  close_and_exit:
+    dlclose(dl_handle);
+    return ret;
+}
+
+/**
+ * Find parser by name and get its information.
+ *
+ * Information can be used to let user choose parsers on Graphical User
+ * Interfaces.
+ *
+ * @param name name of .so to find the whole so_path and retrieve information.
+ * @see lms_parser_info()
+ */
+struct lms_parser_info *
+lms_parser_info_find(const char *name)
+{
+    char so_path[PATH_MAX];
+
+    if (!name)
+        return NULL;
+
+    if (!lms_parser_find(so_path, sizeof(so_path), name))
+        return NULL;
+
+    return lms_parser_info(so_path);
+}
+
+/**
+ * Free previously returned information.
+ *
+ * @note it is safe to call with NULL.
+ */
+void
+lms_parser_info_free(struct lms_parser_info *info)
+{
+    free(info);
+}
index 3a4226b..808cb48 100644 (file)
@@ -191,6 +191,24 @@ extern "C" {
     API void lms_set_commit_interval(lms_t *lms, unsigned int transactions) GNUC_NON_NULL(1);
     API void lms_set_progress_callback(lms_t *lms, lms_progress_callback_t cb, const void *data, lms_free_callback_t free_data) GNUC_NON_NULL(1);
 
+
+    API void lms_parsers_list(int (*cb)(void *data, const char *path), const void *data);
+
+    struct lms_parser_info {
+        const char *name;
+        const char * const *categories;
+        const char *description;
+        const char *version;
+        const char *const *authors;
+        const char *uri;
+    };
+
+    API struct lms_parser_info *lms_parser_info(const char *so_path);
+    API struct lms_parser_info *lms_parser_info_find(const char *name);
+    API void lms_parser_info_free(struct lms_parser_info *info);
+
+    API void lms_parsers_list_by_category(const char *category, int (*cb)(void *data, const char *path, const struct lms_parser_info *info), const void *data);
+
     API lms_plugin_t *lms_parser_add(lms_t *lms, const char *so_path) GNUC_NON_NULL(1, 2);
     API lms_plugin_t *lms_parser_find_and_add(lms_t *lms, const char *name) GNUC_NON_NULL(1, 2);
     API int lms_parser_del(lms_t *lms, lms_plugin_t *handle) GNUC_NON_NULL(1, 2);
index 2f1bc51..7cf9617 100644 (file)
@@ -1,5 +1,6 @@
 /**
- * Copyright (C) 2007 by INdT
+ * Copyright (C) 2008 by ProFUSION
+ *               2007 by INdT
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -15,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * @author Gustavo Sverzut Barbieri <gustavo.barbieri@openbossa.org>
+ * @author Gustavo Sverzut Barbieri <barbieri@profusion.mobi>
  */
 
 /**
@@ -27,6 +28,7 @@
  *
  * @code
  *    struct lms_plugin *lms_plugin_open(void)
+ *    const struct lms_plugin_info *lms_plugin_info(void)
  * @endcode
  *
  * where:
  *       lms_plugin_start_fn_t start;
  *       lms_plugin_finish_fn_t finish;
  *    };
+ *
+ *
+ *    struct lms_plugin_info {
+ *        const char *name;
+ *        const char *category;
+ *        const char *description;
+ *        const char *version;
+ *        const char *author;
+ *        const char *uri;
+ *    };
  * @endcode
  *
  * Users can add their own data to the end of this data
@@ -162,6 +174,16 @@ extern "C" {
         lms_plugin_finish_fn_t finish; /**< finish plugin */
     };
 
+    struct lms_plugin_info {
+        const char *name; /**< plugin name, should be same as lms_plugin */
+        const char * const *categories; /**< NULL-terminated categories array */
+        const char *description; /**< free text description */
+        const char *version; /**< version string */
+        const char * const *authors; /**< NULL-terminated author array */
+        const char *uri; /**< how to find who wrote it (bug reports, etc) */
+    };
+
+
 #ifdef __cplusplus
 }
 #endif
index de9b4e4..ac1bad1 100644 (file)
@@ -76,6 +76,15 @@ static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".wmv"),
     LMS_STATIC_STRING_SIZE(".asf")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "audio",
+    NULL
+};
+static const char *_authors[] = {
+    "Andre Moreira Magalhaes",
+    NULL
+};
 
 /* ASF GUIDs
  *
@@ -572,3 +581,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "Microsoft WMA, WMV and ASF",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index 292ff5b..79e077e 100644 (file)
@@ -39,6 +39,14 @@ static const char _name[] = "audio-dummy";
 static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".wav")
 };
+static const char *_cats[] = {
+    "audio",
+    NULL
+};
+static const char *_authors[] = {
+    "Gustavo Sverzut Barbieri",
+    NULL
+};
 
 struct plugin {
     struct lms_plugin plugin;
@@ -127,3 +135,19 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "Accept all audio extensions (just WAV now), "
+        "but no metadata is processed.",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index c003ce5..a9eb714 100644 (file)
 #include <stdio.h>
 
 static const char _name[] = "dummy";
+static const char *_cats[] = {
+    "all",
+    "audio",
+    "video",
+    "picture",
+    NULL
+};
+static const char *_authors[] = {
+    "Gustavo Sverzut Barbieri",
+    NULL
+};
 
 struct plugin {
     struct lms_plugin plugin;
@@ -115,3 +126,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "Accept everything and print out to /tmp/dummy-$UID.log",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index 6be7947..0819cd4 100644 (file)
@@ -44,6 +44,15 @@ static const char _name[] = "flac";
 static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".flac")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "audio",
+    NULL
+};
+static const char *_authors[] = {
+    "Andre Moreira Magalhaes",
+    NULL
+};
 
 static void *
 _match(struct plugin *p, const char *path, int len, int base)
@@ -178,3 +187,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "FLAC parser",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index f042b19..a149e13 100644 (file)
@@ -95,6 +95,16 @@ static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".mp3"),
     LMS_STATIC_STRING_SIZE(".aac")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "audio",
+    NULL
+};
+static const char *_authors[] = {
+    "Andre Moreira Magalhaes",
+    "Gustavo Sverzut Barbieri",
+    NULL
+};
 
 static unsigned int
 _to_uint(const char *data, int data_size)
@@ -828,3 +838,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "ID3 v1 and v2 for mp3 files",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index a2f321b..12e0109 100644 (file)
@@ -579,6 +579,15 @@ static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".jpeg"),
     LMS_STATIC_STRING_SIZE(".jpe")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "picture",
+    NULL
+};
+static const char *_authors[] = {
+    "Gustavo Sverzut Barbieri",
+    NULL
+};
 
 struct plugin {
     struct lms_plugin plugin;
@@ -717,3 +726,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "JPEG pictures",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index cc83433..45259b3 100644 (file)
@@ -89,6 +89,16 @@ static const char _name[] = "m3u";
 static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".m3u")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "audio",
+    "playlist",
+    NULL
+};
+static const char *_authors[] = {
+    "Gustavo Sverzut Barbieri",
+    NULL
+};
 
 struct plugin {
     struct lms_plugin plugin;
@@ -191,3 +201,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "M3U playlists (aka WinAMP playlists)",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index 831b16f..aa268ca 100644 (file)
@@ -28,6 +28,8 @@
 #include "config.h"
 #endif
 
+static const char PV[] = PACKAGE_VERSION; /* mp4.h screws PACKAGE_VERSION */
+
 #include <lightmediascanner_plugin.h>
 #include <lightmediascanner_db.h>
 #include <mp4.h>
@@ -62,6 +64,16 @@ static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".qt"),
     LMS_STATIC_STRING_SIZE(".3gp")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "audio",
+    "video",
+    NULL
+};
+static const char *_authors[] = {
+    "Andre Moreira Magalhaes",
+    NULL
+};
 
 static void *
 _match(struct plugin *p, const char *path, int len, int base)
@@ -232,3 +244,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "MP4 files (MP4, M4A, MOV, QT, 3GP)",
+        PV,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index b228d70..f44b4f0 100644 (file)
@@ -221,6 +221,16 @@ static const char _name[] = "ogg";
 static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".ogg")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "audio",
+    NULL
+};
+static const char *_authors[] = {
+    "Renato Chencarek",
+    "Eduardo Lima (Etrunko)",
+    NULL
+};
 
 struct plugin {
     struct lms_plugin plugin;
@@ -332,3 +342,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "OGG files",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index 720150f..503ae35 100644 (file)
@@ -270,6 +270,16 @@ static const char _name[] = "pls";
 static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".pls")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "audio",
+    "playlist",
+    NULL
+};
+static const char *_authors[] = {
+    "Gustavo Sverzut Barbieri",
+    NULL
+};
 
 struct plugin {
     struct lms_plugin plugin;
@@ -373,3 +383,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "Playlists (INI-style)",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index 264fa0f..8c7e158 100644 (file)
@@ -94,6 +94,15 @@ static const char _name[] = "png";
 static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".png")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "picture",
+    NULL
+};
+static const char *_authors[] = {
+    "Gustavo Sverzut Barbieri",
+    NULL
+};
 
 struct plugin {
     struct lms_plugin plugin;
@@ -211,3 +220,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "PNG images",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index b09e232..8f9cd6e 100644 (file)
@@ -77,6 +77,16 @@ static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".rmj"),
     LMS_STATIC_STRING_SIZE(".rmvb")
 };
+static const char *_cats[] = {
+    "multimedia",
+    "audio",
+    "video",
+    NULL
+};
+static const char *_authors[] = {
+    "Andre Moreira Magalhaes",
+    NULL
+};
 
 /*
  * A real media file header has the following format:
@@ -365,3 +375,18 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "Real Networks audio and video files (RA, RV, RM, RMJ, RMVB)",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}
index e0b82e4..529d02f 100644 (file)
@@ -44,6 +44,15 @@ static const struct lms_string_size _exts[] = {
     LMS_STATIC_STRING_SIZE(".ogm"),
     LMS_STATIC_STRING_SIZE(".flv"),
 };
+static const char *_cats[] = {
+    "multimedia",
+    "video",
+    NULL
+};
+static const char *_authors[] = {
+    "Gustavo Sverzut Barbieri",
+    NULL
+};
 
 struct plugin {
     struct lms_plugin plugin;
@@ -132,3 +141,19 @@ lms_plugin_open(void)
 
     return (struct lms_plugin *)plugin;
 }
+
+API struct lms_plugin_info *
+lms_plugin_info(void)
+{
+    static struct lms_plugin_info info = {
+        _name,
+        _cats,
+        "Accept all video extensions (AVI, MPG, MPEG, RAM, OGM, FLV), "
+        "but no metadata is processed.",
+        PACKAGE_VERSION,
+        _authors,
+        "http://lms.garage.maemo.org"
+    };
+
+    return &info;
+}