本文整理汇总了Python中sfile.makedirs函数的典型用法代码示例。如果您正苦于以下问题:Python makedirs函数的具体用法?Python makedirs怎么用?Python makedirs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makedirs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: install_file
def install_file(filename):
ottv = dixie.HOME
src = os.path.join(ottv, 'resources', filename)
if not os.path.exists(path):
sfile.makedirs(path)
sfile.copy(src, file)
示例2: CheckVersion
def CheckVersion():
try:
prev = ADDON.getSetting('VERSION')
curr = VERSION
if prev == curr:
return
verifySuperSearch()
VerifySettinngs()
VerifyZipFiles()
src = os.path.join(ROOT, 'cache')
dst = os.path.join(ROOT, 'C')
sfile.rename(src, dst)
ADDON.setSetting('VERSION', curr)
if prev == '0.0.0' or prev == '1.0.0':
sfile.makedirs(PROFILE)
#call showChangeLog like this to workaround bug in openElec
script = os.path.join(HOME, 'showChangelog.py')
cmd = 'AlarmClock(%s,RunScript(%s),%d,True)' % ('changelog', script, 0)
xbmc.executebuiltin(cmd)
except:
pass
示例3: doDownload
def doDownload(file):
utils.log('download url: %s' % file)
dst = ADDON.getSetting('DOWNLOAD_FOLDER')
import sfile
sfile.makedirs(dst)
if not sfile.isdir(dst):
utils.DialogOK(GETTEXT(30256), GETTEXT(30257))
utils.openSettings(ADDONID, 2.24)
xbmc.sleep(500)
while(xbmc.getCondVisibility('Window.IsActive(addonsettings)') == 1):
xbmc.sleep(100)
dst = ADDON.getSetting('DOWNLOAD_FOLDER')
if not sfile.isdir(dst):
utils.DialogOK(GETTEXT(30256))
return
dst = os.path.join(ADDON.getSetting('DOWNLOAD_FOLDER'), getDownloadTitle(file))
if utils.DialogYesNo(GETTEXT(30243), GETTEXT(30244)):
xbmc.Player().stop()
import download
download.download(file, dst, 'Super Favourites')
示例4: doDownload
def doDownload(file):
utils.log('download url: %s' % file)
dst = ADDON.getSetting('DOWNLOAD_FOLDER')
import sfile
sfile.makedirs(dst)
if not sfile.exists(dst):
utils.DialogOK(GETTEXT(30256), GETTEXT(30257))
utils.openSettings(ADDONID, 2.24)
xbmc.sleep(500)
while(xbmc.getCondVisibility('Window.IsActive(addonsettings)') == 1):
xbmc.sleep(100)
dst = ADDON.getSetting('DOWNLOAD_FOLDER')
if not sfile.exists(dst):
utils.DialogOK(GETTEXT(30256))
return
import os
dst = os.path.join(ADDON.getSetting('DOWNLOAD_FOLDER'), getDownloadTitle(file))
if utils.DialogYesNo(GETTEXT(30243), GETTEXT(30244)):
xbmc.executebuiltin('Action(Stop)')
import download
download.download(file, dst, utils.TITLE)
示例5: CheckVersion
def CheckVersion():
try:
prev = ADDON.getSetting("VERSION")
curr = VERSION
if xbmcgui.Window(10000).getProperty("OTT_RUNNING") != "True":
VerifyKeymaps()
if prev == curr:
return
verifySuperSearch()
src = os.path.join(ROOT, "cache")
dst = os.path.join(ROOT, "C")
sfile.rename(src, dst)
ADDON.setSetting("VERSION", curr)
if prev == "0.0.0" or prev == "1.0.0":
sfile.makedirs(PROFILE)
# call showChangeLog like this to workaround bug in openElec
script = os.path.join(HOME, "showChangelog.py")
cmd = "AlarmClock(%s,RunScript(%s),%d,True)" % ("changelog", script, 0)
xbmc.executebuiltin(cmd)
except:
pass
示例6: getDownloadLocation
def getDownloadLocation():
if getSetting('DOWNLOAD_LOC') == '1':
loc = os.path.join(PROFILE, 'local')
try: sfile.makedirs(loc)
except: pass
return loc
return getExternalDrive()
示例7: verifyPlugins
def verifyPlugins():
folder = os.path.join(ROOT, 'Plugins')
if sfile.exists(folder):
return
try: sfile.makedirs(folder)
except: pass
示例8: checkCacheDir
def checkCacheDir():
try:
if sfile.isdir(CacheDir):
return
except:
pass
sfile.makedirs(CacheDir)
示例9: install_file
def install_file(filename):
vpn = utils.HOME
src = os.path.join(vpn, 'resources', filename)
if not os.path.exists(path):
sfile.makedirs(path)
sfile.copy(src, file)
示例10: downloadDefaults
def downloadDefaults(url):
import download
import extract
url1 = url + "ott/skins.zip"
url2 = url + "ottepg/skins.zip"
url3 = url + "ottepg/logos.zip"
url4 = url + "ottepg/channels.zip"
path1 = xbmc.translatePath(PROFILE) # /addon_data/script.on-tapp.tv/
path2 = os.path.join(epgpath, "extras") # /addon_data/script.tvguidedixie/extras/
path3 = os.path.join(path2, "skins")
path4 = os.path.join(path2, "logos")
zip1 = os.path.join(path1, "skins.zip")
zip2 = os.path.join(path2, "skins.zip")
zip3 = os.path.join(path2, "logos.zip")
zip4 = os.path.join(epgpath, "channels.zip")
if not sfile.exists(epgpath):
sfile.makedirs(epgpath)
if not sfile.exists(path1):
sfile.makedirs(path1)
download.download(url1, zip1)
extract.all(zip1, path1, dp="Installing OTT skins")
sfile.remove(zip1)
if not sfile.exists(path2):
sfile.makedirs(path2)
download.download(url2, zip2)
extract.all(zip2, path2, dp="Installing EPG skins")
sfile.remove(zip2)
if not sfile.exists(path4):
sfile.makedirs(path2)
download.download(url3, zip3)
extract.all(zip3, path2)
sfile.remove(zip3)
if not sfile.exists(epgpath):
sfile.makedirs(epgpath)
download.download(url4, zip4)
extract.all(zip4, epgpath)
sfile.remove(zip4)
if OTTURL == "OTHER":
Addon.setSetting("dixie.url", "Other")
Addon.setSetting("dixie.skin", "EPG-Skin")
setSetting("SKIN", "OTT-Skin")
else:
Addon.setSetting("dixie.url", "All Channels")
Addon.setSetting("dixie.skin", "FXB v4.0")
setSetting("SKIN", "FXB78")
setSetting("FIRSTRUN", "true")
示例11: GetFolder
def GetFolder(title):
default = ROOT
sfile.makedirs(PROFILE)
folder = xbmcgui.Dialog().browse(3, title, 'files', '', False, False, default)
if folder == default:
return None
return folder
示例12: downloadDefaults
def downloadDefaults(url):
import download
import extract
url1 = url + 'ott/skins.zip'
url2 = url + 'ottepg/skins.zip'
url3 = url + 'ottepg/logos.zip'
url4 = url + 'ottepg/channels.zip'
path1 = xbmc.translatePath(PROFILE) # /addon_data/script.on-tapp.tv/
path2 = os.path.join(epgpath, 'extras') # /addon_data/script.tvguidedixie/extras/
path3 = os.path.join(path2, 'skins')
path4 = os.path.join(path2, 'logos')
zip1 = os.path.join(path1, 'skins.zip')
zip2 = os.path.join(path2, 'skins.zip')
zip3 = os.path.join(path2, 'logos.zip')
zip4 = os.path.join(epgpath, 'channels.zip')
if not sfile.exists(epgpath):
sfile.makedirs(epgpath)
if not sfile.exists(path1):
sfile.makedirs(path1)
download.download(url1, zip1)
extract.all(zip1, path1, dp='Installing OTT skins')
sfile.remove(zip1)
if not sfile.exists(path2):
sfile.makedirs(path2)
download.download(url2, zip2)
extract.all(zip2, path2, dp='Installing EPG skins')
sfile.remove(zip2)
if not sfile.exists(path4):
sfile.makedirs(path2)
download.download(url3, zip3)
extract.all(zip3, path2)
sfile.remove(zip3)
if not sfile.exists(epgpath):
sfile.makedirs(epgpath)
download.download(url4, zip4)
extract.all(zip4, epgpath)
sfile.remove(zip4)
if isDSF():
Addon.setSetting('dixie.skin', 'EPG-Skin')
Addon.setSetting('playlist.url', '')
setSetting('SKIN', 'OTT-Skin')
else:
Addon.setSetting('dixie.skin', 'FXB v4.0')
setSetting('SKIN', 'FXB78')
setSetting('FIRSTRUN', 'true')
示例13: GetFolder
def GetFolder(title):
default = ''
folder = xbmc.translatePath(PROFILE)
if not sfile.isdir(folder):
sfile.makedirs(folder)
folder = xbmcgui.Dialog().browse(3, title, 'files', '', False, False, default)
if folder == default:
return None
return xbmc.translatePath(folder)
示例14: GetFolder
def GetFolder(title, start=None):
if start:
default = start
else:
default = ROOT
sfile.makedirs(PROFILE)
folder = xbmcgui.Dialog().browse(3, title, 'files', '', False, False, default)
if folder == default:
if (not start):
return None
return folder
示例15: extract
def extract(src, dp):
success = False
try:
src = xbmc.translatePath(src)
import zipfile
update = os.path.join(PROFILE, 'update')
update = xbmc.translatePath(update)
sfile.makedirs(update)
zin = zipfile.ZipFile(src, 'r')
nItem = float(len(zin.infolist()))
index = 0
for item in zin.infolist():
index += 1
percent = int(index / nItem *100)
#filename = item.filename
zin.extract(item, update)
if dp:
dp.update(percent, utils.GETTEXT(30118), utils.GETTEXT(30080))
addons = os.path.join('special://home', 'addons')
current, folders, files = sfile.walk(update)
for folder in folders:
ori = os.path.join(addons, folder)
src = os.path.join(current, folder)
dst = os.path.join(addons, folder + '.temp')
sfile.copytree(src, dst)
sfile.rmtree(ori)
while not sfile.exists(dst):
xbmc.sleep(100)
while sfile.exists(ori):
xbmc.sleep(100)
sfile.rename(dst, ori)
success = True
except:
success = False
sfile.delete(update)
return success