libgpod can't get itunesDB playcount on windows???

View: New views
2 Messages — Rating Filter:   Alert me  

libgpod can't get itunesDB playcount on windows???

by liqisong :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello,
I would like to write a program using libgpod that get playcount information from an iPod device, which tracks users' listening history. but test libgpod,i found i can not get
the playcount from itunesDB file,why? can you help me?

my code like this:

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <glib/gerror.h>
#include <glib/glist.h>
#include "itdb.h"


int main(int argc, char* argv[])
{

GError *error=NULL;
Itdb_iTunesDB *itdb;
gchar *infile = "D:\\C++\\TestIpodDevice\\TestIpodDevice\\iPod_Control\\iTunes\\iTunesDB";

if (infile == 0)
{
exit (0);
}

itdb = itdb_parse_file (infile, &error);
printf ("%p\n", itdb);

if (error)
{
g_error_free (error);
error = NULL;
}

if (itdb)
{
printf ("tracks000: %d\n",itdb_tracks_number(itdb));
printf ("tracks: %d\n", g_list_length (itdb->tracks));
printf ("playlists: %d\n", itdb_playlists_number(itdb));
printf ("playlists: %d\n", g_list_length (itdb->playlists));


GList *it = NULL;
for (it = itdb->tracks; it; it = it->next)
{   
_Itdb_Track *track = (Itdb_Track *)it->data;
CA2W  wTitle(track->title,CP_UTF8);
CT2A title(wTitle);
CA2W  wArtist(track->artist,CP_UTF8);
CT2A artist(wArtist);
printf("%s - %s play count:%d\n",(char*)artist,(char*)title,track->recent_playcount); //track->recent_playcount always zero!!
}
if (error)
{
if (error->message)
puts (error->message);
g_error_free (error);
error = NULL;
}
}

itdb_free (itdb);
return 0;
}

Thanks for any help you can offer me.


您可以借助 Windows Live 整理、编辑和 共享您的照片。
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gtkpod-devel mailing list
Gtkpod-devel@...
https://lists.sourceforge.net/lists/listinfo/gtkpod-devel

Re: libgpod can't get itunesDB playcount on windows???

by Jorg Schuler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Please note that recent_playcount is only set if a track was played
(completely) between the last sync and the readout.

There could be a bug as well, of course.


JCS.

Christophe Fergeau wrote:

> Hi,
>
> 2009/8/13 李李其宋 <liqisong611@...>:
>  
>> I would like to write a program using libgpod that get playcount information
>> from an iPod device, which tracks users' listening history. but test
>> libgpod,i found i can not get
>> the playcount from itunesDB file,why? can you help me?
>>    
>
> I haven't tested playcount reading recently, so maybe something's
> broken. What iPod model are you trying this with? And how exactly are
> you testing it? You play a song on the iPod, plug/mount the iPod and
> then run your test program? Is it a windows program? If so, could it
> be that iTunes take over the iPod and resets the playcount before you
> get a chance to read it?
>
> Thanks for your interest in libgpod,
>
> Christophe
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gtkpod-devel mailing list
> Gtkpod-devel@...
> https://lists.sourceforge.net/lists/listinfo/gtkpod-devel
>  


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gtkpod-devel mailing list
Gtkpod-devel@...
https://lists.sourceforge.net/lists/listinfo/gtkpod-devel