screensaverutils.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:screensaver.kaster 作者: enen92 项目源码 文件源码
def get_own_pictures(path):
    _, files = xbmcvfs.listdir(xbmc.translatePath(path))
    images_dict = {}
    image_file = os.path.join(xbmc.translatePath(path), "images.json")
    if xbmcvfs.exists(image_file):
        with open(image_file, "r") as f:
            try:
                images_dict = json.loads(f.read())
            except ValueError:
                kodiutils.log(kodiutils.get_string(32010), xbmc.LOGERROR)
    for _file in files:
        if _file.endswith(('.png', '.jpg', '.jpeg')):
            returned_dict = {
                "url": os.path.join(xbmc.translatePath(path), _file),
                "private": True
            }
            if images_dict:
                for image in images_dict:
                    if "image" in image.keys() and image["image"] == _file:
                        if "line1" in image.keys():
                            returned_dict["line1"] = image["line1"]
                        if "line2" in image.keys():
                            returned_dict["line2"] = image["line2"]
            yield returned_dict
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号