當前位置: 首頁>>代碼示例>>Python>>正文


Python DirectoryItem.get_name方法代碼示例

本文整理匯總了Python中resources.lib.kodion.items.DirectoryItem.get_name方法的典型用法代碼示例。如果您正苦於以下問題:Python DirectoryItem.get_name方法的具體用法?Python DirectoryItem.get_name怎麽用?Python DirectoryItem.get_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在resources.lib.kodion.items.DirectoryItem的用法示例。


在下文中一共展示了DirectoryItem.get_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: on_root

# 需要導入模塊: from resources.lib.kodion.items import DirectoryItem [as 別名]
# 或者: from resources.lib.kodion.items.DirectoryItem import get_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
開發者ID:tyl0re,項目名稱:plugin.video.nowtv.de,代碼行數:60,代碼來源:provider.py


注:本文中的resources.lib.kodion.items.DirectoryItem.get_name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。