bool CMusicGUIInfo::GetBool(bool& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const { switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // MUSICPLAYER_* /////////////////////////////////////////////////////////////////////////////////////////////// case MUSICPLAYER_CONTENT: value = StringUtils::EqualsNoCase(info.GetData3(), "files"); return value; // if no match for this provider, other providers shall be asked. case MUSICPLAYER_HASPREVIOUS: // requires current playlist be PLAYLIST_MUSIC if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() == PLAYLIST_MUSIC) { value = (CServiceBroker::GetPlaylistPlayer().GetCurrentSong() > 0); // not first song return true; } break; case MUSICPLAYER_HASNEXT: // requires current playlist be PLAYLIST_MUSIC if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() == PLAYLIST_MUSIC) { value = (CServiceBroker::GetPlaylistPlayer().GetCurrentSong() < (CServiceBroker::GetPlaylistPlayer().GetPlaylist(PLAYLIST_MUSIC).size() - 1)); // not last song return true; } break; case MUSICPLAYER_PLAYLISTPLAYING: if (g_application.GetAppPlayer().IsPlayingAudio() && CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() == PLAYLIST_MUSIC) { value = true; return true; } break; case MUSICPLAYER_EXISTS: { int index = info.GetData2(); if (info.GetData1() == 1) { // relative index if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() != PLAYLIST_MUSIC) { value = false; return true; } index += CServiceBroker::GetPlaylistPlayer().GetCurrentSong(); } value = (index >= 0 && index < CServiceBroker::GetPlaylistPlayer().GetPlaylist(PLAYLIST_MUSIC).size()); return true; } /////////////////////////////////////////////////////////////////////////////////////////////// // MUSICPM_* /////////////////////////////////////////////////////////////////////////////////////////////// case MUSICPM_ENABLED: value = g_partyModeManager.IsEnabled(); return true; } return false; }
bool CMusicGUIInfo::GetPlaylistInfo(std::string& value, const CGUIInfo &info) const { PLAYLIST::CPlayList& playlist = CServiceBroker::GetPlaylistPlayer().GetPlaylist(PLAYLIST_MUSIC); if (playlist.size() < 1) return false; int index = info.GetData2(); if (info.GetData1() == 1) { // relative index (requires current playlist is PLAYLIST_MUSIC) if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() != PLAYLIST_MUSIC) return false; index = CServiceBroker::GetPlaylistPlayer().GetNextSong(index); } if (index < 0 || index >= playlist.size()) return false; const CFileItemPtr playlistItem = playlist[index]; if (!playlistItem->GetMusicInfoTag()->Loaded()) { playlistItem->LoadMusicTag(); playlistItem->GetMusicInfoTag()->SetLoaded(); } // try to set a thumbnail if (!playlistItem->HasArt("thumb")) { CMusicThumbLoader loader; loader.LoadItem(playlistItem.get()); // still no thumb? then just the set the default cover if (!playlistItem->HasArt("thumb")) playlistItem->SetArt("thumb", "DefaultAlbumCover.png"); } if (info.m_info == MUSICPLAYER_PLAYLISTPOS) { value = StringUtils::Format("%i", index + 1); return true; } else if (info.m_info == MUSICPLAYER_COVER) { value = playlistItem->GetArt("thumb"); return true; } return GetLabel(value, playlistItem.get(), 0, CGUIInfo(info.m_info), nullptr); }
bool CAddonsGUIInfo::GetBool(bool& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const { switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // SYSTEM_* /////////////////////////////////////////////////////////////////////////////////////////////// case SYSTEM_HAS_ADDON: { ADDON::AddonPtr addon; value = CServiceBroker::GetAddonMgr().GetAddon(info.GetData3(), addon) && addon; return true; } } return false; }
bool CPlayerGUIInfo::GetBool(bool& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const { const CFileItem *item = nullptr; if (gitem->IsFileItem()) item = static_cast<const CFileItem*>(gitem); switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // PLAYER_* /////////////////////////////////////////////////////////////////////////////////////////////// case PLAYER_SHOWINFO: value = m_playerShowInfo; return true; case PLAYER_DISPLAY_AFTER_SEEK: value = GetDisplayAfterSeek(); return true; case PLAYER_SHOWTIME: value = m_playerShowTime; return true; case PLAYER_MUTED: value = (g_application.IsMuted() || g_application.GetVolume(false) <= VOLUME_MINIMUM); return true; case PLAYER_HAS_MEDIA: value = g_application.GetAppPlayer().IsPlaying(); return true; case PLAYER_HAS_AUDIO: value = g_application.GetAppPlayer().IsPlayingAudio(); return true; case PLAYER_HAS_VIDEO: value = g_application.GetAppPlayer().IsPlayingVideo(); return true; case PLAYER_HAS_GAME: value = g_application.GetAppPlayer().IsPlayingGame(); return true; case PLAYER_PLAYING: value = g_application.GetAppPlayer().GetPlaySpeed() == 1.0; return true; case PLAYER_PAUSED: value = g_application.GetAppPlayer().IsPausedPlayback(); return true; case PLAYER_REWINDING: value = g_application.GetAppPlayer().GetPlaySpeed() < 0; return true; case PLAYER_FORWARDING: value = g_application.GetAppPlayer().GetPlaySpeed() > 1.5; return true; case PLAYER_REWINDING_2x: value = g_application.GetAppPlayer().GetPlaySpeed() == -2; return true; case PLAYER_REWINDING_4x: value = g_application.GetAppPlayer().GetPlaySpeed() == -4; return true; case PLAYER_REWINDING_8x: value = g_application.GetAppPlayer().GetPlaySpeed() == -8; return true; case PLAYER_REWINDING_16x: value = g_application.GetAppPlayer().GetPlaySpeed() == -16; return true; case PLAYER_REWINDING_32x: value = g_application.GetAppPlayer().GetPlaySpeed() == -32; return true; case PLAYER_FORWARDING_2x: value = g_application.GetAppPlayer().GetPlaySpeed() == 2; return true; case PLAYER_FORWARDING_4x: value = g_application.GetAppPlayer().GetPlaySpeed() == 4; return true; case PLAYER_FORWARDING_8x: value = g_application.GetAppPlayer().GetPlaySpeed() == 8; return true; case PLAYER_FORWARDING_16x: value = g_application.GetAppPlayer().GetPlaySpeed() == 16; return true; case PLAYER_FORWARDING_32x: value = g_application.GetAppPlayer().GetPlaySpeed() == 32; return true; case PLAYER_CAN_PAUSE: value = g_application.GetAppPlayer().CanPause(); return true; case PLAYER_CAN_SEEK: value = g_application.GetAppPlayer().CanSeek(); return true; case PLAYER_SUPPORTS_TEMPO: value = g_application.GetAppPlayer().SupportsTempo(); return true; case PLAYER_IS_TEMPO: { value = (g_application.GetAppPlayer().GetPlayTempo() != 1.0 && g_application.GetAppPlayer().GetPlaySpeed() == 1.0); return true; } case PLAYER_CACHING: value = g_application.GetAppPlayer().IsCaching(); return true; case PLAYER_SEEKBAR: { CGUIDialog *seekBar = CServiceBroker::GetGUI()->GetWindowManager().GetDialog(WINDOW_DIALOG_SEEK_BAR); value = seekBar ? seekBar->IsDialogRunning() : false; return true; } case PLAYER_SEEKING: value = g_application.GetAppPlayer().GetSeekHandler().InProgress(); return true; case PLAYER_PASSTHROUGH: value = g_application.GetAppPlayer().IsPassthrough(); return true; case PLAYER_ISINTERNETSTREAM: if (item) { value = URIUtils::IsInternetStream(item->GetPath()); return true; } break; case PLAYER_HAS_PROGRAMS: value = (g_application.GetAppPlayer().GetProgramsCount() > 1) ? true : false; return true; case PLAYER_HASDURATION: value = g_application.GetTotalTime() > 0; return true; /////////////////////////////////////////////////////////////////////////////////////////////// // PLAYLIST_* /////////////////////////////////////////////////////////////////////////////////////////////// case PLAYLIST_ISRANDOM: { PLAYLIST::CPlayListPlayer& player = CServiceBroker::GetPlaylistPlayer(); int playlistid = info.GetData1(); if (info.GetData2() > 0 && playlistid > PLAYLIST_NONE) value = player.IsShuffled(playlistid); else value = player.IsShuffled(player.GetCurrentPlaylist()); return true; } case PLAYLIST_ISREPEAT: { PLAYLIST::CPlayListPlayer& player = CServiceBroker::GetPlaylistPlayer(); int playlistid = info.GetData1(); if (info.GetData2() > 0 && playlistid > PLAYLIST_NONE) value = (player.GetRepeat(playlistid) == PLAYLIST::REPEAT_ALL); else value = player.GetRepeat(player.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ALL; return true; } case PLAYLIST_ISREPEATONE: { PLAYLIST::CPlayListPlayer& player = CServiceBroker::GetPlaylistPlayer(); int playlistid = info.GetData1(); if (info.GetData2() > 0 && playlistid > PLAYLIST_NONE) value = (player.GetRepeat(playlistid) == PLAYLIST::REPEAT_ONE); else value = player.GetRepeat(player.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ONE; return true; } /////////////////////////////////////////////////////////////////////////////////////////////// // PLAYER_PROCESS_* /////////////////////////////////////////////////////////////////////////////////////////////// case PLAYER_PROCESS_VIDEOHWDECODER: value = CServiceBroker::GetDataCacheCore().IsVideoHwDecoder(); return true; /////////////////////////////////////////////////////////////////////////////////////////////// // LISTITEM_* /////////////////////////////////////////////////////////////////////////////////////////////// case LISTITEM_ISPLAYING: { if (item) { if (item->HasProperty("playlistposition")) { value = static_cast<int>(item->GetProperty("playlisttype").asInteger()) == CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() && static_cast<int>(item->GetProperty("playlistposition").asInteger()) == CServiceBroker::GetPlaylistPlayer().GetCurrentSong(); return true; } else if (m_currentItem && !m_currentItem->GetPath().empty()) { if (!g_application.m_strPlayListFile.empty()) { //playlist file that is currently playing or the playlistitem that is currently playing. value = item->IsPath(g_application.m_strPlayListFile) || m_currentItem->IsSamePath(item); } else { value = m_currentItem->IsSamePath(item); } return true; } } break; } } return false; }
bool CPlayerGUIInfo::GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const { switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // PLAYER_* /////////////////////////////////////////////////////////////////////////////////////////////// case PLAYER_SEEKOFFSET: { std::string seekOffset = StringUtils::SecondsToTimeString(std::abs(m_seekOffset / 1000), static_cast<TIME_FORMAT>(info.GetData1())); if (m_seekOffset < 0) value = "-" + seekOffset; else if (m_seekOffset > 0) value = "+" + seekOffset; return true; } case PLAYER_VOLUME: value = StringUtils::Format("%2.1f dB", CAEUtil::PercentToGain(g_application.GetVolume(false))); return true; case PLAYER_SUBTITLE_DELAY: value = StringUtils::Format("%2.3f s", g_application.GetAppPlayer().GetVideoSettings().m_SubtitleDelay); return true; case PLAYER_AUDIO_DELAY: value = StringUtils::Format("%2.3f s", g_application.GetAppPlayer().GetVideoSettings().m_AudioDelay); return true; case PLAYER_CHAPTER: value = StringUtils::Format("%02d", g_application.GetAppPlayer().GetChapter()); return true; case PLAYER_CHAPTERCOUNT: value = StringUtils::Format("%02d", g_application.GetAppPlayer().GetChapterCount()); return true; case PLAYER_CHAPTERNAME: g_application.GetAppPlayer().GetChapterName(value); return true; case PLAYER_PATH: case PLAYER_FILENAME: case PLAYER_FILEPATH: value = item->GetPath(); if (info.m_info == PLAYER_PATH) { // do this twice since we want the path outside the archive if this // is to be of use. if (URIUtils::IsInArchive(value)) value = URIUtils::GetParentPath(value); value = URIUtils::GetParentPath(value); } else if (info.m_info == PLAYER_FILENAME) value = URIUtils::GetFileName(value); return true; case PLAYER_TITLE: // use label or drop down to title from path value = item->GetLabel(); if (value.empty()) value = CUtil::GetTitleFromPath(item->GetPath()); return true; case PLAYER_PLAYSPEED: { float speed = g_application.GetAppPlayer().GetPlaySpeed(); if (speed == 1.0) speed = g_application.GetAppPlayer().GetPlayTempo(); value = StringUtils::Format("%.2f", speed); return true; } case PLAYER_TIME: value = GetCurrentPlayTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PLAYER_START_TIME: { const CDateTime time(g_application.GetAppPlayer().GetStartTime()); value = time.GetAsLocalizedTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; } case PLAYER_DURATION: value = GetDuration(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PLAYER_TIME_REMAINING: value = GetCurrentPlayTimeRemaining(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PLAYER_FINISH_TIME: { CDateTime time(CDateTime::GetCurrentDateTime()); int playTimeRemaining = GetPlayTimeRemaining(); float speed = g_application.GetAppPlayer().GetPlaySpeed(); float tempo = g_application.GetAppPlayer().GetPlayTempo(); if (speed == 1.0) playTimeRemaining /= tempo; time += CDateTimeSpan(0, 0, 0, playTimeRemaining); value = time.GetAsLocalizedTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; } case PLAYER_TIME_SPEED: { float speed = g_application.GetAppPlayer().GetPlaySpeed(); if (speed != 1.0) value = StringUtils::Format("%s (%ix)", GetCurrentPlayTime(static_cast<TIME_FORMAT>(info.GetData1())).c_str(), static_cast<int>(speed)); else value = GetCurrentPlayTime(TIME_FORMAT_GUESS); return true; } case PLAYER_SEEKTIME: value = GetCurrentSeekTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PLAYER_SEEKSTEPSIZE: { int seekSize = g_application.GetAppPlayer().GetSeekHandler().GetSeekSize(); std::string strSeekSize = StringUtils::SecondsToTimeString(abs(seekSize), static_cast<TIME_FORMAT>(info.GetData1())); if (seekSize < 0) value = "-" + strSeekSize; if (seekSize > 0) value = "+" + strSeekSize; return true; } case PLAYER_SEEKNUMERIC: value = GetSeekTime(static_cast<TIME_FORMAT>(info.GetData1())); return !value.empty(); case PLAYER_CACHELEVEL: { int iLevel = g_application.GetAppPlayer().GetCacheLevel(); if (iLevel >= 0) { value = StringUtils::Format("%i", iLevel); return true; } break; } case PLAYER_ITEM_ART: value = item->GetArt(info.GetData3()); return true; /////////////////////////////////////////////////////////////////////////////////////////////// // PLAYER_PROCESS_* /////////////////////////////////////////////////////////////////////////////////////////////// case PLAYER_PROCESS_VIDEODECODER: value = CServiceBroker::GetDataCacheCore().GetVideoDecoderName(); return true; case PLAYER_PROCESS_DEINTMETHOD: value = CServiceBroker::GetDataCacheCore().GetVideoDeintMethod(); return true; case PLAYER_PROCESS_PIXELFORMAT: value = CServiceBroker::GetDataCacheCore().GetVideoPixelFormat(); return true; case PLAYER_PROCESS_VIDEOFPS: value = StringUtils::Format("%.3f", CServiceBroker::GetDataCacheCore().GetVideoFps()); return true; case PLAYER_PROCESS_VIDEODAR: value = StringUtils::Format("%.2f", CServiceBroker::GetDataCacheCore().GetVideoDAR()); return true; case PLAYER_PROCESS_VIDEOWIDTH: value = StringUtils::FormatNumber(CServiceBroker::GetDataCacheCore().GetVideoWidth()); return true; case PLAYER_PROCESS_VIDEOHEIGHT: value = StringUtils::FormatNumber(CServiceBroker::GetDataCacheCore().GetVideoHeight()); return true; case PLAYER_PROCESS_AUDIODECODER: value = CServiceBroker::GetDataCacheCore().GetAudioDecoderName(); return true; case PLAYER_PROCESS_AUDIOCHANNELS: value = CServiceBroker::GetDataCacheCore().GetAudioChannels(); return true; case PLAYER_PROCESS_AUDIOSAMPLERATE: value = StringUtils::FormatNumber(CServiceBroker::GetDataCacheCore().GetAudioSampleRate()); return true; case PLAYER_PROCESS_AUDIOBITSPERSAMPLE: value = StringUtils::FormatNumber(CServiceBroker::GetDataCacheCore().GetAudioBitsPerSample()); return true; /////////////////////////////////////////////////////////////////////////////////////////////// // PLAYLIST_* /////////////////////////////////////////////////////////////////////////////////////////////// case PLAYLIST_LENGTH: case PLAYLIST_POSITION: case PLAYLIST_RANDOM: case PLAYLIST_REPEAT: value = GUIINFO::GetPlaylistLabel(info.m_info, info.GetData1()); return true; } return false; }
bool CSystemGUIInfo::GetBool(bool& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const { switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // SYSTEM_* /////////////////////////////////////////////////////////////////////////////////////////////// case SYSTEM_ALWAYS_TRUE: value = true; return true; case SYSTEM_ALWAYS_FALSE: value = false; return true; case SYSTEM_ETHERNET_LINK_ACTIVE: // wtf: not implementated - always returns true?! value = true; return true; case SYSTEM_PLATFORM_LINUX: #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) value = true; #else value = false; #endif return true; case SYSTEM_PLATFORM_WINDOWS: #ifdef TARGET_WINDOWS value = true; #else value = false; #endif return true; case SYSTEM_PLATFORM_UWP: #ifdef TARGET_WINDOWS_STORE value = true; #else value = false; #endif return true; case SYSTEM_PLATFORM_DARWIN: #ifdef TARGET_DARWIN value = true; #else value = false; #endif return true; case SYSTEM_PLATFORM_DARWIN_OSX: #ifdef TARGET_DARWIN_OSX value = true; #else value = false; #endif return true; case SYSTEM_PLATFORM_DARWIN_IOS: #ifdef TARGET_DARWIN_IOS value = true; #else value = false; #endif return true; case SYSTEM_PLATFORM_ANDROID: #if defined(TARGET_ANDROID) value = true; #else value = false; #endif return true; case SYSTEM_PLATFORM_LINUX_RASPBERRY_PI: #if defined(TARGET_RASPBERRY_PI) value = true; #else value = false; #endif return true; case SYSTEM_MEDIA_DVD: value = g_mediaManager.IsDiscInDrive(); return true; case SYSTEM_MEDIA_AUDIO_CD: #ifdef HAS_DVD_DRIVE if (g_mediaManager.IsDiscInDrive()) { MEDIA_DETECT::CCdInfo *pCdInfo = g_mediaManager.GetCdInfo(); value = pCdInfo && (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1)); } else #endif { value = false; } return true; #ifdef HAS_DVD_DRIVE case SYSTEM_DVDREADY: value = g_mediaManager.GetDriveStatus() != DRIVE_NOT_READY; return true; case SYSTEM_TRAYOPEN: value = g_mediaManager.GetDriveStatus() == DRIVE_OPEN; return true; #endif case SYSTEM_CAN_POWERDOWN: value = CServiceBroker::GetPowerManager().CanPowerdown(); return true; case SYSTEM_CAN_SUSPEND: value = CServiceBroker::GetPowerManager().CanSuspend(); return true; case SYSTEM_CAN_HIBERNATE: value = CServiceBroker::GetPowerManager().CanHibernate(); return true; case SYSTEM_CAN_REBOOT: value = CServiceBroker::GetPowerManager().CanReboot(); return true; case SYSTEM_SCREENSAVER_ACTIVE: value = g_application.IsInScreenSaver(); return true; case SYSTEM_DPMS_ACTIVE: value = g_application.IsDPMSActive(); return true; case SYSTEM_HASLOCKS: value = CServiceBroker::GetSettingsComponent()->GetProfileManager()->GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE; return true; case SYSTEM_HAS_PVR: value = true; return true; case SYSTEM_HAS_PVR_ADDON: { ADDON::VECADDONS pvrAddons; ADDON::CBinaryAddonCache &addonCache = CServiceBroker::GetBinaryAddonCache(); addonCache.GetAddons(pvrAddons, ADDON::ADDON_PVRDLL); value = (pvrAddons.size() > 0); return true; } case SYSTEM_HAS_CMS: #if defined(HAS_GL) || defined(HAS_DX) value = true; #else value = false; #endif return true; case SYSTEM_ISMASTER: value = CServiceBroker::GetSettingsComponent()->GetProfileManager()->GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && g_passwordManager.bMasterUser; return true; case SYSTEM_ISFULLSCREEN: value = CServiceBroker::GetWinSystem()->IsFullScreen(); return true; case SYSTEM_ISSTANDALONE: value = g_application.IsStandAlone(); return true; case SYSTEM_ISINHIBIT: value = g_application.IsIdleShutdownInhibited(); return true; case SYSTEM_HAS_SHUTDOWN: value = (CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_POWERMANAGEMENT_SHUTDOWNTIME) > 0); return true; case SYSTEM_LOGGEDON: value = !(CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_LOGIN_SCREEN); return true; case SYSTEM_SHOW_EXIT_BUTTON: value = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_showExitButton; return true; case SYSTEM_HAS_LOGINSCREEN: value = CServiceBroker::GetSettingsComponent()->GetProfileManager()->UsingLoginScreen(); return true; case SYSTEM_INTERNET_STATE: { g_sysinfo.GetInfo(info.m_info); value = g_sysinfo.HasInternet(); return true; } case SYSTEM_IDLE_TIME: value = g_application.GlobalIdleTime() >= static_cast<int>(info.GetData1()); return true; case SYSTEM_HAS_CORE_ID: value = g_cpuInfo.HasCoreId(info.GetData1()); return true; case SYSTEM_DATE: { if (info.GetData2() == -1) // info doesn't contain valid startDate return false; const CDateTime date = CDateTime::GetCurrentDateTime(); int currentDate = date.GetMonth() * 100 + date.GetDay(); int startDate = info.GetData1(); int stopDate = info.GetData2(); if (stopDate < startDate) value = currentDate >= startDate || currentDate < stopDate; else value = currentDate >= startDate && currentDate < stopDate; return true; } case SYSTEM_TIME: { int currentTime = CDateTime::GetCurrentDateTime().GetMinuteOfDay(); int startTime = info.GetData1(); int stopTime = info.GetData2(); if (stopTime < startTime) value = currentTime >= startTime || currentTime < stopTime; else value = currentTime >= startTime && currentTime < stopTime; return true; } case SYSTEM_ALARM_LESS_OR_EQUAL: { int time = std::lrint(g_alarmClock.GetRemaining(info.GetData3())); int timeCompare = info.GetData2(); if (time > 0) value = timeCompare >= time; else value = false; return true; } case SYSTEM_HAS_ALARM: value = g_alarmClock.HasAlarm(info.GetData3()); return true; case SYSTEM_GET_BOOL: value = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(info.GetData3()); return true; case SYSTEM_SETTING: { if (StringUtils::EqualsNoCase(info.GetData3(), "hidewatched")) { CGUIMediaWindow* window = GUIINFO::GetMediaWindow(contextWindow); if (window) { value = CMediaSettings::GetInstance().GetWatchedMode(window->CurrentDirectory().GetContent()) == WatchedModeUnwatched; return true; } } break; } } return false; }
bool CSystemGUIInfo::GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const { switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // SYSTEM_* /////////////////////////////////////////////////////////////////////////////////////////////// case SYSTEM_TIME: value = CDateTime::GetCurrentDateTime().GetAsLocalizedTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; case SYSTEM_DATE: if (info.GetData3().empty()) value = CDateTime::GetCurrentDateTime().GetAsLocalizedDate(true); else value = CDateTime::GetCurrentDateTime().GetAsLocalizedDate(info.GetData3()); return true; case SYSTEM_FREE_SPACE: case SYSTEM_USED_SPACE: case SYSTEM_TOTAL_SPACE: case SYSTEM_FREE_SPACE_PERCENT: case SYSTEM_USED_SPACE_PERCENT: value = g_sysinfo.GetHddSpaceInfo(info.m_info); return true; case SYSTEM_CPU_TEMPERATURE: case SYSTEM_GPU_TEMPERATURE: case SYSTEM_FAN_SPEED: case SYSTEM_CPU_USAGE: value = GetSystemHeatInfo(info.m_info); return true; case SYSTEM_VIDEO_ENCODER_INFO: case NETWORK_MAC_ADDRESS: case SYSTEM_OS_VERSION_INFO: case SYSTEM_CPUFREQUENCY: case SYSTEM_INTERNET_STATE: case SYSTEM_UPTIME: case SYSTEM_TOTALUPTIME: case SYSTEM_BATTERY_LEVEL: value = g_sysinfo.GetInfo(info.m_info); return true; case SYSTEM_PRIVACY_POLICY: value = g_sysinfo.GetPrivacyPolicy(); return true; case SYSTEM_SCREEN_RESOLUTION: { RESOLUTION_INFO& resInfo = CDisplaySettings::GetInstance().GetCurrentResolutionInfo(); if (CServiceBroker::GetWinSystem()->IsFullScreen()) value = StringUtils::Format("%ix%i@%.2fHz - %s", resInfo.iScreenWidth, resInfo.iScreenHeight, resInfo.fRefreshRate, g_localizeStrings.Get(244).c_str()); else value = StringUtils::Format("%ix%i - %s", resInfo.iScreenWidth, resInfo.iScreenHeight, g_localizeStrings.Get(242).c_str()); return true; } case SYSTEM_BUILD_VERSION_SHORT: value = CSysInfo::GetVersionShort(); return true; case SYSTEM_BUILD_VERSION: value = CSysInfo::GetVersion(); return true; case SYSTEM_BUILD_DATE: value = CSysInfo::GetBuildDate(); return true; case SYSTEM_FREE_MEMORY: case SYSTEM_FREE_MEMORY_PERCENT: case SYSTEM_USED_MEMORY: case SYSTEM_USED_MEMORY_PERCENT: case SYSTEM_TOTAL_MEMORY: { MEMORYSTATUSEX stat; stat.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&stat); int iMemPercentFree = 100 - static_cast<int>(100.0f * (stat.ullTotalPhys - stat.ullAvailPhys) / stat.ullTotalPhys + 0.5f); int iMemPercentUsed = 100 - iMemPercentFree; if (info.m_info == SYSTEM_FREE_MEMORY) value = StringUtils::Format("%uMB", static_cast<unsigned int>(stat.ullAvailPhys / MB)); else if (info.m_info == SYSTEM_FREE_MEMORY_PERCENT) value = StringUtils::Format("%i%%", iMemPercentFree); else if (info.m_info == SYSTEM_USED_MEMORY) value = StringUtils::Format("%uMB", static_cast<unsigned int>((stat.ullTotalPhys - stat.ullAvailPhys) / MB)); else if (info.m_info == SYSTEM_USED_MEMORY_PERCENT) value = StringUtils::Format("%i%%", iMemPercentUsed); else if (info.m_info == SYSTEM_TOTAL_MEMORY) value = StringUtils::Format("%uMB", static_cast<unsigned int>(stat.ullTotalPhys / MB)); return true; } case SYSTEM_SCREEN_MODE: value = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo().strMode; return true; case SYSTEM_SCREEN_WIDTH: value = StringUtils::Format("%i", CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo().iScreenWidth); return true; case SYSTEM_SCREEN_HEIGHT: value = StringUtils::Format("%i", CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo().iScreenHeight); return true; case SYSTEM_FPS: value = StringUtils::Format("%02.2f", m_fps); return true; #ifdef HAS_DVD_DRIVE case SYSTEM_DVD_LABEL: value = g_mediaManager.GetDiskLabel(); return true; #endif case SYSTEM_ALARM_POS: if (g_alarmClock.GetRemaining("shutdowntimer") == 0.f) value.clear(); else { double fTime = g_alarmClock.GetRemaining("shutdowntimer"); if (fTime > 60.f) value = StringUtils::Format(g_localizeStrings.Get(13213).c_str(), g_alarmClock.GetRemaining("shutdowntimer")/60.f); else value = StringUtils::Format(g_localizeStrings.Get(13214).c_str(), g_alarmClock.GetRemaining("shutdowntimer")); } return true; case SYSTEM_PROFILENAME: value = CServiceBroker::GetSettingsComponent()->GetProfileManager()->GetCurrentProfile().getName(); return true; case SYSTEM_PROFILECOUNT: value = StringUtils::Format("{0}", CServiceBroker::GetSettingsComponent()->GetProfileManager()->GetNumberOfProfiles()); return true; case SYSTEM_PROFILEAUTOLOGIN: { const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); int iProfileId = profileManager->GetAutoLoginProfileId(); if ((iProfileId < 0) || !profileManager->GetProfileName(iProfileId, value)) value = g_localizeStrings.Get(37014); // Last used profile return true; } case SYSTEM_PROFILETHUMB: { const std::string& thumb = CServiceBroker::GetSettingsComponent()->GetProfileManager()->GetCurrentProfile().getThumb(); value = thumb.empty() ? "DefaultUser.png" : thumb; return true; } case SYSTEM_LANGUAGE: value = g_langInfo.GetEnglishLanguageName(); return true; case SYSTEM_TEMPERATURE_UNITS: value = g_langInfo.GetTemperatureUnitString(); return true; case SYSTEM_FRIENDLY_NAME: value = CSysInfo::GetDeviceName(); return true; case SYSTEM_STEREOSCOPIC_MODE: { int iStereoMode = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOSCREEN_STEREOSCOPICMODE); value = StringUtils::Format("%i", iStereoMode); return true; } case SYSTEM_GET_CORE_USAGE: value = StringUtils::Format("%4.2f", g_cpuInfo.GetCoreInfo(std::atoi(info.GetData3().c_str())).m_fPct); return true; case SYSTEM_RENDER_VENDOR: value = CServiceBroker::GetRenderSystem()->GetRenderVendor(); return true; case SYSTEM_RENDER_RENDERER: value = CServiceBroker::GetRenderSystem()->GetRenderRenderer(); return true; case SYSTEM_RENDER_VERSION: value = CServiceBroker::GetRenderSystem()->GetRenderVersionString(); return true; /////////////////////////////////////////////////////////////////////////////////////////////// // NETWORK_* /////////////////////////////////////////////////////////////////////////////////////////////// case NETWORK_IP_ADDRESS: { CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface(); if (iface) { value = iface->GetCurrentIPAddress(); return true; } break; } case NETWORK_SUBNET_MASK: { CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface(); if (iface) { value = iface->GetCurrentNetmask(); return true; } break; } case NETWORK_GATEWAY_ADDRESS: { CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface(); if (iface) { value = iface->GetCurrentDefaultGateway(); return true; } break; } case NETWORK_DNS1_ADDRESS: { const std::vector<std::string> nss = CServiceBroker::GetNetwork().GetNameServers(); if (nss.size() >= 1) { value = nss[0]; return true; } break; } case NETWORK_DNS2_ADDRESS: { const std::vector<std::string> nss = CServiceBroker::GetNetwork().GetNameServers(); if (nss.size() >= 2) { value = nss[1]; return true; } break; } case NETWORK_DHCP_ADDRESS: { // wtf? std::string dhcpserver; value = dhcpserver; return true; } case NETWORK_LINK_STATE: { std::string linkStatus = g_localizeStrings.Get(151); linkStatus += " "; CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface(); if (iface && iface->IsConnected()) linkStatus += g_localizeStrings.Get(15207); else linkStatus += g_localizeStrings.Get(15208); value = linkStatus; return true; } } return false; }
bool CAddonsGUIInfo::GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const { const std::shared_ptr<const ADDON::IAddon> addonInfo = item->GetAddonInfo(); if (addonInfo) { switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // LISTITEM_* /////////////////////////////////////////////////////////////////////////////////////////////// case LISTITEM_ADDON_NAME: value = addonInfo->Name(); return true; case LISTITEM_ADDON_VERSION: value = addonInfo->Version().asString(); return true; case LISTITEM_ADDON_CREATOR: value = addonInfo->Author(); return true; case LISTITEM_ADDON_SUMMARY: value = addonInfo->Summary(); return true; case LISTITEM_ADDON_DESCRIPTION: value = addonInfo->Description(); return true; case LISTITEM_ADDON_DISCLAIMER: value = addonInfo->Disclaimer(); return true; case LISTITEM_ADDON_NEWS: value = addonInfo->ChangeLog(); return true; case LISTITEM_ADDON_BROKEN: value = addonInfo->Broken(); return true; case LISTITEM_ADDON_TYPE: value = ADDON::CAddonInfo::TranslateType(addonInfo->Type(), true); return true; case LISTITEM_ADDON_INSTALL_DATE: value = addonInfo->InstallDate().GetAsLocalizedDateTime(); return true; case LISTITEM_ADDON_LAST_UPDATED: if (addonInfo->LastUpdated().IsValid()) { value = addonInfo->LastUpdated().GetAsLocalizedDateTime(); return true; } break; case LISTITEM_ADDON_LAST_USED: if (addonInfo->LastUsed().IsValid()) { value = addonInfo->LastUsed().GetAsLocalizedDateTime(); return true; } break; case LISTITEM_ADDON_ORIGIN: { if (item->GetAddonInfo()->Origin() == ADDON::ORIGIN_SYSTEM) { value = g_localizeStrings.Get(24992); return true; } ADDON::AddonPtr origin; if (CServiceBroker::GetAddonMgr().GetAddon(item->GetAddonInfo()->Origin(), origin, ADDON::ADDON_UNKNOWN, false)) { value = origin->Name(); return true; } value = g_localizeStrings.Get(13205); return true; } case LISTITEM_ADDON_SIZE: { uint64_t packageSize = item->GetAddonInfo()->PackageSize(); if (packageSize > 0) { value = StringUtils::FormatFileSize(packageSize); return true; } break; } } } switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // SYSTEM_* /////////////////////////////////////////////////////////////////////////////////////////////// case SYSTEM_ADDON_TITLE: case SYSTEM_ADDON_ICON: case SYSTEM_ADDON_VERSION: { // This logic does not check/care whether an addon has been disabled/marked as broken, // it simply retrieves it's name or icon that means if an addon is placed on the home screen it // will stay there even if it's disabled/marked as broken. This might need to be changed/fixed // in the future. ADDON::AddonPtr addon; if (!info.GetData3().empty()) { CServiceBroker::GetAddonMgr().GetAddon(info.GetData3(), addon, ADDON::ADDON_UNKNOWN, false); if (!addon) break; if (info.m_info == SYSTEM_ADDON_TITLE) { value = addon->Name(); return true; } if (info.m_info == SYSTEM_ADDON_ICON) { value = addon->Icon(); return true; } if (info.m_info == SYSTEM_ADDON_VERSION) { value = addon->Version().asString(); return true; } } break; } } return false; }
bool CPVRGUIInfo::GetRadioRDSLabel(const CFileItem *item, const CGUIInfo &info, std::string &strValue) const { if (!item->HasPVRChannelInfoTag()) return false; const std::shared_ptr<CPVRRadioRDSInfoTag> tag = item->GetPVRChannelInfoTag()->GetRadioRDSInfoTag(); if (tag) { switch (info.m_info) { case RDS_CHANNEL_COUNTRY: strValue = tag->GetCountry(); return true; case RDS_TITLE: strValue = tag->GetTitle(); return true; case RDS_ARTIST: strValue = tag->GetArtist(); return true; case RDS_BAND: strValue = tag->GetBand(); return true; case RDS_COMPOSER: strValue = tag->GetComposer(); return true; case RDS_CONDUCTOR: strValue = tag->GetConductor(); return true; case RDS_ALBUM: strValue = tag->GetAlbum(); return true; case RDS_ALBUM_TRACKNUMBER: if (tag->GetAlbumTrackNumber() > 0) { strValue = StringUtils::Format("%i", tag->GetAlbumTrackNumber()); return true; } break; case RDS_GET_RADIO_STYLE: strValue = tag->GetRadioStyle(); return true; case RDS_COMMENT: strValue = tag->GetComment(); return true; case RDS_INFO_NEWS: strValue = tag->GetInfoNews(); return true; case RDS_INFO_NEWS_LOCAL: strValue = tag->GetInfoNewsLocal(); return true; case RDS_INFO_STOCK: strValue = tag->GetInfoStock(); return true; case RDS_INFO_STOCK_SIZE: strValue = StringUtils::Format("%i", static_cast<int>(tag->GetInfoStock().size())); return true; case RDS_INFO_SPORT: strValue = tag->GetInfoSport(); return true; case RDS_INFO_SPORT_SIZE: strValue = StringUtils::Format("%i", static_cast<int>(tag->GetInfoSport().size())); return true; case RDS_INFO_LOTTERY: strValue = tag->GetInfoLottery(); return true; case RDS_INFO_LOTTERY_SIZE: strValue = StringUtils::Format("%i", static_cast<int>(tag->GetInfoLottery().size())); return true; case RDS_INFO_WEATHER: strValue = tag->GetInfoWeather(); return true; case RDS_INFO_WEATHER_SIZE: strValue = StringUtils::Format("%i", static_cast<int>(tag->GetInfoWeather().size())); return true; case RDS_INFO_HOROSCOPE: strValue = tag->GetInfoHoroscope(); return true; case RDS_INFO_HOROSCOPE_SIZE: strValue = StringUtils::Format("%i", static_cast<int>(tag->GetInfoHoroscope().size())); return true; case RDS_INFO_CINEMA: strValue = tag->GetInfoCinema(); return true; case RDS_INFO_CINEMA_SIZE: strValue = StringUtils::Format("%i", static_cast<int>(tag->GetInfoCinema().size())); return true; case RDS_INFO_OTHER: strValue = tag->GetInfoOther(); return true; case RDS_INFO_OTHER_SIZE: strValue = StringUtils::Format("%i", static_cast<int>(tag->GetInfoOther().size())); return true; case RDS_PROG_HOST: strValue = tag->GetProgHost(); return true; case RDS_PROG_EDIT_STAFF: strValue = tag->GetEditorialStaff(); return true; case RDS_PROG_HOMEPAGE: strValue = tag->GetProgWebsite(); return true; case RDS_PROG_STYLE: strValue = tag->GetProgStyle(); return true; case RDS_PHONE_HOTLINE: strValue = tag->GetPhoneHotline(); return true; case RDS_PHONE_STUDIO: strValue = tag->GetPhoneStudio(); return true; case RDS_SMS_STUDIO: strValue = tag->GetSMSStudio(); return true; case RDS_EMAIL_HOTLINE: strValue = tag->GetEMailHotline(); return true; case RDS_EMAIL_STUDIO: strValue = tag->GetEMailStudio(); return true; case RDS_PROG_STATION: strValue = tag->GetProgStation(); return true; case RDS_PROG_NOW: strValue = tag->GetProgNow(); return true; case RDS_PROG_NEXT: strValue = tag->GetProgNext(); return true; case RDS_AUDIO_LANG: strValue = tag->GetLanguage(); return true; } } switch (info.m_info) { case RDS_GET_RADIOTEXT_LINE: strValue = g_application.GetAppPlayer().GetRadioText(info.GetData1()); return true; } return false; }
bool CPVRGUIInfo::GetPVRLabel(const CFileItem *item, const CGUIInfo &info, std::string &strValue) const { CSingleLock lock(m_critSection); switch (info.m_info) { case PVR_EPG_EVENT_ICON: { const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr; if (epgTag) { strValue = epgTag->Icon(); } return true; } case PVR_EPG_EVENT_DURATION: { const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr; strValue = m_timesInfo.GetEpgEventDuration(epgTag, static_cast<TIME_FORMAT>(info.GetData1())); return true; } case PVR_EPG_EVENT_ELAPSED_TIME: { const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr; strValue = m_timesInfo.GetEpgEventElapsedTime(epgTag, static_cast<TIME_FORMAT>(info.GetData1())); return true; } case PVR_EPG_EVENT_REMAINING_TIME: { const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr; strValue = m_timesInfo.GetEpgEventRemainingTime(epgTag, static_cast<TIME_FORMAT>(info.GetData1())); return true; } case PVR_EPG_EVENT_FINISH_TIME: { const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr; strValue = m_timesInfo.GetEpgEventFinishTime(epgTag, static_cast<TIME_FORMAT>(info.GetData1())); return true; } case PVR_TIMESHIFT_START_TIME: strValue = m_timesInfo.GetTimeshiftStartTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PVR_TIMESHIFT_END_TIME: strValue = m_timesInfo.GetTimeshiftEndTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PVR_TIMESHIFT_PLAY_TIME: strValue = m_timesInfo.GetTimeshiftPlayTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PVR_TIMESHIFT_OFFSET: strValue = m_timesInfo.GetTimeshiftOffset(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PVR_TIMESHIFT_PROGRESS_DURATION: strValue = m_timesInfo.GetTimeshiftProgressDuration(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PVR_TIMESHIFT_PROGRESS_START_TIME: strValue = m_timesInfo.GetTimeshiftProgressStartTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PVR_TIMESHIFT_PROGRESS_END_TIME: strValue = m_timesInfo.GetTimeshiftProgressEndTime(static_cast<TIME_FORMAT>(info.GetData1())); return true; case PVR_EPG_EVENT_SEEK_TIME: strValue = m_timesInfo.GetEpgEventSeekTime(g_application.GetAppPlayer().GetSeekHandler().GetSeekSize(), static_cast<TIME_FORMAT>(info.GetData1())); return true; case PVR_NOW_RECORDING_TITLE: strValue = m_anyTimersInfo.GetActiveTimerTitle(); return true; case PVR_NOW_RECORDING_CHANNEL: strValue = m_anyTimersInfo.GetActiveTimerChannelName(); return true; case PVR_NOW_RECORDING_CHAN_ICO: strValue = m_anyTimersInfo.GetActiveTimerChannelIcon(); return true; case PVR_NOW_RECORDING_DATETIME: strValue = m_anyTimersInfo.GetActiveTimerDateTime(); return true; case PVR_NEXT_RECORDING_TITLE: strValue = m_anyTimersInfo.GetNextTimerTitle(); return true; case PVR_NEXT_RECORDING_CHANNEL: strValue = m_anyTimersInfo.GetNextTimerChannelName(); return true; case PVR_NEXT_RECORDING_CHAN_ICO: strValue = m_anyTimersInfo.GetNextTimerChannelIcon(); return true; case PVR_NEXT_RECORDING_DATETIME: strValue = m_anyTimersInfo.GetNextTimerDateTime(); return true; case PVR_TV_NOW_RECORDING_TITLE: strValue = m_tvTimersInfo.GetActiveTimerTitle(); return true; case PVR_TV_NOW_RECORDING_CHANNEL: strValue = m_tvTimersInfo.GetActiveTimerChannelName(); return true; case PVR_TV_NOW_RECORDING_CHAN_ICO: strValue = m_tvTimersInfo.GetActiveTimerChannelIcon(); return true; case PVR_TV_NOW_RECORDING_DATETIME: strValue = m_tvTimersInfo.GetActiveTimerDateTime(); return true; case PVR_TV_NEXT_RECORDING_TITLE: strValue = m_tvTimersInfo.GetNextTimerTitle(); return true; case PVR_TV_NEXT_RECORDING_CHANNEL: strValue = m_tvTimersInfo.GetNextTimerChannelName(); return true; case PVR_TV_NEXT_RECORDING_CHAN_ICO: strValue = m_tvTimersInfo.GetNextTimerChannelIcon(); return true; case PVR_TV_NEXT_RECORDING_DATETIME: strValue = m_tvTimersInfo.GetNextTimerDateTime(); return true; case PVR_RADIO_NOW_RECORDING_TITLE: strValue = m_radioTimersInfo.GetActiveTimerTitle(); return true; case PVR_RADIO_NOW_RECORDING_CHANNEL: strValue = m_radioTimersInfo.GetActiveTimerChannelName(); return true; case PVR_RADIO_NOW_RECORDING_CHAN_ICO: strValue = m_radioTimersInfo.GetActiveTimerChannelIcon(); return true; case PVR_RADIO_NOW_RECORDING_DATETIME: strValue = m_radioTimersInfo.GetActiveTimerDateTime(); return true; case PVR_RADIO_NEXT_RECORDING_TITLE: strValue = m_radioTimersInfo.GetNextTimerTitle(); return true; case PVR_RADIO_NEXT_RECORDING_CHANNEL: strValue = m_radioTimersInfo.GetNextTimerChannelName(); return true; case PVR_RADIO_NEXT_RECORDING_CHAN_ICO: strValue = m_radioTimersInfo.GetNextTimerChannelIcon(); return true; case PVR_RADIO_NEXT_RECORDING_DATETIME: strValue = m_radioTimersInfo.GetNextTimerDateTime(); return true; case PVR_NEXT_TIMER: strValue = m_anyTimersInfo.GetNextTimer(); return true; case PVR_ACTUAL_STREAM_SIG: CharInfoSignal(strValue); return true; case PVR_ACTUAL_STREAM_SNR: CharInfoSNR(strValue); return true; case PVR_ACTUAL_STREAM_BER: CharInfoBER(strValue); return true; case PVR_ACTUAL_STREAM_UNC: CharInfoUNC(strValue); return true; case PVR_ACTUAL_STREAM_CLIENT: CharInfoPlayingClientName(strValue); return true; case PVR_ACTUAL_STREAM_DEVICE: CharInfoFrontendName(strValue); return true; case PVR_ACTUAL_STREAM_STATUS: CharInfoFrontendStatus(strValue); return true; case PVR_ACTUAL_STREAM_CRYPTION: CharInfoEncryption(strValue); return true; case PVR_ACTUAL_STREAM_SERVICE: CharInfoService(strValue); return true; case PVR_ACTUAL_STREAM_MUX: CharInfoMux(strValue); return true; case PVR_ACTUAL_STREAM_PROVIDER: CharInfoProvider(strValue); return true; case PVR_BACKEND_NAME: CharInfoBackendName(strValue); return true; case PVR_BACKEND_VERSION: CharInfoBackendVersion(strValue); return true; case PVR_BACKEND_HOST: CharInfoBackendHost(strValue); return true; case PVR_BACKEND_DISKSPACE: CharInfoBackendDiskspace(strValue); return true; case PVR_BACKEND_CHANNELS: CharInfoBackendChannels(strValue); return true; case PVR_BACKEND_TIMERS: CharInfoBackendTimers(strValue); return true; case PVR_BACKEND_RECORDINGS: CharInfoBackendRecordings(strValue); return true; case PVR_BACKEND_DELETED_RECORDINGS: CharInfoBackendDeletedRecordings(strValue); return true; case PVR_BACKEND_NUMBER: CharInfoBackendNumber(strValue); return true; case PVR_TOTAL_DISKSPACE: CharInfoTotalDiskSpace(strValue); return true; case PVR_CHANNEL_NUMBER_INPUT: strValue = CServiceBroker::GetPVRManager().GUIActions()->GetChannelNumberInputHandler().GetChannelNumberLabel(); return true; } return false; }
bool CPVRGUIInfo::GetListItemAndPlayerLabel(const CFileItem *item, const CGUIInfo &info, std::string &strValue) const { const CPVRTimerInfoTagPtr timer = item->GetPVRTimerInfoTag(); if (timer) { switch (info.m_info) { case LISTITEM_DATE: strValue = timer->Summary(); return true; case LISTITEM_STARTDATE: strValue = timer->StartAsLocalTime().GetAsLocalizedDate(true); return true; case LISTITEM_STARTTIME: strValue = timer->StartAsLocalTime().GetAsLocalizedTime("", false); return true; case LISTITEM_ENDDATE: strValue = timer->EndAsLocalTime().GetAsLocalizedDate(true); return true; case LISTITEM_ENDTIME: strValue = timer->EndAsLocalTime().GetAsLocalizedTime("", false); return true; case LISTITEM_TITLE: strValue = timer->Title(); return true; case LISTITEM_COMMENT: strValue = timer->GetStatus(); return true; case LISTITEM_TIMERTYPE: strValue = timer->GetTypeAsString(); return true; case LISTITEM_CHANNEL_NAME: strValue = timer->ChannelName(); return true; case LISTITEM_EPG_EVENT_TITLE: case LISTITEM_EPG_EVENT_ICON: case LISTITEM_GENRE: case LISTITEM_PLOT: case LISTITEM_PLOT_OUTLINE: case LISTITEM_DURATION: case LISTITEM_ORIGINALTITLE: case LISTITEM_YEAR: case LISTITEM_SEASON: case LISTITEM_EPISODE: case LISTITEM_EPISODENAME: case LISTITEM_DIRECTOR: case LISTITEM_CHANNEL_NUMBER: case LISTITEM_PREMIERED: break; // obtain value from channel/epg default: return false; } } const CPVRRecordingPtr recording(item->GetPVRRecordingInfoTag()); if (recording) { // Note: CPVRRecoding is derived from CVideoInfoTag. All base class properties will be handled // by CVideoGUIInfoProvider. Only properties introduced by CPVRRecording need to be handled here. switch (info.m_info) { case LISTITEM_DATE: strValue = recording->RecordingTimeAsLocalTime().GetAsLocalizedDateTime(false, false); return true; case LISTITEM_STARTDATE: strValue = recording->RecordingTimeAsLocalTime().GetAsLocalizedDate(true); return true; case VIDEOPLAYER_STARTTIME: case LISTITEM_STARTTIME: strValue = recording->RecordingTimeAsLocalTime().GetAsLocalizedTime("", false); return true; case LISTITEM_ENDDATE: strValue = recording->EndTimeAsLocalTime().GetAsLocalizedDate(true); return true; case VIDEOPLAYER_ENDTIME: case LISTITEM_ENDTIME: strValue = recording->EndTimeAsLocalTime().GetAsLocalizedTime("", false); return true; case LISTITEM_EXPIRATION_DATE: if (recording->HasExpirationTime()) { strValue = recording->ExpirationTimeAsLocalTime().GetAsLocalizedDate(false); return true; } break; case LISTITEM_EXPIRATION_TIME: if (recording->HasExpirationTime()) { strValue = recording->ExpirationTimeAsLocalTime().GetAsLocalizedTime("", false);; return true; } break; case VIDEOPLAYER_EPISODENAME: case LISTITEM_EPISODENAME: strValue = recording->EpisodeName(); return true; case VIDEOPLAYER_CHANNEL_NAME: case LISTITEM_CHANNEL_NAME: strValue = recording->m_strChannelName; return true; case VIDEOPLAYER_CHANNEL_NUMBER: case LISTITEM_CHANNEL_NUMBER: { const CPVRChannelPtr channel = recording->Channel(); if (channel) { strValue = channel->ChannelNumber().FormattedChannelNumber(); return true; } break; } case VIDEOPLAYER_CHANNEL_GROUP: { CSingleLock lock(m_critSection); strValue = recording->IsRadio() ? m_strPlayingRadioGroup : m_strPlayingTVGroup; return true; } } return false; } CPVREpgInfoTagPtr epgTag; CPVRChannelPtr channel; if (item->IsPVRChannel() || item->IsEPG() || item->IsPVRTimer()) { CPVRItem pvrItem(item); channel = pvrItem.GetChannel(); switch (info.m_info) { case VIDEOPLAYER_NEXT_TITLE: case VIDEOPLAYER_NEXT_GENRE: case VIDEOPLAYER_NEXT_PLOT: case VIDEOPLAYER_NEXT_PLOT_OUTLINE: case VIDEOPLAYER_NEXT_STARTTIME: case VIDEOPLAYER_NEXT_ENDTIME: case VIDEOPLAYER_NEXT_DURATION: case LISTITEM_NEXT_TITLE: case LISTITEM_NEXT_GENRE: case LISTITEM_NEXT_PLOT: case LISTITEM_NEXT_PLOT_OUTLINE: case LISTITEM_NEXT_STARTDATE: case LISTITEM_NEXT_STARTTIME: case LISTITEM_NEXT_ENDDATE: case LISTITEM_NEXT_ENDTIME: case LISTITEM_NEXT_DURATION: // next playing event epgTag = pvrItem.GetNextEpgInfoTag(); break; default: // now playing event epgTag = pvrItem.GetEpgInfoTag(); break; } switch (info.m_info) { // special handling for channels without epg or with radio rds data case PLAYER_TITLE: case VIDEOPLAYER_TITLE: case LISTITEM_TITLE: case VIDEOPLAYER_NEXT_TITLE: case LISTITEM_NEXT_TITLE: case LISTITEM_EPG_EVENT_TITLE: // Note: in difference to LISTITEM_TITLE, LISTITEM_EPG_EVENT_TITLE returns the title // associated with the epg event of a timer, if any, and not the title of the timer. if (epgTag) strValue = epgTag->Title(); if (strValue.empty() && !CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE)) strValue = g_localizeStrings.Get(19055); // no information available return true; } } if (epgTag) { switch (info.m_info) { case VIDEOPLAYER_GENRE: case LISTITEM_GENRE: case VIDEOPLAYER_NEXT_GENRE: case LISTITEM_NEXT_GENRE: strValue = epgTag->GetGenresLabel(); return true; case VIDEOPLAYER_PLOT: case LISTITEM_PLOT: case VIDEOPLAYER_NEXT_PLOT: case LISTITEM_NEXT_PLOT: strValue = epgTag->Plot(); return true; case VIDEOPLAYER_PLOT_OUTLINE: case LISTITEM_PLOT_OUTLINE: case VIDEOPLAYER_NEXT_PLOT_OUTLINE: case LISTITEM_NEXT_PLOT_OUTLINE: strValue = epgTag->PlotOutline(); return true; case LISTITEM_DATE: strValue = epgTag->StartAsLocalTime().GetAsLocalizedDateTime(false, false); return true; case LISTITEM_STARTDATE: case LISTITEM_NEXT_STARTDATE: strValue = epgTag->StartAsLocalTime().GetAsLocalizedDate(true); return true; case VIDEOPLAYER_STARTTIME: case VIDEOPLAYER_NEXT_STARTTIME: case LISTITEM_STARTTIME: case LISTITEM_NEXT_STARTTIME: strValue = epgTag->StartAsLocalTime().GetAsLocalizedTime("", false); return true; case LISTITEM_ENDDATE: case LISTITEM_NEXT_ENDDATE: strValue = epgTag->EndAsLocalTime().GetAsLocalizedDate(true); return true; case VIDEOPLAYER_ENDTIME: case VIDEOPLAYER_NEXT_ENDTIME: case LISTITEM_ENDTIME: case LISTITEM_NEXT_ENDTIME: strValue = epgTag->EndAsLocalTime().GetAsLocalizedTime("", false); return true; // note: for some reason, there is no VIDEOPLAYER_DURATION case LISTITEM_DURATION: case VIDEOPLAYER_NEXT_DURATION: case LISTITEM_NEXT_DURATION: if (epgTag->GetDuration() > 0) { strValue = StringUtils::SecondsToTimeString(epgTag->GetDuration(), static_cast<TIME_FORMAT>(info.GetData4())); return true; } return false; case VIDEOPLAYER_IMDBNUMBER: case LISTITEM_IMDBNUMBER: strValue = epgTag->IMDBNumber(); return true; case VIDEOPLAYER_ORIGINALTITLE: case LISTITEM_ORIGINALTITLE: strValue = epgTag->OriginalTitle(); return true; case VIDEOPLAYER_YEAR: case LISTITEM_YEAR: if (epgTag->Year() > 0) { strValue = StringUtils::Format("%i", epgTag->Year()); return true; } return false; case VIDEOPLAYER_SEASON: case LISTITEM_SEASON: if (epgTag->SeriesNumber() > 0) { strValue = StringUtils::Format("%i", epgTag->SeriesNumber()); return true; } return false; case VIDEOPLAYER_EPISODE: case LISTITEM_EPISODE: if (epgTag->EpisodeNumber() > 0) { if (epgTag->SeriesNumber() == 0) // prefix episode with 'S' strValue = StringUtils::Format("S%i", epgTag->EpisodeNumber()); else strValue = StringUtils::Format("%i", epgTag->EpisodeNumber()); return true; } return false; case VIDEOPLAYER_EPISODENAME: case LISTITEM_EPISODENAME: strValue = epgTag->EpisodeName(); return true; case VIDEOPLAYER_CAST: case LISTITEM_CAST: strValue = epgTag->GetCastLabel(); return true; case VIDEOPLAYER_DIRECTOR: case LISTITEM_DIRECTOR: strValue = epgTag->GetDirectorsLabel(); return true; case VIDEOPLAYER_WRITER: case LISTITEM_WRITER: strValue = epgTag->GetWritersLabel(); return true; case LISTITEM_EPG_EVENT_ICON: strValue = epgTag->Icon(); return true; case VIDEOPLAYER_PARENTAL_RATING: case LISTITEM_PARENTALRATING: if (epgTag->ParentalRating() > 0) { strValue = StringUtils::Format("%i", epgTag->ParentalRating()); return true; } return false; case LISTITEM_PREMIERED: if (epgTag->FirstAiredAsLocalTime().IsValid()) { strValue = epgTag->FirstAiredAsLocalTime().GetAsLocalizedDate(true); return true; } return false; } } if (channel) { switch (info.m_info) { case MUSICPLAYER_CHANNEL_NAME: { const std::shared_ptr<CPVRRadioRDSInfoTag> rdsTag = channel->GetRadioRDSInfoTag(); if (rdsTag) { strValue = rdsTag->GetProgStation(); if (!strValue.empty()) return true; } // fall-thru is intended } case VIDEOPLAYER_CHANNEL_NAME: case LISTITEM_CHANNEL_NAME: strValue = channel->ChannelName(); return true; case MUSICPLAYER_CHANNEL_NUMBER: case VIDEOPLAYER_CHANNEL_NUMBER: case LISTITEM_CHANNEL_NUMBER: strValue = channel->ChannelNumber().FormattedChannelNumber(); return true; case MUSICPLAYER_CHANNEL_GROUP: case VIDEOPLAYER_CHANNEL_GROUP: { CSingleLock lock(m_critSection); strValue = channel->IsRadio() ? m_strPlayingRadioGroup : m_strPlayingTVGroup; return true; } } } return false; }
bool CPVRGUIInfo::GetListItemAndPlayerBool(const CFileItem *item, const CGUIInfo &info, bool &bValue) const { switch (info.m_info) { case LISTITEM_ISRECORDING: if (item->IsPVRChannel()) { bValue = item->GetPVRChannelInfoTag()->IsRecording(); return true; } else if (item->IsEPG() || item->IsPVRTimer()) { const CPVRTimerInfoTagPtr timer = CPVRItem(item).GetTimerInfoTag(); if (timer) bValue = timer->IsRecording(); return true; } else if (item->IsPVRRecording()) { bValue = item->GetPVRRecordingInfoTag()->IsInProgress(); return true; } break; case LISTITEM_INPROGRESS: if (item->IsPVRChannel() || item->IsEPG()) { const CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag(); if (epgTag) bValue = epgTag->IsActive(); return true; } break; case LISTITEM_HASTIMER: if (item->IsPVRChannel() || item->IsEPG()) { const CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag(); if (epgTag) bValue = epgTag->HasTimer(); return true; } break; case LISTITEM_HASTIMERSCHEDULE: if (item->IsPVRChannel() || item->IsEPG() || item->IsPVRTimer()) { const CPVRTimerInfoTagPtr timer = CPVRItem(item).GetTimerInfoTag(); if (timer) bValue = timer->GetTimerRuleId() != PVR_TIMER_NO_PARENT; return true; } break; case LISTITEM_TIMERISACTIVE: if (item->IsPVRChannel() || item->IsEPG()) { const CPVRTimerInfoTagPtr timer = CPVRItem(item).GetTimerInfoTag(); if (timer) bValue = timer->IsActive(); break; } break; case LISTITEM_TIMERHASCONFLICT: if (item->IsPVRChannel() || item->IsEPG()) { const CPVRTimerInfoTagPtr timer = CPVRItem(item).GetTimerInfoTag(); if (timer) bValue = timer->HasConflict(); return true; } break; case LISTITEM_TIMERHASERROR: if (item->IsPVRChannel() || item->IsEPG()) { const CPVRTimerInfoTagPtr timer = CPVRItem(item).GetTimerInfoTag(); if (timer) bValue = (timer->IsBroken() && !timer->HasConflict()); return true; } break; case LISTITEM_HASRECORDING: if (item->IsPVRChannel() || item->IsEPG()) { const CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag(); if (epgTag) bValue = epgTag->HasRecording(); return true; } break; case LISTITEM_HAS_EPG: if (item->IsPVRChannel() || item->IsEPG() || item->IsPVRTimer()) { const CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag(); bValue = (epgTag != nullptr); return true; } break; case LISTITEM_ISENCRYPTED: if (item->IsPVRChannel() || item->IsEPG()) { const CPVRChannelPtr channel = CPVRItem(item).GetChannel(); if (channel) bValue = channel->IsEncrypted(); return true; } break; case MUSICPLAYER_CONTENT: case VIDEOPLAYER_CONTENT: if (item->IsPVRChannel()) { bValue = StringUtils::EqualsNoCase(info.GetData3(), "livetv"); return bValue; // if no match for this provider, other providers shall be asked. } break; case VIDEOPLAYER_HAS_INFO: if (item->IsPVRChannel()) { bValue = !item->GetPVRChannelInfoTag()->IsEmpty(); return true; } break; case VIDEOPLAYER_HAS_EPG: if (item->IsPVRChannel()) { bValue = (item->GetPVRChannelInfoTag()->GetEPGNow() != nullptr); return true; } break; case VIDEOPLAYER_CAN_RESUME_LIVE_TV: if (item->IsPVRRecording()) { const CPVRRecordingPtr recording = item->GetPVRRecordingInfoTag(); const CPVREpgInfoTagPtr epgTag = CServiceBroker::GetPVRManager().EpgContainer().GetTagById(recording->Channel(), recording->BroadcastUid()); bValue = (epgTag && epgTag->IsActive() && epgTag->Channel()); return true; } break; case PLAYER_IS_CHANNEL_PREVIEW_ACTIVE: if (item->IsPVRChannel()) { if (CServiceBroker::GetPVRManager().GUIActions()->GetChannelNavigator().IsPreviewAndShowInfo()) { bValue = true; } else { bValue = !m_videoInfo.valid; if (bValue && item->GetPVRChannelInfoTag()->IsRadio()) bValue = !m_audioInfo.valid; } return true; } break; } return false; }
bool CMusicGUIInfo::GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const { if (info.GetData1() && info.m_info >= MUSICPLAYER_TITLE && info.m_info <= MUSICPLAYER_ALBUM_ARTIST) return GetPlaylistInfo(value, info); const CMusicInfoTag* tag = item->GetMusicInfoTag(); if (tag) { switch (info.m_info) { ///////////////////////////////////////////////////////////////////////////////////////////// // PLAYER_* / MUSICPLAYER_* / LISTITEM_* ///////////////////////////////////////////////////////////////////////////////////////////// case PLAYER_PATH: case PLAYER_FILENAME: case PLAYER_FILEPATH: value = tag->GetURL(); if (value.empty()) value = item->GetPath(); value = GUIINFO::GetFileInfoLabelValueFromPath(info.m_info, value); return true; case PLAYER_TITLE: value = tag->GetTitle(); return !value.empty(); case MUSICPLAYER_TITLE: value = tag->GetTitle(); if (value.empty()) value = item->GetLabel(); if (value.empty()) value = CUtil::GetTitleFromPath(item->GetPath()); return true; case LISTITEM_TITLE: value = tag->GetTitle(); return true; case MUSICPLAYER_PLAYCOUNT: case LISTITEM_PLAYCOUNT: if (tag->GetPlayCount() > 0) { value = StringUtils::Format("%i", tag->GetPlayCount()); return true; } break; case MUSICPLAYER_LASTPLAYED: case LISTITEM_LASTPLAYED: { const CDateTime dateTime = tag->GetLastPlayed(); if (dateTime.IsValid()) { value = dateTime.GetAsLocalizedDate(); return true; } break; } case MUSICPLAYER_TRACK_NUMBER: case LISTITEM_TRACKNUMBER: if (tag->Loaded() && tag->GetTrackNumber() > 0) { value = StringUtils::Format("%02i", tag->GetTrackNumber()); return true; } break; case MUSICPLAYER_DISC_NUMBER: case LISTITEM_DISC_NUMBER: if (tag->GetDiscNumber() > 0) { value = StringUtils::Format("%i", tag->GetDiscNumber()); return true; } break; case MUSICPLAYER_ARTIST: case LISTITEM_ARTIST: value = tag->GetArtistString(); return true; case MUSICPLAYER_ALBUM_ARTIST: case LISTITEM_ALBUM_ARTIST: value = tag->GetAlbumArtistString(); return true; case MUSICPLAYER_CONTRIBUTORS: case LISTITEM_CONTRIBUTORS: if (tag->HasContributors()) { value = tag->GetContributorsText(); return true; } break; case MUSICPLAYER_CONTRIBUTOR_AND_ROLE: case LISTITEM_CONTRIBUTOR_AND_ROLE: if (tag->HasContributors()) { value = tag->GetContributorsAndRolesText(); return true; } break; case MUSICPLAYER_ALBUM: case LISTITEM_ALBUM: value = tag->GetAlbum(); return true; case MUSICPLAYER_YEAR: case LISTITEM_YEAR: value = tag->GetYearString(); return true; case MUSICPLAYER_GENRE: case LISTITEM_GENRE: value = StringUtils::Join(tag->GetGenre(), CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_musicItemSeparator); return true; case MUSICPLAYER_LYRICS: value = tag->GetLyrics(); return true; case MUSICPLAYER_RATING: case LISTITEM_RATING: { float rating = tag->GetRating(); if (rating > 0.f) { value = StringUtils::FormatNumber(rating); return true; } break; } case MUSICPLAYER_RATING_AND_VOTES: case LISTITEM_RATING_AND_VOTES: { float rating = tag->GetRating(); if (rating > 0.f) { int votes = tag->GetVotes(); if (votes <= 0) value = StringUtils::FormatNumber(rating); else value = StringUtils::Format(g_localizeStrings.Get(20350).c_str(), StringUtils::FormatNumber(rating).c_str(), StringUtils::FormatNumber(votes).c_str()); return true; } break; } case MUSICPLAYER_USER_RATING: case LISTITEM_USER_RATING: if (tag->GetUserrating() > 0) { value = StringUtils::Format("%i", tag->GetUserrating()); return true; } break; case MUSICPLAYER_COMMENT: case LISTITEM_COMMENT: value = tag->GetComment(); return true; case MUSICPLAYER_MOOD: case LISTITEM_MOOD: value = tag->GetMood(); return true; case LISTITEM_DBTYPE: value = tag->GetType(); return true; case MUSICPLAYER_DBID: case LISTITEM_DBID: { int dbId = tag->GetDatabaseId(); if (dbId > -1) { value = StringUtils::Format("%i", dbId); return true; } break; } case PLAYER_DURATION: if (!g_application.GetAppPlayer().IsPlayingAudio()) break; // fall-thru is intended. case MUSICPLAYER_DURATION: case LISTITEM_DURATION: { int iDuration = tag->GetDuration(); if (iDuration > 0) { value = StringUtils::SecondsToTimeString(iDuration, static_cast<TIME_FORMAT>(info.GetData4())); return true; } break; } ///////////////////////////////////////////////////////////////////////////////////////////// // LISTITEM_* ///////////////////////////////////////////////////////////////////////////////////////////// case LISTITEM_PROPERTY: if (StringUtils::StartsWithNoCase(info.GetData3(), "Role.")) { // "Role.xxxx" properties are held in music tag std::string property = info.GetData3(); property.erase(0, 5); //Remove Role. value = tag->GetArtistStringForRole(property); return true; } break; case LISTITEM_VOTES: value = StringUtils::FormatNumber(tag->GetVotes()); return true; case LISTITEM_FILENAME: case LISTITEM_FILE_EXTENSION: if (item->IsMusicDb()) value = URIUtils::GetFileName(tag->GetURL()); else if (item->HasVideoInfoTag()) // special handling for music videos, which have both a videotag and a musictag break; else value = URIUtils::GetFileName(item->GetPath()); if (info.m_info == LISTITEM_FILE_EXTENSION) { std::string strExtension = URIUtils::GetExtension(value); value = StringUtils::TrimLeft(strExtension, "."); } return true; case LISTITEM_FOLDERNAME: case LISTITEM_PATH: if (item->IsMusicDb()) value = URIUtils::GetDirectory(tag->GetURL()); else if (item->HasVideoInfoTag()) // special handling for music videos, which have both a videotag and a musictag break; else URIUtils::GetParentPath(item->GetPath(), value); value = CURL(value).GetWithoutUserDetails(); if (info.m_info == LISTITEM_FOLDERNAME) { URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILENAME_AND_PATH: if (item->IsMusicDb()) value = tag->GetURL(); else if (item->HasVideoInfoTag()) // special handling for music videos, which have both a videotag and a musictag break; else value = item->GetPath(); value = CURL(value).GetWithoutUserDetails(); return true; } } switch (info.m_info) { /////////////////////////////////////////////////////////////////////////////////////////////// // MUSICPLAYER_* /////////////////////////////////////////////////////////////////////////////////////////////// case MUSICPLAYER_PROPERTY: value = item->GetProperty(info.GetData3()).asString(); return true; case MUSICPLAYER_PLAYLISTLEN: if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() == PLAYLIST_MUSIC) { value = GUIINFO::GetPlaylistLabel(PLAYLIST_LENGTH); return true; } break; case MUSICPLAYER_PLAYLISTPOS: if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() == PLAYLIST_MUSIC) { value = GUIINFO::GetPlaylistLabel(PLAYLIST_POSITION); return true; } break; case MUSICPLAYER_COVER: if (g_application.GetAppPlayer().IsPlayingAudio()) { if (fallback) *fallback = "DefaultAlbumCover.png"; value = item->HasArt("thumb") ? item->GetArt("thumb") : "DefaultAlbumCover.png"; return true; } break; case MUSICPLAYER_BITRATE: { int iBitrate = m_audioInfo.bitrate; if (iBitrate > 0) { value = StringUtils::Format("%li", std::lrint(static_cast<double>(iBitrate) / 1000.0)); return true; } break; } case MUSICPLAYER_CHANNELS: { int iChannels = m_audioInfo.channels; if (iChannels > 0) { value = StringUtils::Format("%i", iChannels); return true; } break; } case MUSICPLAYER_BITSPERSAMPLE: { int iBPS = m_audioInfo.bitspersample; if (iBPS > 0) { value = StringUtils::Format("%i", iBPS); return true; } break; } case MUSICPLAYER_SAMPLERATE: { int iSamplerate = m_audioInfo.samplerate; if (iSamplerate > 0) { value = StringUtils::Format("%.5g", static_cast<double>(iSamplerate) / 1000.0); return true; } break; } case MUSICPLAYER_CODEC: value = StringUtils::Format("%s", m_audioInfo.codecName.c_str()); return true; } /////////////////////////////////////////////////////////////////////////////////////////////// // MUSICPM_* /////////////////////////////////////////////////////////////////////////////////////////////// if (GetPartyModeLabel(value, info)) return true; return false; }