2 * Copyright (C) 2007 by INdT
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * @author Gustavo Sverzut Barbieri <gustavo.barbieri@openbossa.org>
25 #include <lightmediascanner.h>
30 usage(const char *prgname)
34 "\t%s <commit-interval> <slave-timeout> <db-path> <parser> "
35 "<charset> <scan-path>\n"
41 main(int argc, char *argv[])
43 char *db_path, *parser_name, *charset, *scan_path;
46 int commit_interval, slave_timeout;
53 commit_interval = atoi(argv[1]);
54 slave_timeout = atoi(argv[2]);
56 parser_name = argv[4];
60 lms = lms_new(db_path);
63 "ERROR: could not create light media scanner for DB \"%s\".\n",
68 lms_set_commit_interval(lms, commit_interval);
69 lms_set_slave_timeout(lms, slave_timeout);
71 parser = lms_parser_find_and_add(lms, parser_name);
73 fprintf(stderr, "ERROR: could not create parser \"%s\".\n",
79 if (lms_charset_add(lms, charset) != 0) {
80 fprintf(stderr, "ERROR: could not add charset '%s'\n", charset);
85 if (lms_check(lms, scan_path) != 0) {
86 fprintf(stderr, "ERROR: checking \"%s\".\n", scan_path);
91 if (lms_process(lms, scan_path) != 0) {
92 fprintf(stderr, "ERROR: processing \"%s\".\n", scan_path);
97 if (lms_free(lms) != 0) {
98 fprintf(stderr, "ERROR: could not close light media scanner.\n");