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