summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--tests/test-ls.c27
2 files changed, 34 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 1277713..cbfec8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-08-21 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+ * tests/test-ls.c: added option to list contents of local
+ repository and specified playlist. Thanks to Richard Hyde for
+ the patch.
+
+2006-08-18 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+ * src/db-artwork-writer.c (ipod_buffer_grow_file): printf(3) type
+ warnings caused compile error with FreeBSD 6.0-stable/GCC
+ 3.4.4. Thanks to Mike Heffner for the patch.
+
2006-07-08 Jorg Schuler <jcsjcs at users.sourceforge.net>
* src/itdb_itunesdb.c (itdb_write): don't crash if error ==
diff --git a/tests/test-ls.c b/tests/test-ls.c
index b1376bd..f37bc43 100644
--- a/tests/test-ls.c
+++ b/tests/test-ls.c
@@ -28,11 +28,14 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include <libintl.h>
#include "itdb.h"
+#define LOCALDB "/.gtkpod/local_0.itdb"
+
static void
display_track (Itdb_Track *track, const char *prefix)
{
@@ -71,20 +74,32 @@ int
main (int argc, char *argv[])
{
GError *error=NULL;
+ const gchar *homeenv="HOME";
Itdb_iTunesDB *itdb;
- gchar *mountpoint = NULL;
+ gchar *mountpoint = NULL, *playlistname = NULL;
if (argc >= 2)
mountpoint = argv[1];
+ if (argc >= 3)
+ playlistname = argv[2];
+
if (mountpoint == NULL)
{
- g_print ("Usage: %s <mountpoint>\n", g_basename(argv[0]));
+ g_print ("Usage: %s <mountpoint>|-l [<playlistname>]\n\n"
+ "-l - List from the local repository (~" LOCALDB ")\n"
+ "<playlistname> - name of the playlist to list (optional)\n",
+ g_basename(argv[0]));
exit (0);
}
- itdb = itdb_parse (mountpoint, &error);
-
+ if (strcmp(mountpoint, "-l") == 0) {
+ mountpoint = g_build_filename(g_getenv(homeenv), LOCALDB, NULL);
+ itdb = itdb_parse_file (mountpoint, &error);
+ }
+ else
+ itdb = itdb_parse (mountpoint, &error);
+
if (error)
{
if (error->message) {
@@ -103,7 +118,9 @@ main (int argc, char *argv[])
Itdb_Playlist *playlist;
playlist = (Itdb_Playlist *)it->data;
- display_playlist (playlist, "");
+
+ if (playlistname == NULL || strcmp(playlist->name, playlistname) == 0)
+ display_playlist (playlist, "");
}
if (error)