rendered paste bodyCStdString CUtil::GetTitleFromPath(const CStdString& strFileNameAndPath, bool bIsFolder /* = false */)
{
// use above to get the filename
CStdString strFilename = GetFileName(strFileNameAndPath);
// if upnp:// we can ask for the friendlyname
if (strFileNameAndPath.Left(7).Compare("upnp://") == 0) {
strFilename = CUPnPDirectory::GetFriendlyName(strFileNameAndPath.c_str());
}
CURL url(strPath);
if (url.GetProtocol() == "lastfm")
{
strFilename = "Last.FM"
}
else if (url.GetProtocol() == "smb")
{
strFilename = "SMB"
}
else if (url.GetProtocol() == "soundtrack")
{
strFilename = "MS Soundtracks"
}
else if (url.GetProtocol() == "shout")
{
strFilename = "Shout"
}
else if (url.GetProtocol() == "ftp")
{
strFilename = "FTP Server"
}
// now remove the extension if needed
if (g_guiSettings.GetBool("filelists.hideextensions") && !bIsFolder)
{
RemoveExtension(strFilename);
return strFilename;
}
return strFilename;
}