diff options
author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2007-04-27 14:09:59 +0000 |
---|---|---|
committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2007-04-27 14:09:59 +0000 |
commit | 4e34b34b9c9ea5df23548c86da080b700666f00f (patch) | |
tree | 3edd7b23d5848a943cfaa9a177800fc8f94f44e4 /tests | |
parent | 0a8bf8b3ac053452aab77d6842b4f7ae475419e4 (diff) | |
download | libgpod-tmz-4e34b34b9c9ea5df23548c86da080b700666f00f.tar.gz libgpod-tmz-4e34b34b9c9ea5df23548c86da080b700666f00f.tar.xz libgpod-tmz-4e34b34b9c9ea5df23548c86da080b700666f00f.zip |
* 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.
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1417 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/test-ls.c | 32 |
2 files changed, 35 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index e77f83b..4d3e89f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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_ls_LDADD = 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"\" diff --git a/tests/test-ls.c b/tests/test-ls.c index f37bc43..635ce44 100644 --- a/tests/test-ls.c +++ b/tests/test-ls.c @@ -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 @@ main (int argc, char *argv[]) g_error_free (error); error = NULL; } + + display_recently_played (itdb); } itdb_free (itdb); |