audioplayer: add url to infobox; minor changes in display format

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7fbbafd613
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-06-18 (Sun, 18 Jun 2017)

Origin message was:
------------------
- audioplayer: add url to infobox; minor changes in display format

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-06-18 23:00:12 +02:00
parent a37ea12a57
commit ef6a3304c6

View File

@@ -1855,32 +1855,43 @@ void CAudioPlayerGui::paintDetailsLine(int pos)
m_infobox->forceTextPaint(false); m_infobox->forceTextPaint(false);
} }
//title // first line
std::string text_info = m_playlist[m_selected].MetaData.title; std::string text_info("");
getFileInfoToDisplay(text_info, m_playlist[m_selected]);
//date, genre text_info += "\n";
if (m_playlist[m_selected].MetaData.genre.empty())
text_info = m_playlist[m_selected].MetaData.date; // second line; url or date and genre
else if (m_playlist[m_selected].MetaData.date.empty()) if (m_inetmode)
text_info = m_playlist[m_selected].MetaData.genre; {
if (!m_playlist[m_selected].MetaData.url.empty())
{
text_info += m_playlist[m_selected].MetaData.url;
}
else
text_info += " ";
}
else else
{ {
text_info = m_playlist[m_selected].MetaData.genre; bool got_date = false;
text_info += " / "; if (!m_playlist[m_selected].MetaData.date.empty())
{
got_date = true;
text_info += m_playlist[m_selected].MetaData.date; text_info += m_playlist[m_selected].MetaData.date;
} }
//artist, album bool got_genre = false;
text_info = m_playlist[m_selected].MetaData.artist; if (!m_playlist[m_selected].MetaData.genre.empty())
if (!(m_playlist[m_selected].MetaData.album.empty()))
{ {
text_info += " ("; got_genre = true;
text_info += m_playlist[m_selected].MetaData.album; if (got_date)
text_info += ')'; text_info += " / ";
text_info += m_playlist[m_selected].MetaData.genre;
} }
// 'simulate' a second line; maybe usefull for some more informations e.g. url or so if (!got_date && !got_genre)
text_info += "\n "; text_info += " ";
}
m_infobox->setText(text_info, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO], COL_MENUCONTENTDARK_TEXT); m_infobox->setText(text_info, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO], COL_MENUCONTENTDARK_TEXT);
m_infobox->paint(false); m_infobox->paint(false);
@@ -2308,7 +2319,6 @@ bool CAudioPlayerGui::getNumericInput(neutrino_msg_t& msg, int& val)
void CAudioPlayerGui::getFileInfoToDisplay(std::string &fileInfo, CAudiofileExt &file) void CAudioPlayerGui::getFileInfoToDisplay(std::string &fileInfo, CAudiofileExt &file)
{ {
//std::string fileInfo;
std::string artist; std::string artist;
std::string title; std::string title;
@@ -2329,28 +2339,30 @@ void CAudioPlayerGui::getFileInfoToDisplay(std::string &fileInfo, CAudiofileExt
if (g_settings.audioplayer_display == TITLE_ARTIST) if (g_settings.audioplayer_display == TITLE_ARTIST)
{ {
fileInfo += title; fileInfo += title;
if (!title.empty() && !artist.empty()) fileInfo += ", "; if (!title.empty() && !artist.empty())
fileInfo += " - ";
fileInfo += artist; fileInfo += artist;
} }
else //if (g_settings.audioplayer_display == ARTIST_TITLE) else //if (g_settings.audioplayer_display == ARTIST_TITLE)
{ {
fileInfo += artist; fileInfo += artist;
if (!title.empty() && !artist.empty()) fileInfo += ", "; if (!title.empty() && !artist.empty())
fileInfo += " - ";
fileInfo += title; fileInfo += title;
} }
if (!file.MetaData.album.empty()) if (!file.MetaData.album.empty())
{ {
fileInfo += " ("; fileInfo += " - ";
fileInfo += file.MetaData.album; fileInfo += file.MetaData.album;
fileInfo += ')';
} }
if (fileInfo.empty()) if (fileInfo.empty())
{ {
fileInfo += "Unknown"; fileInfo += "Unknown";
} }
file.firstChar = (char)tolower(fileInfo[0]); file.firstChar = (char)tolower(fileInfo[0]);
//info += fileInfo;
} }
void CAudioPlayerGui::addToPlaylist(CAudiofileExt &file) void CAudioPlayerGui::addToPlaylist(CAudiofileExt &file)
@@ -2358,7 +2370,7 @@ void CAudioPlayerGui::addToPlaylist(CAudiofileExt &file)
//printf("add2Playlist: %s\n", file.Filename.c_str()); //printf("add2Playlist: %s\n", file.Filename.c_str());
if (m_select_title_by_name) if (m_select_title_by_name)
{ {
std::string t = ""; std::string t("");
getFileInfoToDisplay(t,file); getFileInfoToDisplay(t,file);
} }
else else
@@ -2540,7 +2552,7 @@ unsigned char CAudioPlayerGui::getFirstChar(CAudiofileExt &file)
{ {
if (file.firstChar == '\0') if (file.firstChar == '\0')
{ {
std::string info; std::string info("");
getFileInfoToDisplay(info, file); getFileInfoToDisplay(info, file);
} }
//printf("getFirstChar: %c\n",file.firstChar); //printf("getFirstChar: %c\n",file.firstChar);