def target_lyrics_filename(self, artist, title, song_dir, force_location=None): # FIXME Why did we have this condition here: if self.conn: if force_location is not None: lyrics_loc = force_location else: lyrics_loc = self.config.lyrics_location # Note: *_ALT searching is for compatibility with other mpd clients (like ncmpcpp): if lyrics_loc == consts.LYRICS_LOCATION_HOME: targetfile = os.path.expanduser("~/.lyrics/" + artist + "-" + title + ".txt") elif lyrics_loc == consts.LYRICS_LOCATION_PATH: targetfile = self.config.musicdir[ self.config. profile_num] + song_dir + "/" + artist + "-" + title + ".txt" elif lyrics_loc == consts.LYRICS_LOCATION_HOME_ALT: targetfile = os.path.expanduser("~/.lyrics/" + artist + " - " + title + ".txt") elif lyrics_loc == consts.LYRICS_LOCATION_PATH_ALT: targetfile = self.config.musicdir[ self.config. profile_num] + song_dir + "/" + artist + " - " + title + ".txt" targetfile = misc.file_exists_insensitive(targetfile) return misc.file_from_utf8(targetfile)
def target_lyrics_filename(self, artist, title, song_dir, force_location=None): # FIXME Why did we have this condition here: if self.conn: if force_location is not None: lyrics_loc = force_location else: lyrics_loc = self.config.lyrics_location if lyrics_loc == consts.LYRICS_LOCATION_HOME: targetfile = os.path.expanduser("~/.lyrics/" + artist + "-" + title + ".txt") elif lyrics_loc == consts.LYRICS_LOCATION_PATH: targetfile = self.config.musicdir[self.config.profile_num] + song_dir + "/" + artist + "-" + title + ".txt" targetfile = misc.file_exists_insensitive(targetfile) return misc.file_from_utf8(targetfile)
def target_lyrics_filename(self, artist, title, song_dir, force_location=None): # FIXME Why did we have this condition here: if self.conn: lyrics_loc = force_location if force_location else self.config.lyrics_location # Note: *_ALT searching is for compatibility with other mpd clients (like ncmpcpp): file_map = { consts.LYRICS_LOCATION_HOME : ("~/.lyrics", "%s-%s.txt"), consts.LYRICS_LOCATION_PATH : (self.config.musicdir[self.config.profile_num], song_dir, "%s-%s.txt"), consts.LYRICS_LOCATION_HOME_ALT : ("~/.lyrics", "%s - %s.txt"), consts.LYRICS_LOCATION_PATH_ALT : (self.config.musicdir[self.config.profile_num], song_dir, "%s - %s.txt"), } return misc.file_from_utf8(misc.file_exists_insensitive( os.path.expanduser( os.path.join(*file_map[lyrics_loc])) % (artist, title)))
def target_lyrics_filename(self, artist, title, song_dir, force_location=None): # FIXME Why did we have this condition here: if self.conn: lyrics_loc = force_location if force_location else self.config.lyrics_location # Note: *_ALT searching is for compatibility with other mpd clients (like ncmpcpp): if lyrics_loc == consts.LYRICS_LOCATION_HOME: targetfile = os.path.expanduser("~/.lyrics/" + artist + "-" + title + ".txt") elif lyrics_loc == consts.LYRICS_LOCATION_PATH: targetfile = self.config.musicdir[self.config.profile_num] + song_dir + "/" + artist + "-" + title + ".txt" elif lyrics_loc == consts.LYRICS_LOCATION_HOME_ALT: targetfile = os.path.expanduser("~/.lyrics/" + artist + " - " + title + ".txt") elif lyrics_loc == consts.LYRICS_LOCATION_PATH_ALT: targetfile = ( self.config.musicdir[self.config.profile_num] + song_dir + "/" + artist + " - " + title + ".txt" ) targetfile = misc.file_exists_insensitive(targetfile) return misc.file_from_utf8(targetfile)