diff options
author | Christophe Fergeau <teuf@gnome.org> | 2005-09-10 08:34:34 +0000 |
---|---|---|
committer | Christophe Fergeau <teuf@gnome.org> | 2005-09-10 08:34:34 +0000 |
commit | 0ab16882c390a86d28e26475b4a5e103e1e1c928 (patch) | |
tree | 40a0bf871909c8a32c2fd12dd9e137dd960dc68b /tests | |
parent | e0b984b1f54de9ecd6bbf5b3f0e31e8677de3d54 (diff) | |
download | libgpod-tmz-0ab16882c390a86d28e26475b4a5e103e1e1c928.tar.gz libgpod-tmz-0ab16882c390a86d28e26475b4a5e103e1e1c928.tar.xz libgpod-tmz-0ab16882c390a86d28e26475b4a5e103e1e1c928.zip |
Initial import
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1080 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rw-r--r-- | tests/itdb_main.c | 88 |
2 files changed, 95 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..a436696 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,7 @@ +noinst_PROGRAMS=test-itdb + +INCLUDES=$(LIBGPOD_CFLAGS) -I$(top_srcdir)/src -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" +LIBS=$(LIBGPOD_LIBS) + +test_itdb_SOURCES = itdb_main.c +test_itdb_LDADD = $(top_builddir)/src/libgpod.la diff --git a/tests/itdb_main.c b/tests/itdb_main.c new file mode 100644 index 0000000..fd81cff --- /dev/null +++ b/tests/itdb_main.c @@ -0,0 +1,88 @@ +/* +| Copyright (C) 2002-2003 Jorg Schuler <jcsjcs at users.sourceforge.net> +| Part of the gtkpod project. +| +| URL: http://gtkpod.sourceforge.net/ +| +| 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +| +| iTunes and iPod are trademarks of Apple +| +| This product is not supported/written/published by Apple! +| +| $Id$ +*/ +/* + * Initial main.c file generated by Glade. Edit as required. + * Glade will not overwrite this file. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <libintl.h> + +#include "itdb.h" + +int +main (int argc, char *argv[]) +{ +#ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); +#endif + + GError *error=NULL; + Itdb_iTunesDB *itdb; + + if (argc == 2) + itdb = itdb_parse_file (argv[1], &error); + else itdb = itdb_parse_file ("/home/jcs/.gtkpod/iTunesDB20050102", + &error); + + printf ("%p\n", itdb); + if (error) + { + if (error->message) + puts (error->message); + g_error_free (error); + error = NULL; + } + + if (itdb) + { + printf ("tracks: %d\n", g_list_length (itdb->tracks)); + printf ("playlists: %d\n", g_list_length (itdb->playlists)); + + itdb_write_file (itdb, "/home/jcs/.gtkpod/iTunesDB", &error); + if (error) + { + if (error->message) + puts (error->message); + g_error_free (error); + error = NULL; + } + } + + itdb_free (itdb); + + /* all the cleanup is already done in gtkpod_main_quit() in misc.c */ + return 0; +} |