Ejemplo n.º 1
0
std::string Lyrics::GenerateFilename(const MPD::Song &s)
{
	std::string filename;
	if (Config.store_lyrics_in_song_dir)
	{
		if (s.isFromDB())
		{
			filename = Config.mpd_music_dir;
			filename += "/";
			filename += s.GetFile();
		}
		else
			filename = s.GetFile();
		// replace song's extension with .txt
		size_t dot = filename.rfind('.');
		assert(dot != std::string::npos);
		filename.resize(dot);
		filename += ".txt";
	}
	else
	{
		std::string file = locale_to_utf_cpy(s.GetArtist());
		file += " - ";
		file += locale_to_utf_cpy(s.GetTitle());
		file += ".txt";
		EscapeUnallowedChars(file);
		filename = Config.lyrics_directory;
		filename += "/";
		filename += file;
	}
	return filename;
}
Ejemplo n.º 2
0
void Browser::LocateSong(const MPD::Song &s)
{
	if (s.GetDirectory().empty())
		return;
	
	itsBrowseLocally = !s.isFromDB();
	
	if (myScreen != this)
		SwitchTo();
	
	if (itsBrowsedDir != s.GetDirectory())
		GetDirectory(s.GetDirectory());
	for (size_t i = 0; i < w->Size(); ++i)
	{
		if ((*w)[i].type == itSong && s.GetHash() == (*w)[i].song->GetHash())
		{
			w->Highlight(i);
			break;
		}
	}
}