本文整理汇总了Python中xbmc.getRegion方法的典型用法代码示例。如果您正苦于以下问题:Python xbmc.getRegion方法的具体用法?Python xbmc.getRegion怎么用?Python xbmc.getRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmc
的用法示例。
在下文中一共展示了xbmc.getRegion方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_stream_start_date_formatted
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def get_stream_start_date_formatted(start_date):
if start_date is None:
common.plugin.log_error('utils.get_stream_start_date_formatted() : missing start_date')
return None
now_datetime = now()
start_date = dateutil.parser.parse(start_date)
formatted_date = start_date.strftime(xbmc.getRegion('dateshort'))
formatted_time = start_date.strftime(xbmc.getRegion('time'))
if now_datetime.date() != start_date.date():
formatted_datetime = formatted_date + " - " + formatted_time
else:
formatted_datetime = formatted_time
return formatted_datetime
示例2: localize_time
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def localize_time(time):
"""Localize time format"""
time_format = getRegion('time')
# Fix a bug in Kodi v18.5 and older causing double hours
# https://github.com/xbmc/xbmc/pull/17380
time_format = time_format.replace('%H%H:', '%H:')
# Strip off seconds
time_format = time_format.replace(':%S', '')
return time.strftime(time_format)
示例3: get_region_date
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def get_region_date(date_obj, region='dateshort', del_fmt=':%S'):
date_fmt = xbmc.getRegion(region).replace(del_fmt, '')
return date_obj.strftime(date_fmt)
示例4: get_format
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def get_format():
dateFormat = xbmc.getRegion('datelong')
timeFormat = xbmc.getRegion('time').replace('%H%H', '%H').replace('%I%I', '%I')
timeFormat = timeFormat.replace(":%S", "")
return "{}, {}".format(dateFormat, timeFormat)
示例5: format_date_short
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def format_date_short(self, date_obj):
date_format = xbmc.getRegion('dateshort')
_date_obj = date_obj
if isinstance(_date_obj, datetime.date):
_date_obj = datetime.datetime(_date_obj.year, _date_obj.month, _date_obj.day)
pass
return _date_obj.strftime(date_format)
示例6: format_time
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def format_time(self, time_obj):
time_format = xbmc.getRegion('time')
_time_obj = time_obj
if isinstance(_time_obj, datetime.time):
_time_obj = datetime.time(_time_obj.hour, _time_obj.minute, _time_obj.second)
pass
return _time_obj.strftime(time_format)
示例7: formatTime
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def formatTime(self, timestamp):
if timestamp:
format = xbmc.getRegion('time').replace(':%S', '').replace('%H%H', '%H')
return timestamp.strftime(format)
else:
return ''
示例8: formatDate
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def formatDate(self, timestamp, longdate=False):
if timestamp:
if longdate == True:
format = xbmc.getRegion('datelong')
else:
format = xbmc.getRegion('dateshort')
return timestamp.strftime(format)
else:
return ''
示例9: localize_time
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def localize_time(time):
"""Localize time format"""
time_format = xbmc.getRegion('time')
# Fix a bug in Kodi v18.5 and older causing double hours
# https://github.com/xbmc/xbmc/pull/17380
time_format = time_format.replace('%H%H:', '%H:')
# Strip off seconds
time_format = time_format.replace(':%S', '')
return time.strftime(time_format)
示例10: localize_datelong
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getRegion [as 别名]
def localize_datelong(date):
"""Return a localized long date string"""
return localize_date(date, xbmc.getRegion('datelong'))