本文整理匯總了Python中resources.lib.kodion.items.DirectoryItem.set_name方法的典型用法代碼示例。如果您正苦於以下問題:Python DirectoryItem.set_name方法的具體用法?Python DirectoryItem.set_name怎麽用?Python DirectoryItem.set_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類resources.lib.kodion.items.DirectoryItem
的用法示例。
在下文中一共展示了DirectoryItem.set_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: on_root
# 需要導入模塊: from resources.lib.kodion.items import DirectoryItem [as 別名]
# 或者: from resources.lib.kodion.items.DirectoryItem import set_name [as 別名]
def on_root(self, context, re_match):
result = []
client = self.get_client(context)
if self.is_logged_in():
# online favorites
fav_item = DirectoryItem('[B]%s[/B]' % context.localize(kodion.constants.localize.FAVORITES),
context.create_uri(['nowtv', 'favorites', 'list']),
image=context.create_resource_path('media/favorites.png'),
fanart=self.get_fanart(context))
result.append(fav_item)
# online watch later
wl_item = DirectoryItem('[B]%s[/B]' % context.localize(kodion.constants.localize.WATCH_LATER),
context.create_uri(['nowtv', 'watch_later', 'list']),
image=context.create_resource_path('media/watch_later.png'),
fanart=self.get_fanart(context))
result.append(wl_item)
pass
else:
# offline favorites
if len(context.get_favorite_list().list()) > 0:
fav_item = kodion.items.FavoritesItem(context, fanart=self.get_fanart(context))
fav_item.set_name('[B]%s[/B]' % fav_item.get_name())
result.append(fav_item)
pass
# offline watch later
if len(context.get_watch_later_list().list()) > 0:
wl_item = kodion.items.WatchLaterItem(context, fanart=self.get_fanart(context))
wl_item.set_name('[B]%s[/B]' % wl_item.get_name())
result.append(wl_item)
pass
pass
# watch later
if len(context.get_watch_later_list().list()) > 0:
watch_later_item = kodion.items.WatchLaterItem(context, fanart=self.get_fanart(context))
result.append(watch_later_item)
pass
# list channels
for channel_id in self._channel_ids:
channel_config = Client.CHANNELS[channel_id]
channel_id = channel_config['id']
channel_title = channel_config['title']
channel_item = DirectoryItem(channel_title, context.create_uri([channel_id, 'formats']))
channel_item.set_fanart(context.create_resource_path('media', channel_id, 'background.jpg'))
channel_item.set_image(context.create_resource_path('media', channel_id, 'logo.png'))
result.append(channel_item)
pass
# search
search_item = kodion.items.SearchItem(context, image=context.create_resource_path('media', 'search.png'),
fanart=self.get_fanart(context))
result.append(search_item)
return result