def findMyMusic(self, primeDir=None, artistName=None): artistAlbums = {} if primeDir is None and artistName is None: ts = timestat("Find PrimeDir Artist Paths") pdPaths = { pd: pdpath for pd, pdpath in {pd: setDir(self.musicDir, pd) for pd in self.pdDirs}.items() if dirUtil(pdpath).isDir() } pdArtistPaths = { pd: findDirs(pdpath) for pd, pdpath in pdPaths.items() } artistPaths = { fsap.name: fsap.path for fsap in [dirUtil(ap) for ap in getFlatList(pdArtistPaths.values())] } artistAlbums = { artistName: self.getArtistPathData(artistName, artistPath) for artistName, artistPath in artistPaths.items() } print(" Found {0} Artists From {1} Prime Directories".format( len(artistAlbums), len(pdArtistPaths))) ts.stop() elif primeDir is not None: ts = timestat( "Finding All Artist Albums From [{0}] Prime Directory".format( primeDir)) pdPaths = { pd: pdpath for pd, pdpath in {pd: setDir(self.musicDir, pd) for pd in [primeDir]}.items() if dirUtil(pdpath).isDir() } pdArtistPaths = { pd: findDirs(pdpath) for pd, pdpath in pdPaths.items() } artistPaths = { fsap.name: fsap.path for fsap in [dirUtil(ap) for ap in getFlatList(pdArtistPaths.values())] } artistAlbums = { artistName: self.getArtistPathData(artistName, artistPath) for artistName, artistPath in artistPaths.items() } print(" Found {0} Artists From [{1}] Prime Directory".format( len(artistAlbums), primeDir)) ts.stop() elif artistName is not None: ts = timestat("Finding [{0}] Artist Albums".format(artistName)) artistAlbums = self.getArtistPathData(artistName) ts.stop() self.artistAlbums = artistAlbums return artistAlbums
def __init__(self): self.ignoreDirname = dirUtil(prefix).join("dbdata") self.ignoreFilename = fileUtil( self.ignoreDirname).join("dbIgnoreData.yaml") self.io = fileIO()
def albumInfo(self, album): return dirUtil(album).path
def getArtistMusicPath(self, artistName): artistPrimeDir = self.getArtistPrimeDir(artistName) artistMusicDir = setDir(artistPrimeDir, artistName) artistMusicDir = artistMusicDir if dirUtil( artistMusicDir).isDir() else None return artistMusicDir
def getMyUnmatchedMusicAlbums(self, dirval): return [ x for x in findDirs(dirval) if dirUtil(x).name not in self.mdirmap.getMappingDirs() ]