当前位置: 首页>>代码示例>>Python>>正文


Python SimpleCache.check_cleanup方法代码示例

本文整理汇总了Python中simplecache.SimpleCache.check_cleanup方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleCache.check_cleanup方法的具体用法?Python SimpleCache.check_cleanup怎么用?Python SimpleCache.check_cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在simplecache.SimpleCache的用法示例。


在下文中一共展示了SimpleCache.check_cleanup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ListItemMonitor

# 需要导入模块: from simplecache import SimpleCache [as 别名]
# 或者: from simplecache.SimpleCache import check_cleanup [as 别名]

#.........这里部分代码省略.........
                    # movies-only properties (tmdb, animated art)
                    if content_type in ["movies", "setmovies"]:
                        listitem = extend_dict(listitem, self.artutils.get_tmdb_details(listitem["imdbnumber"]))
                        if listitem["imdbnumber"] and self.enable_animatedart:
                            listitem = extend_dict(listitem, self.artutils.get_animated_artwork(listitem["imdbnumber"]))

                if self.exit:
                    return

                # monitor listitem props when PVR is active
                elif content_type in ["tvchannels", "tvrecordings", "channels", "recordings", "timers", "tvtimers"]:
                    listitem = self.get_pvr_artwork(listitem, prefix)

                # process all properties
                all_props = prepare_win_props(listitem)
                if content_type not in ["weathers", "systeminfos", "sets"]:
                    self.listitem_details[cur_listitem] = all_props

                self.lookup_busy.pop(cur_listitem, None)

            if cur_listitem == self.last_listitem:
                self.set_win_props(all_props)
        except Exception as exc:
            log_exception(__name__, exc)

    def do_background_work(self):
        '''stuff that's processed in the background'''
        try:
            if self.exit:
                return
            log_msg("Started Background worker...")
            self.set_generic_props()
            self.listitem_details = {}
            self.cache.check_cleanup()
            log_msg("Ended Background worker...")
        except Exception as exc:
            log_exception(__name__, exc)

    def set_generic_props(self):
        '''set some genric window props with item counts'''
        # GET TOTAL ADDONS COUNT
        addons_count = len(kodi_json('Addons.GetAddons'))
        self.win.setProperty("SkinHelper.TotalAddons", "%s" % addons_count)

        addontypes = []
        addontypes.append(("executable", "SkinHelper.TotalProgramAddons"))
        addontypes.append(("video", "SkinHelper.TotalVideoAddons"))
        addontypes.append(("audio", "SkinHelper.TotalAudioAddons"))
        addontypes.append(("image", "SkinHelper.TotalPicturesAddons"))
        for addontype in addontypes:
            media_array = kodi_json('Addons.GetAddons', {"content": addontype[0]})
            self.win.setProperty(addontype[1], str(len(media_array)))

        # GET FAVOURITES COUNT
        favs = kodi_json('Favourites.GetFavourites')
        if favs:
            self.win.setProperty("SkinHelper.TotalFavourites", "%s" % len(favs))

        # GET TV CHANNELS COUNT
        if xbmc.getCondVisibility("Pvr.HasTVChannels"):
            tv_channels = kodi_json('PVR.GetChannels', {"channelgroupid": "alltv"})
            self.win.setProperty("SkinHelper.TotalTVChannels", "%s" % len(tv_channels))

        # GET MOVIE SETS COUNT
        movieset_movies_count = 0
        moviesets = kodi_json('VideoLibrary.GetMovieSets')
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:70,代码来源:listitem_monitor.py


注:本文中的simplecache.SimpleCache.check_cleanup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。