Update of /cvsroot/gtkpod/libgpod/tests
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15094/tests

Modified Files:
        Makefile.am test-ls.c 
Log Message:
        * docs/reference/tmpl/device.sgml
          docs/reference/tmpl/itunesdb-time.sgml
          docs/reference/tmpl/libgpod-unused.sgml
          docs/reference/tmpl/track.sgml
          src/db-artwork-parser.c
          src/db-artwork-writer.c
          src/db-itunes-parser.h
          src/itdb.h
          src/itdb_device.c
          src/itdb_device.h
          src/itdb_itunesdb.c
          src/itdb_private.h
          tests/Makefile.am:

          Christophe's patch for automatic correction of timestamps
          depending on which timezone the iPod is set to.

          ATTENTION DEVELOPERS: as a consequence all exported timestamps
          are no longer guint32 mac-type timestamps but standard time_t
          timestamps. This also includes the 64 bit timestamps in smart
          playlists. The following functions are therefore no longer
          needed and are deprecated:

          itdb_time_mac_to_host(), itdb_time_host_to_mac(): simply return
          the argument without changing it. Argument and return value are
          now both of type 'time_t'.

          itunesdb_time_get_mac_time(): returns the seconds passed since
          Epoch in seconds and is equivalent to time(NULL).

          These functions may be removed in a future version of
          libgpod. Programs linking to libgpod may need to be changed
          slightly if they made any assumptions on the type of timestamps
          used. This should be obvious through compile-time warnings.

          tests/test-ls.c: print a list of recently played tracks.



Index: Makefile.am
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/tests/Makefile.am,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Makefile.am 8 Jan 2007 10:23:15 -0000       1.12
+++ Makefile.am 27 Apr 2007 14:09:59 -0000      1.13
@@ -1,5 +1,5 @@
 if HAVE_GDKPIXBUF
-TESTTHUMBS=test-thumbnails test-write-thumbnails test-photos
+TESTTHUMBS=test-thumbnails test-write-thumbnails test-photos get-timezone
 
 test_thumbnails_SOURCES = test-covers.c
 test_thumbnails_CFLAGS = $(AM_CFLAGS)
@@ -33,6 +33,8 @@
 test_init_ipod_SOURCES = test-init-ipod.c
 test_init_ipod_LDADD = 
 
+get_timezone_SOURCES = get-timezone.c
+
 noinst_PROGRAMS=test-itdb test-ls $(TESTTHUMBS) $(TESTTAGLIB) $(TESTMISC)
 
 INCLUDES=$(LIBGPOD_CFLAGS) -I$(top_srcdir)/src 
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"

Index: test-ls.c
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/tests/test-ls.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test-ls.c   21 Aug 2006 15:08:28 -0000      1.2
+++ test-ls.c   27 Apr 2007 14:09:59 -0000      1.3
@@ -37,6 +37,36 @@
 #define LOCALDB "/.gtkpod/local_0.itdb"
 
 static void
+display_recently_played (Itdb_iTunesDB *db)
+{
+    Itdb_Playlist *mpl = itdb_playlist_mpl (db);
+    GList *it;
+
+    g_print ("Recently played:\n");
+    for (it = mpl->members; it != NULL; it = it->next) {
+        Itdb_Track *track = (Itdb_Track*)it->data;
+
+        if (track->recent_playcount != 0) {
+            char date[30];
+            time_t track_time = itdb_time_mac_to_host (track->time_played);
+
+            g_print ("%s - %s - %s:\n",
+                     track->artist, track->album, track->title);
+            strftime (date, sizeof (date), "%D %H:%M:%S",
+                      gmtime (&track_time));
+            g_print ("\tUTC: %s\n", date);
+            strftime (date, sizeof (date), "%D %H:%M:%S",
+                      localtime (&track_time));
+            g_print ("\tlocal: %s\n", date);
+            g_print ("track: %ld ", track_time);
+            time (&track_time);
+            g_print ("current: %ld\n", track_time);
+            g_print ("\n");
+        }
+    }
+}
+
+static void
 display_track (Itdb_Track *track, const char *prefix) 
 {
     g_print ("%s%s - %s - %s\n", prefix,  
@@ -131,6 +161,8 @@
          g_error_free (error);
          error = NULL;
       }
+
+      display_recently_played (itdb);
   }
 
   itdb_free (itdb);


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to