|
From: Adeodato S. <da...@ne...> - 2011-07-08 20:26:54
|
Hi again! On Thu, Jul 7, 2011 at 21:46, Christophe Fergeau <cfe...@gm...> wrote: > Hi, > > On Tue, May 31, 2011 at 04:12:15AM +0100, Adeodato Simó wrote: >> as a follow-up to my other path, it seems I cannot access the "timezone_shift" >> member of Itdb_Device via Python: > Why do you want to access it? I'd rather keep it private, the python > binding should take care of convering timestamps to/from the right format. > Or is there some use for it that I'm missing? Yes, there can be different needs for it, depending whether you use the Pythonic API or the C-like API. The Pythonic API provides "time_played" as a datetime object in the device's local time but with no timezone information attached to it (to the the datetime object). You need to now the device's TZ if you want to convert those times to UTC, e.g. to scrobble them. The C-like API, instead, provides you with "time_played" as a Unix timestamp. You need the device's TZ if you want to know, for example at what time (day? night?) the user actually played the track. In the first case, this could be solved if the Pythonic API would provide datetime objects with timezone information (but, beware, this can get very hairy very easy very fast). And there's no other solution for the second case other than exposing this field (typically, Unix timestamp + UTC offset is the most robust way to represent time internally in any application). Thoughts? Thanks for taking a look, -- - Are you sure we're good? - Always. -- Rory and Lorelai |