Example #1
0
 def to_dict(self):
     dicts = super(PlayerMail, self).to_dict()
     dicts["createdAt"] = int(datetime_to_unixtime(self.created_at))
     dicts["updatedAt"] = self.updated_at.strftime("%Y-%m-%d %H:%M:%S")
     # dicts["sender"] = self.sender
     # del dicts["sender_id"]
     return dicts
Example #2
0
    def userGuild_dict(self, guildInfo):
        '''
        获取公会展示数据
        '''
        dicts = {}
        player = self.player
        dicts["icon"] = player.iconId
        dicts["name"] = player.name
        dicts["vip"] = player.vip_level
        dicts["level"] = player.level
        dicts["id"] = player.id
        dicts["loginAt"] = int(time.time() -
                               datetime_to_unixtime(player.updated_at))
        dicts["powerRank"] = player.powerRank
        dicts["heros"] = player.layoutHeroSimple_dict()
        dicts["dailyContributionXp"] = self.dailyContributionXp
        dicts["totalContributionXp"] = self.totalContributionXp
        dicts["totalContribution"] = self.totalContribution
        dicts["lastInstanceLevelId"] = player.lastInstance["lastLevelId"]
        if guildInfo.chairmanId == player.id:
            dicts["position"] = Static.GUILD_CHAIRMAN_POSITION
        elif player.id in guildInfo.viChairmanIds:
            dicts["position"] = Static.GUILD_VI_CHAIRMAN_POSITION
        else:
            dicts["position"] = Static.GUILD_NORMAL_POSITION

        return dicts
Example #3
0
    def to_dict(self):
        dicts = {}
        # 副本id
        dicts["instanceId"] = self.instanceId
        # 社团id
        dicts["guildId"] = self.guildId
        # 开启状态
        dicts["openStatus"] = self.openStatus
        # boss血量
        dicts["bossHp"] = self.bossHp
        # boss百分比
        dicts["bossPercentage"] = self.bossPercentage
        # 是否有人挑战
        # startFightTime = self.startFightTime.replace(tzinfo=None)

        #公会内未打此副本的成员
        dicts["unMemberList"] = self.get_unFighting_member_info()

        #副本攻打状态
        dicts["battleStatus"] = self.battleStatus
        dicts["isFighting"] = self.isFighting
        # 副本开始时间
        # info["startTime"] = instance.startTime
        # 已经打过这个副本的成员
        dicts["memberList"] = self.memberList

        dicts["closeAt"] = int(
            datetime_to_unixtime(self.startTime + datetime.timedelta(
                seconds=self.closeAt))) if self.isOpen or self.isKill else 0

        return dicts
Example #4
0
    def timeLeft(self):
        timeLeft = 0
        if self.aucStatus == 0:
            endAt = self.aucEndAt
            now = datetime.datetime.now()
            if endAt > now:
                timeLeft = datetime_to_unixtime(endAt)

        return timeLeft
Example #5
0
 def to_dict(self):
     dicts = super(self.__class__, self).to_dict()
     dicts["heroId"] = self.cardId
     dicts["id"] = self.cardId
     del dicts["warrior_id"]
     del dicts["cardId"]
     if self.trainingAt:
         dicts["trainingAt"] = int(datetime_to_unixtime(self.trainingAt))
     # del dicts["trainingStartTime"]
     # del dicts["speedStartTime"]
     return dicts
Example #6
0
 def leftRefreshTime(self):
     """
     剩余自动刷新时间
     """
     now = datetime.datetime.now()
     next_refesh_hour = PlayerArenaShop._next_refesh_hour(now.hour)
     end_time = datetime.datetime(now.year, now.month, now.day,
                                  next_refesh_hour, 59,
                                  59) + datetime.timedelta(seconds=4)
     #return ( end_time - now ).total_seconds() + 4
     return datetime_to_unixtime(end_time)
Example #7
0
 def canJoinGuildAt(self):
     return datetime_to_unixtime(self.leftAt)  # + datetime.timedelta(1))
with open(setting_path) as f:
    SETTINGS = yaml.load(f)

print(SETTINGS)

for episode in SETTINGS:
    print("episode: ", episode)
    # get start time and end time
    sync_relative = SETTINGS[episode]['sync_relative']
    sync_absolute = SETTINGS[episode]['sync_absolute']
    video_lead_time = SETTINGS[episode]['video_lead_time']
    print("video_lead_time: ", video_lead_time)
    sync_absolute = parse_timestamp_tz_aware(sync_absolute)
    t = datetime.strptime(sync_relative, "%H:%M:%S")
    startTime = sync_absolute - timedelta(hours=t.hour, minutes=t.minute, seconds=t.second)\
           + timedelta(seconds=video_lead_time/1000)
    endTime = startTime + timedelta(minutes=20)
    startTimeExt = startTime - timedelta(minutes=10)
    endTimeExt = endTime + timedelta(minutes=10)

    epiDf = read_data(DATA_FOLDER, datetime_to_unixtime(startTimeExt),
                      datetime_to_unixtime(endTimeExt))
    epiDf['ELAN_time'] = epiDf['Time'] - datetime_to_unixtime(startTime)
    # print(startTime)
    # epiDf[['accx','accy','accz']].plot()
    # plt.show()
    epiDf.to_csv(os.path.join(ANNO_FOLDER,
                              'P' + SUBJ + '_SYNC_' + episode + '.csv'),
                 index=None)