From e921d86fd684f17d4f12900741f073e248a48ff4 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sat, 27 Oct 2012 12:42:50 +0200 Subject: [PATCH] gui: add Player.Title to replace VideoPlayer.Title and MusicPlayer.Title --- xbmc/GUIInfoManager.cpp | 53 +++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index a4098e00f3d2b..5ea8eea88bd57 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -1381,10 +1381,35 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa break; case PLAYER_TITLE: { - if (g_application.IsPlayingVideo()) - strLabel = GetLabel(VIDEOPLAYER_TITLE); + if(m_currentFile) + { + if (m_currentFile->HasPVRChannelInfoTag()) + { + CEpgInfoTag tag; + return m_currentFile->GetPVRChannelInfoTag()->GetEPGNow(tag) ? + tag.Title() : + g_guiSettings.GetBool("epg.hidenoinfoavailable") ? + StringUtils::EmptyString : + g_localizeStrings.Get(19055); // no information available + } + if (m_currentFile->HasPVRRecordingInfoTag() && !m_currentFile->GetPVRRecordingInfoTag()->m_strTitle.IsEmpty()) + return m_currentFile->GetPVRRecordingInfoTag()->m_strTitle; + if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_strTitle.IsEmpty()) + return m_currentFile->GetVideoInfoTag()->m_strTitle; + if (m_currentFile->HasMusicInfoTag() && !m_currentFile->GetMusicInfoTag()->GetTitle().IsEmpty()) + return m_currentFile->GetMusicInfoTag()->GetTitle(); + // don't have the title, so use dvdplayer, label, or drop down to title from path + if (g_application.m_pPlayer && !g_application.m_pPlayer->GetPlayingTitle().IsEmpty()) + return g_application.m_pPlayer->GetPlayingTitle(); + if (!m_currentFile->GetLabel().IsEmpty()) + return m_currentFile->GetLabel(); + return CUtil::GetTitleFromPath(m_currentFile->GetPath()); + } else - strLabel = GetLabel(MUSICPLAYER_TITLE); + { + if (g_application.m_pPlayer && !g_application.m_pPlayer->GetPlayingTitle().IsEmpty()) + return g_application.m_pPlayer->GetPlayingTitle(); + } } break; case MUSICPLAYER_TITLE: @@ -3530,7 +3555,7 @@ CStdString CGUIInfoManager::GetMusicTagLabel(int info, const CFileItem *item) switch (info) { case MUSICPLAYER_TITLE: - if (tag.GetTitle().size()) { return tag.GetTitle(); } + return GetLabel(PLAYER_TITLE); break; case MUSICPLAYER_ALBUM: if (tag.GetAlbum().size()) { return tag.GetAlbum(); } @@ -3608,25 +3633,7 @@ CStdString CGUIInfoManager::GetVideoLabel(int item) if (item == VIDEOPLAYER_TITLE) { - if (m_currentFile->HasPVRChannelInfoTag()) - { - CEpgInfoTag tag; - return m_currentFile->GetPVRChannelInfoTag()->GetEPGNow(tag) ? - tag.Title() : - g_guiSettings.GetBool("epg.hidenoinfoavailable") ? - StringUtils::EmptyString : - g_localizeStrings.Get(19055); // no information available - } - if (m_currentFile->HasPVRRecordingInfoTag() && !m_currentFile->GetPVRRecordingInfoTag()->m_strTitle.IsEmpty()) - return m_currentFile->GetPVRRecordingInfoTag()->m_strTitle; - if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_strTitle.IsEmpty()) - return m_currentFile->GetVideoInfoTag()->m_strTitle; - // don't have the title, so use dvdplayer, label, or drop down to title from path - if (!g_application.m_pPlayer->GetPlayingTitle().IsEmpty()) - return g_application.m_pPlayer->GetPlayingTitle(); - if (!m_currentFile->GetLabel().IsEmpty()) - return m_currentFile->GetLabel(); - return CUtil::GetTitleFromPath(m_currentFile->GetPath()); + return GetLabel(PLAYER_TITLE); } else if (item == VIDEOPLAYER_PLAYLISTLEN) {