default.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:repository.jlippold 作者: jlippold 项目源码 文件源码
def format_event(device, event):
    from_zone = tz.tzutc()
    to_zone = tz.tzlocal()
    utc = event['created_at'].replace(tzinfo=from_zone)
    local_time = utc.astimezone(to_zone)

    local_time_string = local_time.strftime('%I:%M %p ') 
    local_time_string += ADDON.getLocalizedString(30300) 
    local_time_string += local_time.strftime(' %A %b %d %Y')

    event_name = ''
    if event['kind'] == 'on_demand':
        event_name = ADDON.getLocalizedString(30301)
    if event['kind'] == 'motion':
        event_name = ADDON.getLocalizedString(30302)
    if event['kind'] == 'ding':
        event_name = ADDON.getLocalizedString(30303)

    return ' '.join([device.name, event_name, local_time_string])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号