scutils.py 文件源码

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

项目:plugin.video.stream-cinema 作者: bbaronSVK 项目源码 文件源码
def add_item_to_library(self, item_path, item_url):
        error = False
        new = False
        item_path = xbmc.validatePath(item_path)
        if item_path:
            item_path = xbmc.translatePath(item_path)
            dir = os.path.dirname(item_path)
            if not xbmcvfs.exists(dir):
                try:
                    xbmcvfs.mkdirs(dir)
                except Exception:
                    error = True
                    util.error('[SC] Failed to create directory 1: ' + dir)

            if not xbmcvfs.exists(item_path):
                try:
                    file_desc = xbmcvfs.File(item_path, 'w')
                    file_desc.write(str(item_url))
                    file_desc.close()
                    new = True
                except Exception, e:
                    util.error('[SC] Failed to create .strm file: ' + item_path + " | " + str(e))
                    error = True
        else:
            error = True

        util.debug("[SC] add item: %s" % item_path)
        return (error, new)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号