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)
评论列表
文章目录