本文整理汇总了Python中xbmcvfs.copy函数的典型用法代码示例。如果您正苦于以下问题:Python copy函数的具体用法?Python copy怎么用?Python copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: VideoWindow
def VideoWindow():
log("VideoWindow, VWPath = " + str(VWPath))
FreshInstall = False
#Copy VideoWindow Patch file
try:
if xbmcgui.Window(10000).getProperty("PseudoTVRunning") != "True":
if not FileAccess.exists(VWPath):
log("VideoWindow, VWPath not found")
FreshInstall = True
xbmcvfs.copy(flePath, VWPath)
if FileAccess.exists(VWPath):
log('custom_script.pseudotv.live_9506.xml Copied')
VideoWindowPatch()
if FreshInstall == True:
xbmc.executebuiltin("ReloadSkin()")
else:
raise
else:
log("VideoWindow, VWPath found")
VideoWindowPatch()
except Exception:
VideoWindowUninstall()
VideoWindowUnpatch()
Error = True
pass
开发者ID:hitman222,项目名称:XBMC_Addons,代码行数:25,代码来源:utils.py
示例2: _copy_moviethumbs
def _copy_moviethumbs( self ):
count = 0
processeditems = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties": ["file", "title", "thumbnail", "year"], "filter": {"field": "path", "operator": "contains", "value": "%s"}}, "id": 1}' % self.path)
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = json.loads(json_query)
if json_response.has_key('result') and (json_response['result'] != None) and (json_response['result'].has_key('movies')):
totalitems = len( json_response['result']['movies'] )
for item in json_response['result']['movies']:
if self.dialog.iscanceled():
log('script cancelled')
return
processeditems = processeditems + 1
self.dialog.update( int( float( processeditems ) / float( totalitems ) * 100), LANGUAGE(32005) + ': ' + str( count + 1 ) )
name = item['title']
year = str(item['year'])
artwork = item['thumbnail']
tmp_filename = name + ' (' + year + ')' + '.jpg'
filename = clean_filename( tmp_filename )
# test file path with movie_content to find source name
moviethumbspath = self.moviethumbspath
if self.split_movies_sources == "true" and self.movies_content.has_key(str(item['file'])):
moviethumbspath = os.path.join( self.moviethumbspath, self.movies_content[str(item['file'])])
if artwork != '':
try:
xbmcvfs.copy( xbmc.translatePath( artwork ), os.path.join( moviethumbspath, filename ) )
count += 1
except:
log( 'failed to copy moviethumb' )
log( 'moviethumbs copied: %s' % count )
开发者ID:ronie,项目名称:script.artworkorganizer,代码行数:30,代码来源:default.py
示例3: copyNode
def copyNode(self, dirs, files, target, origin):
for file in files:
xbmcvfs.copy( os.path.join( origin, file ), os.path.join( target, file ) )
for dir in dirs:
nextDirs, nextFiles = xbmcvfs.listdir( os.path.join( origin, dir ) )
self.copyNode( nextDirs, nextFiles, os.path.join( target, dir ), os.path.join( origin, dir ) )
开发者ID:phil65,项目名称:plugin.program.video.node.editor,代码行数:7,代码来源:addon.py
示例4: restoreColorTheme
def restoreColorTheme():
import shutil
import zipfile
zip_path = None
userThemesPath = os.path.join(userThemesDir,"themes") + os.sep
zip_path = get_browse_dialog(dlg_type=1,heading=ADDON.getLocalizedString(32020),mask=".zip")
if zip_path and zip_path != "protocol://":
#create temp path
temp_path = xbmc.translatePath('special://temp/skinbackup/').decode("utf-8")
if xbmcvfs.exists(temp_path):
shutil.rmtree(temp_path)
xbmcvfs.mkdir(temp_path)
#unzip to temp
if "\\" in zip_path:
delim = "\\"
else:
delim = "/"
zip_temp = xbmc.translatePath('special://temp/' + zip_path.split(delim)[-1]).decode("utf-8")
xbmcvfs.copy(zip_path,zip_temp)
zfile = zipfile.ZipFile(zip_temp)
zfile.extractall(temp_path)
zfile.close()
xbmcvfs.delete(zip_temp)
dirs, files = xbmcvfs.listdir(temp_path)
for file in files:
if file.endswith(".theme") or file.endswith(".jpg"):
sourcefile = os.path.join(temp_path,file)
destfile = os.path.join(userThemesPath,file)
xbmcvfs.copy(sourcefile,destfile)
xbmcgui.Dialog().ok(ADDON.getLocalizedString(32022), ADDON.getLocalizedString(32021))
开发者ID:officiallybob,项目名称:script.skin.helper.service,代码行数:33,代码来源:ColorThemes.py
示例5: ffmpeg_location
def ffmpeg_location():
ffmpeg_src = xbmc.translatePath(ADDON.getSetting('autoplaywiths.ffmpeg'))
if xbmc.getCondVisibility('system.platform.android'):
ffmpeg_dst = '/data/data/%s/ffmpeg' % android_get_current_appid()
if (ADDON.getSetting('autoplaywiths.ffmpeg') != ADDON.getSetting('ffmpeg.last')) or (not xbmcvfs.exists(ffmpeg_dst) and ffmpeg_src != ffmpeg_dst):
xbmcvfs.copy(ffmpeg_src, ffmpeg_dst)
ADDON.setSetting('ffmpeg.last',ADDON.getSetting('autoplaywiths.ffmpeg'))
ffmpeg = ffmpeg_dst
else:
ffmpeg = ffmpeg_src
log(ffmpeg)
if ffmpeg:
try:
st = os.stat(ffmpeg)
if not (st.st_mode & stat.S_IXUSR):
log(st)
try:
os.chmod(ffmpeg, st.st_mode | stat.S_IXUSR)
except Exception as e:
log(e)
except Exception as e:
log(e)
if xbmcvfs.exists(ffmpeg):
return ffmpeg
else:
xbmcgui.Dialog().notification("TVGF", "ffmpeg exe not found!")
开发者ID:primaeval,项目名称:script.tvguide.fullscreen,代码行数:29,代码来源:playwith.py
示例6: Filter_Fakelight
def Filter_Fakelight(filterimage, pixels):
md5 = hashlib.md5(filterimage).hexdigest()
filename = md5 + "fakelight" + str(pixels) + ".png"
targetfile = os.path.join(ADDON_DATA_PATH, filename)
cachedthumb = xbmc.getCacheThumbName(filterimage)
xbmc_vid_cache_file = os.path.join("special://profile/Thumbnails/Video", cachedthumb[0], cachedthumb)
xbmc_cache_file = os.path.join("special://profile/Thumbnails/", cachedthumb[0], cachedthumb[:-4] + ".jpg")
if filterimage == "":
return ""
if not xbmcvfs.exists(targetfile):
img = None
for i in range(1, 4):
try:
if xbmcvfs.exists(xbmc_cache_file):
img = Image.open(xbmc.translatePath(xbmc_cache_file))
break
elif xbmcvfs.exists(xbmc_vid_cache_file):
img = Image.open(xbmc.translatePath(xbmc_vid_cache_file))
break
else:
filterimage = urllib.unquote(filterimage.replace("image://", "")).decode('utf8')
if filterimage.endswith("/"):
filterimage = filterimage[:-1]
xbmcvfs.copy(filterimage, targetfile)
img = Image.open(targetfile)
break
except:
xbmc.sleep(300)
if not img:
return ""
img = fake_light(img,pixels)
img.save(targetfile)
return targetfile
开发者ID:BADMS,项目名称:script.colorbox,代码行数:34,代码来源:Utils.py
示例7: _handle_compressed_subs
def _handle_compressed_subs(workdir, compressed_file, ext):
"""
Uncompress 'compressed_file' in 'workdir'.
"""
if ext == 'rar' and kodi_major_version >= 18:
src = 'archive' + '://' + quote_plus(compressed_file) + '/'
(cdirs, cfiles) = xbmcvfs.listdir(src)
for cfile in cfiles:
fsrc = '%s%s' % (src, cfile)
xbmcvfs.copy(fsrc, workdir + cfile)
else:
xbmc.executebuiltin("XBMC.Extract(%s, %s)" % (
compressed_file.encode("utf-8"),
workdir.encode("utf-8")), True)
files = os.listdir(workdir)
files = [f for f in files if is_subs_file(f)]
found_files = []
for fname in files:
if not isinstance(fname, unicode):
fname = fname.decode('utf-8')
found_files.append({
'forced': is_forced_subs_file(fname),
'path': pjoin(workdir, fname)
})
if not found_files:
log(u"Failed to unpack subtitles", level=LOGSEVERE)
return found_files
开发者ID:ramiro,项目名称:service.subtitles.subdivx,代码行数:28,代码来源:service.py
示例8: _copy_musicvideothumbs
def _copy_musicvideothumbs( self ):
count = 0
processeditems = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": {"properties": ["title", "thumbnail", "artist"], "filter": {"field": "path", "operator": "contains", "value": "%s"}}, "id": 1}' % self.path)
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = json.loads(json_query)
if json_response.has_key('result') and (json_response['result'] != None) and (json_response['result'].has_key('musicvideos')):
totalitems = len( json_response['result']['musicvideos'] )
for item in json_response['result']['musicvideos']:
if self.dialog.iscanceled():
log('script cancelled')
return
processeditems = processeditems + 1
self.dialog.update( int( float( processeditems ) / float( totalitems ) * 100), LANGUAGE(32009) + ': ' + str( count + 1 ) )
name = item['title']
artwork = item['thumbnail']
if item['artist']: # bug workaround, musicvideos can end up in the database without an artistname
artist = item['artist'][0]
tmp_filename = artist + ' - ' + name + '.jpg'
else:
tmp_filename = name + '.jpg'
filename = clean_filename( tmp_filename )
if artwork != '':
try:
xbmcvfs.copy( xbmc.translatePath( artwork ), os.path.join( self.musicvideothumbspath, filename ) )
count += 1
except:
log( 'failed to copy musicvideothumb' )
log( 'musicvideothumbs copied: %s' % count )
开发者ID:ronie,项目名称:script.artworkorganizer,代码行数:29,代码来源:default.py
示例9: run
def run(self):
#get a list of all the settings we can manipulate via json
json_response = json.loads(xbmc.executeJSONRPC('{"jsonrpc":"2.0", "id":1, "method":"Settings.GetSettings","params":{"level":"advanced"}}'))
settings = json_response['result']['settings']
for aSetting in settings:
self.settings_allowed.append(aSetting['id'])
#parse the existing xml file and get all the settings
root_nodes = self.__parseNodes(self.doc.documentElement)
for aNode in root_nodes:
secondary_list = self.__parseNodes(self.doc.getElementsByTagName(aNode.name)[0])
for secondNode in secondary_list:
#if the node does not have children and is not default
if(not secondNode.hasChildren and not secondNode.isDefault):
if(secondNode.json_name() in self.settings_allowed):
self.found_settings.append(secondNode)
#go through all the found settings and update them
for aSetting in self.found_settings:
utils.log("updating: " + aSetting.json_name() + ", value: " + aSetting.value)
#check for boolean and numeric values
if(aSetting.value.isdigit() or (aSetting.value == 'true' or aSetting.value == 'false')):
xbmc.executeJSONRPC('{"jsonrpc":"2.0", "id":1, "method":"Settings.SetSettingValue","params":{"setting":"' + aSetting.json_name() + '","value":' + aSetting.value + '}}')
else:
xbmc.executeJSONRPC('{"jsonrpc":"2.0", "id":1, "method":"Settings.SetSettingValue","params":{"setting":"' + aSetting.json_name() + '","value":"' + utils.encode(aSetting.value) + '"}}')
#make a copy of the guisettings file to make user based restores easier
xbmcvfs.copy(self.settingsFile, xbmc.translatePath("special://home/userdata/guisettings.xml.restored"))
开发者ID:robweber,项目名称:xbmcbackup,代码行数:34,代码来源:guisettings.py
示例10: HubSwap
def HubSwap(): # Swap Org/Hub versions if 'Hub Installer' found.
xbmc.log('script.pseudotv.live-service: HubSwap')
try:#unknown Amazon firetv error encountered here, requires investigation
icon = ADDON_PATH + '/icon'
HUB = chanlist.plugin_ok('plugin.program.addoninstaller')
if HUB == True:
xbmc.log('script.pseudotv.live-service: HubSwap - Hub Edition')
REAL_SETTINGS.setSetting("Hub","true")
try:
xbmcvfs.delete(icon + '.png')
except:
pass
try:
xbmcvfs.copy(icon + 'HUB', icon + '.png')
except:
pass
if NOTIFY == 'true':
xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % ("PseudoTV Live","Hub-Edition Activated", 4000, THUMB) )
else:
xbmc.log('script.pseudotv.live-service: HubSwap - Master')
REAL_SETTINGS.setSetting("Hub","false")
try:
xbmcvfs.delete(icon + '.png')
except:
pass
try:
xbmcvfs.copy(icon + 'OEM', icon + '.png')
except:
pass
except:
REAL_SETTINGS.setSetting("Hub","false")
pass
开发者ID:1c0n,项目名称:script.pseudotv.live,代码行数:35,代码来源:service.py
示例11: copy
def copy(file, path):
try: # Post Dharma
import xbmcvfs
size_file, hash_file = xbmc.subHashAndFileSize(file)
try:
size_dest, hash_dest = xbmc.subHashAndFileSize(os.path.join(path, os.path.basename(file)))
except:
size_dest = 0
hash_dest = ""
if hash_file != hash_dest:
xbmcvfs.copy(file, os.path.join(path, os.path.basename(file)))
if __settings__.getSetting( "delete" ) == "true":
size_dest, hash_dest = xbmc.subHashAndFileSize(os.path.join(path, os.path.basename(file)))
if hash_file == hash_dest:
xbmcvfs.delete(file)
log("Deleted %s" % file)
except: # Dharma
import shutil, filecmp
if not os.path.exists(os.path.join(path, os.path.basename(file))):
shutil.copy(file,os.path.join(path, os.path.basename(file)))
if filecmp.cmp(file, os.path.join(path, os.path.basename(file))) and __settings__.getSetting( "delete" ) == "true":
os.remove(file)
log("Deleted %s" % file)
开发者ID:wishie,项目名称:script.move.tv.shows,代码行数:27,代码来源:default.py
示例12: _enableKeymap
def _enableKeymap(self):
try:
xbmcvfs.copy(self.KEYMAPSOURCEFILE, self.KEYMAPDESTFILE)
xbmc.executebuiltin('Action(reloadkeymaps)')
log("SonosVolumeRedirect: Installed custom keymap")
except:
log("SonosVolumeRedirect: Failed to copy & load custom keymap: %s" % traceback.format_exc(), xbmc.LOGERROR)
开发者ID:robwebset,项目名称:script.sonos,代码行数:7,代码来源:service.py
示例13: pchkmedia
def pchkmedia():
try:
KmediaDir = "plugin.video.kmediatorrent"
f = open(os.path.join(addonspath,KmediaDir,"addon.xml"), 'r')
AddOnId=f.read()
f.close
except:
try:
KmediaDir = "plugin.video.kmediatorrent-2.3.7"
f = open(os.path.join(addonspath,KmediaDir,"addon.xml"), 'r')
AddOnId=f.read()
f.close
except:
return False
#if AddOnId == "" : return False
if not 'version="2.3.7"' in AddOnId: return False
destino = os.path.join(addonspath,KmediaDir,"resources","settings.xml")
if os.path.isfile(destino):
if not xbmcvfs.copy(os.path.join(__cwd__ , "resources" , "parches" , "kmediatorrent" , "settings.xml") , destino) : return False
else: return False
destino = os.path.join(addonspath,KmediaDir,"resources","site-packages","kmediatorrent","player.py")
if os.path.isfile(destino):
if not xbmcvfs.copy(os.path.join(__cwd__ , "resources" , "parches" , "kmediatorrent" , "player.py") , destino) : return False
else: return False
return True
开发者ID:surebic,项目名称:plugin.video.torrentin,代码行数:25,代码来源:tools.py
示例14: pchplexusstreams
def pchplexusstreams():
proceso = 0
proceso2 = 0
destinoset = os.path.join(addonspath,"plugin.video.plexus-streams","resources","settings.xml")
if os.path.isfile(destinoset):
md5sum = txtmd5(destinoset)
if md5sum == "d9ff4538382826cb676f83fad177d8a9":
proceso = 1
elif md5sum == "bde9fe5ba3d7d0159f0c5b127a5e0181":
proceso = 2
else: proceso = 3
else: proceso = 0
destinoace = os.path.join(addonspath,"plugin.video.plexus-streams","resources","core","acestream.py")
if os.path.isfile(destinoace):
md5sum = txtmd5(destinoace)
if md5sum == "5e06800233f5d49fa2e11353ef33533f":
proceso2 = 1
elif md5sum == "63267830d43361a408e8b34695cbb073":
proceso = 2
else: proceso = 3
else: proceso = 0
if proceso == 1 and proceso2 == 1:
if not xbmcvfs.copy(os.path.join(__cwd__ , "resources" , "parches" , "plexus-streams" , "settings.xml") , destinoset) : return 0
if not xbmcvfs.copy(os.path.join(__cwd__ , "resources" , "parches" , "plexus-streams" , "acestream.py") , destinoace) : return 0
return proceso
else: return proceso
开发者ID:surebic,项目名称:plugin.video.torrentin,代码行数:28,代码来源:tools.py
示例15: create_color_swatch_image
def create_color_swatch_image(self, colorstring):
'''helper method to generate a colorized image using PIL'''
if colorstring:
paths = []
paths.append(u"%s%s.png" % (COLORFILES_PATH, colorstring))
if xbmcvfs.exists(SKINCOLORFILE):
paths.append(u"%s%s.png" % (SKINCOLORFILES_PATH, colorstring))
for color_image_file in paths:
if not xbmcvfs.exists(color_image_file):
if SUPPORTS_PIL:
# create image with PIL
try:
colorstring = colorstring.strip()
if colorstring[0] == '#':
colorstring = colorstring[1:]
a, r, g, b = colorstring[:2], colorstring[2:4], colorstring[4:6], colorstring[6:]
a, r, g, b = [int(n, 16) for n in (a, r, g, b)]
color = (r, g, b, a)
img = Image.new("RGBA", (16, 16), color)
img.save(color_image_file)
del img
except Exception as exc:
log_exception(__name__, exc)
else:
# create image with online service if no pil support
xbmcvfs.copy( "https://dummyimage.com/16/%s/%s.png" % (colorstring[2:],colorstring[2:]), color_image_file )
log_msg("Local PIL module not available, generating color swatch image with online service", xbmc.LOGWARNING)
return color_image_file
开发者ID:kodibrasil,项目名称:KodiBrasil,代码行数:28,代码来源:ColorPicker.py
示例16: _copy_episodethumbs
def _copy_episodethumbs( self ):
count = 0
processeditems = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"properties": ["file", "title", "thumbnail", "season", "episode", "showtitle"], "filter": {"field": "path", "operator": "contains", "value": "%s"}}, "id": 1}' % self.path)
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = json.loads(json_query)
if json_response.has_key('result') and (json_response['result'] != None) and (json_response['result'].has_key('episodes')):
totalitems = len( json_response['result']['episodes'] )
for item in json_response['result']['episodes']:
if self.dialog.iscanceled():
log('script cancelled')
return
processeditems = processeditems + 1
self.dialog.update( int( float( processeditems ) / float( totalitems ) * 100), LANGUAGE(32008) + ': ' + str( count + 1 ) )
name = item['title']
tvshow = item['showtitle']
artwork = item['thumbnail']
season = item['season']
episode = item['episode']
episodenumber = "s%.2d%.2d" % (int( season ), int( episode ))
tmp_filename = tvshow + ' - ' + episodenumber + ' - ' + name + '.jpg'
filename = clean_filename( tmp_filename )
# test file path with tv_content to find source name
episodethumbspath = self.episodethumbspath
if self.split_tvshows_sources == "true" and self.tvshows_content.has_key(str(item['file'])):
episodethumbspath = os.path.join( self.episodethumbspath, self.tvshows_content[str(item['file'])])
if artwork != '':
try:
xbmcvfs.copy( xbmc.translatePath( artwork ), os.path.join( episodethumbspath, filename ) )
count += 1
except:
log( 'failed to copy episodethumb' )
log( 'episodethumbs copied: %s' % count )
开发者ID:ronie,项目名称:script.artworkorganizer,代码行数:33,代码来源:default.py
示例17: nestedCopy
def nestedCopy(rootSourceDir, rootTargetDir):
log("nestedCopy: Copy %s to %s" % (rootSourceDir, rootTargetDir))
# Make sure the target directory exists
xbmcvfs.mkdirs(rootTargetDir)
dirs, files = xbmcvfs.listdir(rootSourceDir)
for file in files:
try:
file = file.decode("utf-8")
except:
pass
sourceFile = "%s%s" % (rootSourceDir, file)
targetFile = "%s%s" % (rootTargetDir, file)
log("nestedCopy: Copy file %s to %s" % (sourceFile, targetFile))
xbmcvfs.copy(sourceFile, targetFile)
for adir in dirs:
try:
adir = adir.decode("utf-8")
except:
pass
sourceDir = "%s%s/" % (rootSourceDir, adir)
targetDir = "%s%s/" % (rootTargetDir, adir)
log("nestedCopy: Copy directory %s to %s" % (sourceDir, targetDir))
nestedCopy(sourceDir, targetDir)
开发者ID:robwebset,项目名称:service.addonsync,代码行数:27,代码来源:settings.py
示例18: _copy_albumthumbs
def _copy_albumthumbs( self ):
count = 0
processeditems = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": {"properties": ["title", "thumbnail", "artist"]}, "id": 1}')
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = json.loads(json_query)
if json_response.has_key('result') and (json_response['result'] != None) and (json_response['result'].has_key('albums')):
totalitems = len( json_response['result']['albums'] )
for item in json_response['result']['albums']:
if self.dialog.iscanceled():
log('script cancelled')
return
processeditems = processeditems + 1
self.dialog.update( int( float( processeditems ) / float( totalitems ) * 100), LANGUAGE(32011) + ': ' + str( count + 1 ) )
name = item['title']
artist = item['artist'][0]
artwork = item['thumbnail']
tmp_filename = artist + ' - ' + name + '.jpg'
filename = clean_filename( tmp_filename )
if artwork != '':
try:
xbmcvfs.copy( xbmc.translatePath( artwork ), os.path.join( self.albumthumbspath, filename ) )
count += 1
except:
log( 'failed to copy albumthumb' )
log( 'albumthumbs copied: %s' % count )
开发者ID:ronie,项目名称:script.artworkorganizer,代码行数:26,代码来源:default.py
示例19: blur
def blur(input_img, radius=25):
if not input_img:
return {}
if not xbmcvfs.exists(IMAGE_PATH):
xbmcvfs.mkdir(IMAGE_PATH)
input_img = utils.translate_path(urllib.unquote(input_img.encode("utf-8")))
input_img = input_img.replace("image://", "").rstrip("/")
cachedthumb = xbmc.getCacheThumbName(input_img)
filename = "%s-radius_%i.png" % (cachedthumb, radius)
targetfile = os.path.join(IMAGE_PATH, filename)
vid_cache_file = os.path.join("special://profile/Thumbnails/Video", cachedthumb[0], cachedthumb)
cache_file = os.path.join("special://profile/Thumbnails", cachedthumb[0], cachedthumb[:-4] + ".jpg")
if xbmcvfs.exists(targetfile):
img = PIL.Image.open(targetfile)
return {"ImageFilter": targetfile,
"ImageColor": get_colors(img)}
try:
if xbmcvfs.exists(cache_file):
utils.log("image already in xbmc cache: " + cache_file)
img = PIL.Image.open(utils.translate_path(cache_file))
elif xbmcvfs.exists(vid_cache_file):
utils.log("image already in xbmc video cache: " + vid_cache_file)
img = PIL.Image.open(utils.translate_path(vid_cache_file))
else:
xbmcvfs.copy(input_img, targetfile)
img = PIL.Image.open(targetfile)
img.thumbnail((200, 200), PIL.Image.ANTIALIAS)
imgfilter = MyGaussianBlur(radius=radius)
img = img.convert('RGB').filter(imgfilter)
img.save(targetfile)
except Exception:
utils.log("Could not get image for %s" % input_img)
return {}
return {"ImageFilter": targetfile,
"ImageColor": get_colors(img)}
开发者ID:phil65,项目名称:script.module.kodi65,代码行数:35,代码来源:imagetools.py
示例20: _copy_tvshowposters
def _copy_tvshowposters( self ):
count = 0
processeditems = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["file", "title", "art"], "filter": {"field": "path", "operator": "contains", "value": "%s"}}, "id": 1}' % self.path)
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = json.loads(json_query)
if json_response.has_key('result') and (json_response['result'] != None) and (json_response['result'].has_key('tvshows')):
totalitems = len( json_response['result']['tvshows'] )
for item in json_response['result']['tvshows']:
if self.dialog.iscanceled():
log('script cancelled')
return
processeditems = processeditems + 1
self.dialog.update( int( float( processeditems ) / float( totalitems ) * 100), LANGUAGE(32014) + ': ' + str( count + 1 ) )
name = item['title']
artwork = item['art'].get('poster')
tmp_filename = name + '.jpg'
filename = clean_filename( tmp_filename )
# test file path with tv_content to find source name
tvshowposterspath = self.tvshowposterspath
if self.split_tvshows_sources == "true":
for tv_file_path, source_name in self.tvshows_content.items():
if tv_file_path.startswith(item['file']):
tvshowposterspath = os.path.join( self.tvshowposterspath, source_name )
break
if artwork != '':
try:
xbmcvfs.copy( xbmc.translatePath( artwork ), os.path.join( tvshowposterspath, filename ) )
count += 1
except:
log( 'failed to copy tvshowposter' )
log( 'tvshowposters copied: %s' % count )
开发者ID:ronie,项目名称:script.artworkorganizer,代码行数:32,代码来源:default.py
注:本文中的xbmcvfs.copy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论