本文整理匯總了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'))