def merge_playtimes(app_list): playtime = {} for app in app_list: for d, m in zip(app.date, app.playtime): playtime[d] = playtime[d] + m if d in playtime else m return [(utils.unix2datetime(d), playtime[d]) for d in playtime]
def get_dt_to(self): return utils.unix2datetime(self.unix_timestamp_to)
def set_to(self, timestamp): dt_to = utils.unix2datetime(timestamp) self.unix_timestamp_to = utils.datetime2unix(dt_to + \ timedelta(hours=24 - dt_to.hour))
def get_dt_from(self): return utils.unix2datetime(self.unix_timestamp_from)
def set_from(self, timestamp): dt_from = utils.unix2datetime(timestamp) self.unix_timestamp_from = utils.datetime2unix(dt_from - \ timedelta(hours=dt_from.hour))