summaryrefslogtreecommitdiffstats
path: root/tests/test-ls.c
diff options
context:
space:
mode:
authorjcsjcs <jcsjcs@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2007-04-27 14:09:59 +0000
committerjcsjcs <jcsjcs@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2007-04-27 14:09:59 +0000
commit3f355fe5888dbe534f95cb3bbe79bcb6315a87f5 (patch)
tree3edd7b23d5848a943cfaa9a177800fc8f94f44e4 /tests/test-ls.c
parent1697dc8977f5236d4223456137c09e2fb7227c85 (diff)
downloadlibgpod-3f355fe5888dbe534f95cb3bbe79bcb6315a87f5.tar.gz
libgpod-3f355fe5888dbe534f95cb3bbe79bcb6315a87f5.tar.xz
libgpod-3f355fe5888dbe534f95cb3bbe79bcb6315a87f5.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/test-ls.c')
-rw-r--r--tests/test-ls.c32
1 files changed, 32 insertions, 0 deletions
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);