def get_exact_images(self, path): paths = get_movie_path_list(path) result = {} sep = '\\' if '\\' in path else '/' path = os.path.dirname(path) + sep for dirname, moviefile in (os.path.split(p) for p in paths): dirname += sep check_moviebase = os.path.splitext(moviefile)[0].lower() dirs, files = xbmcvfs.listdir(dirname) for filename in files: check_filename = filename.lower() if not check_filename.endswith(('.jpg', '.png', '.gif')): continue imagefile = os.path.splitext(check_filename)[0] if '-' in imagefile: firstbit, imagefile = imagefile.rsplit('-', 1) if firstbit != check_moviebase: continue if not imagefile.isalnum() or len(imagefile) > 20: continue arttype = imagefile if self.identifyalternatives and arttype in self.alttypes.keys(): arttype = self.alttypes[arttype] if arttype in result.keys(): continue result[arttype] = self.buildimage(dirname + filename, filename) if self.identifyalternatives and dirs: if 'extrafanart' in dirs: result.update(self.getextra(path, result.keys())) if 'extrathumbs' in dirs: result.update(self.getextra(path, result.keys(), True)) return result
def get_exact_images(self, path): paths = get_movie_path_list(path) paths = [os.path.splitext(p)[0] + '.nfo' for p in paths] paths.append(os.path.dirname(paths[0]) + '/movie.nfo') artlist = None for nfopath in paths: root = read_nfofile(nfopath) if root is not None and root.find('art') is not None: artlist = root.find('art') break if artlist is None: return {} result = {} for artelement in artlist: arttype = artelement.tag.lower() url = artelement.text.strip() if arttype.isalnum() and url: result[arttype] = self.build_resultimage(url, arttype) return result