def _getAllPlayableFiles(folder, theFiles): current, dirs, files = sfile.walk(folder) for dir in dirs: path = os.path.join(current, dir) _getAllPlayableFiles(path, theFiles) for file in files: path = os.path.join(current, file) if isPlayable(path): size = sfile.size(path) theFiles[path] = [path, size]
def _getAllPlayableFiles(folder, theFiles): current, dirs, files = sfile.walk(folder) for dir in dirs: path = os.path.join(current, dir) _getAllPlayableFiles(path, theFiles) for file in files: path = os.path.join(current, file) if isPlayable(path, ignore=[]): size = sfile.size(path) theFiles[path] = [path, size]
def patchAmazonImage(mode, image, url, infoLabels): folder = url.rsplit(DELIMETER, 1)[0] files = s3.getAllFiles(folder, recurse=False) root = folder + removeExtension(url.replace(folder, '')) root = urllib.quote_plus(root).replace('%25LB%25', '%') for ext in IMG_EXT: img = root + ext for file in files: file = urllib.quote_plus(file.encode('utf-8')) if img == file: img = s3.convertToCloud(s3.getURL(img)) gif = s3.convertToCloud(s3.getURL(root + '.gif')) infoLabels['Gif'] = img #Kodi incorrectly handles remote gifs therefore download and store locally gifFolder = os.path.join(PROFILE, 'c') filename = os.path.join(gifFolder, getMD5(url.split('?', 1)[0])) + '.gif' if sfile.exists(filename): if sfile.size(filename) > 0: infoLabels['Gif'] = filename else: if DownloadIfExists(gif, filename): infoLabels['Gif'] = filename else: sfile.file(filename, 'w') #create empty file so we don't check again return img if mode == AMAZON_FOLDER: return DEFAULTFOLDER if mode == AMAZON_FILE: return DEFAULTMOVIE