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 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 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 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; }