Beispiel #1
0
bool CGUIWindowFullScreen::OnAction(const CAction &action)
{
    if (g_application.m_pPlayer != NULL && g_application.m_pPlayer->OnAction(action))
        return true;

    if (m_timeCodePosition > 0 && action.GetButtonCode())
    {   // check whether we have a mapping in our virtual videotimeseek "window" and have a select action
        CKey key(action.GetButtonCode());
        CAction timeSeek = CButtonTranslator::GetInstance().GetAction(WINDOW_VIDEO_TIME_SEEK, key, false);
        if (timeSeek.GetID() == ACTION_SELECT_ITEM)
        {
            SeekToTimeCodeStamp(SEEK_ABSOLUTE);
            return true;
        }
    }

    const unsigned int MsgTime = 300;
    const unsigned int DisplTime = 2000;

    switch (action.GetID())
    {
    case ACTION_SHOW_OSD:
        ToggleOSD();
        return true;

    case ACTION_SHOW_GUI:
    {
        // switch back to the menu
        OutputDebugString("Switching to GUI\n");
        g_windowManager.PreviousWindow();
        OutputDebugString("Now in GUI\n");
        return true;
    }
    break;

    case ACTION_PLAYER_PLAY:
    case ACTION_PAUSE:
        if (m_timeCodePosition > 0)
        {
            SeekToTimeCodeStamp(SEEK_ABSOLUTE);
            return true;
        }
        break;

    case ACTION_STEP_BACK:
        if (!g_application.CurrentFileItem().HasPVRChannelInfoTag())
        {
            if (m_timeCodePosition > 0)
                SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
            else
                g_application.m_pPlayer->Seek(false, false);
        }
        else
            SeekTV(false, false);
        return true;

    case ACTION_STEP_FORWARD:
        if (!g_application.CurrentFileItem().HasPVRChannelInfoTag())
        {
            if (m_timeCodePosition > 0)
                SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD);
            else
                g_application.m_pPlayer->Seek(true, false);
        }
        else
            SeekTV(true, false);
        return true;

    case ACTION_BIG_STEP_BACK:
        if (!g_application.CurrentFileItem().HasPVRChannelInfoTag())
        {
            if (m_timeCodePosition > 0)
                SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
            else
                g_application.m_pPlayer->Seek(false, true);
        }
        else
            SeekTV(false, true);
        return true;

    case ACTION_BIG_STEP_FORWARD:
        if (!g_application.CurrentFileItem().HasPVRChannelInfoTag())
        {
            if (m_timeCodePosition > 0)
                SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD);
            else
                g_application.m_pPlayer->Seek(true, true);
        }
        else
            SeekTV(true, true);
        return true;

    case ACTION_NEXT_SCENE:
        if (g_application.m_pPlayer->SeekScene(true))
            g_infoManager.SetDisplayAfterSeek();
        return true;
        break;

    case ACTION_PREV_SCENE:
        if (g_application.m_pPlayer->SeekScene(false))
            g_infoManager.SetDisplayAfterSeek();
        return true;
        break;

    case ACTION_SHOW_OSD_TIME:
        m_bShowCurrentTime = !m_bShowCurrentTime;
        if(!m_bShowCurrentTime)
            g_infoManager.SetDisplayAfterSeek(0); //Force display off
        g_infoManager.SetShowTime(m_bShowCurrentTime);
        return true;
        break;

    case ACTION_SHOW_SUBTITLES:
    {
        if (g_application.m_pPlayer->GetSubtitleCount() == 0)
            return true;

        g_settings.m_currentVideoSettings.m_SubtitleOn = !g_settings.m_currentVideoSettings.m_SubtitleOn;
        g_application.m_pPlayer->SetSubtitleVisible(g_settings.m_currentVideoSettings.m_SubtitleOn);
        CStdString sub, lang;
        if (g_settings.m_currentVideoSettings.m_SubtitleOn)
        {
            g_application.m_pPlayer->GetSubtitleName(g_application.m_pPlayer->GetSubtitle(),sub);
            g_application.m_pPlayer->GetSubtitleLanguage(g_application.m_pPlayer->GetSubtitle(),lang);
            if (sub != lang)
                sub.Format("%s [%s]", sub.c_str(), lang.c_str());
        }
        else
            sub = g_localizeStrings.Get(1223);
        CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info,
                                              g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime);
    }
    return true;
    break;

    case ACTION_SHOW_INFO:
    {
        CGUIDialogFullScreenInfo* pDialog = (CGUIDialogFullScreenInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
        if (pDialog)
        {
            CFileItem item(g_application.CurrentFileItem());
            pDialog->DoModal();
            return true;
        }
        break;
    }

    case ACTION_NEXT_SUBTITLE:
    {
        if (g_application.m_pPlayer->GetSubtitleCount() == 0)
            return true;

        if(g_settings.m_currentVideoSettings.m_SubtitleStream < 0)
            g_settings.m_currentVideoSettings.m_SubtitleStream = g_application.m_pPlayer->GetSubtitle();

        if (g_settings.m_currentVideoSettings.m_SubtitleOn)
        {
            g_settings.m_currentVideoSettings.m_SubtitleStream++;
            if (g_settings.m_currentVideoSettings.m_SubtitleStream >= g_application.m_pPlayer->GetSubtitleCount())
            {
                g_settings.m_currentVideoSettings.m_SubtitleStream = 0;
                g_settings.m_currentVideoSettings.m_SubtitleOn = false;
                g_application.m_pPlayer->SetSubtitleVisible(false);
            }
            g_application.m_pPlayer->SetSubtitle(g_settings.m_currentVideoSettings.m_SubtitleStream);
        }
        else
        {
            g_settings.m_currentVideoSettings.m_SubtitleOn = true;
            g_application.m_pPlayer->SetSubtitleVisible(true);
        }

        CStdString sub, lang;
        if (g_settings.m_currentVideoSettings.m_SubtitleOn)
        {
            g_application.m_pPlayer->GetSubtitleName(g_settings.m_currentVideoSettings.m_SubtitleStream,sub);
            g_application.m_pPlayer->GetSubtitleLanguage(g_settings.m_currentVideoSettings.m_SubtitleStream,lang);
            if (sub != lang)
                sub.Format("%s [%s]", sub.c_str(), lang.c_str());
        }
        else
            sub = g_localizeStrings.Get(1223);
        CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime);
    }
    return true;
    break;

    case ACTION_SUBTITLE_DELAY_MIN:
        g_settings.m_currentVideoSettings.m_SubtitleDelay -= 0.1f;
        if (g_settings.m_currentVideoSettings.m_SubtitleDelay < -g_advancedSettings.m_videoSubsDelayRange)
            g_settings.m_currentVideoSettings.m_SubtitleDelay = -g_advancedSettings.m_videoSubsDelayRange;
        if (g_application.m_pPlayer)
            g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay);

        ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay,
                   -g_advancedSettings.m_videoSubsDelayRange, 0.1f,
                   g_advancedSettings.m_videoSubsDelayRange);
        return true;
        break;
    case ACTION_SUBTITLE_DELAY_PLUS:
        g_settings.m_currentVideoSettings.m_SubtitleDelay += 0.1f;
        if (g_settings.m_currentVideoSettings.m_SubtitleDelay > g_advancedSettings.m_videoSubsDelayRange)
            g_settings.m_currentVideoSettings.m_SubtitleDelay = g_advancedSettings.m_videoSubsDelayRange;
        if (g_application.m_pPlayer)
            g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay);

        ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay,
                   -g_advancedSettings.m_videoSubsDelayRange, 0.1f,
                   g_advancedSettings.m_videoSubsDelayRange);
        return true;
        break;
    case ACTION_SUBTITLE_DELAY:
        ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay,
                   -g_advancedSettings.m_videoSubsDelayRange, 0.1f,
                   g_advancedSettings.m_videoSubsDelayRange, true);
        return true;
        break;
    case ACTION_AUDIO_DELAY:
        ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay,
                   -g_advancedSettings.m_videoAudioDelayRange, 0.025f,
                   g_advancedSettings.m_videoAudioDelayRange, true);
        return true;
        break;
    case ACTION_AUDIO_DELAY_MIN:
        g_settings.m_currentVideoSettings.m_AudioDelay -= 0.025f;
        if (g_settings.m_currentVideoSettings.m_AudioDelay < -g_advancedSettings.m_videoAudioDelayRange)
            g_settings.m_currentVideoSettings.m_AudioDelay = -g_advancedSettings.m_videoAudioDelayRange;
        if (g_application.m_pPlayer)
            g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay);

        ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay,
                   -g_advancedSettings.m_videoAudioDelayRange, 0.025f,
                   g_advancedSettings.m_videoAudioDelayRange);
        return true;
        break;
    case ACTION_AUDIO_DELAY_PLUS:
        g_settings.m_currentVideoSettings.m_AudioDelay += 0.025f;
        if (g_settings.m_currentVideoSettings.m_AudioDelay > g_advancedSettings.m_videoAudioDelayRange)
            g_settings.m_currentVideoSettings.m_AudioDelay = g_advancedSettings.m_videoAudioDelayRange;
        if (g_application.m_pPlayer)
            g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay);

        ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay,
                   -g_advancedSettings.m_videoAudioDelayRange, 0.025f,
                   g_advancedSettings.m_videoAudioDelayRange);
        return true;
        break;
    case ACTION_AUDIO_NEXT_LANGUAGE:
    {
        if (g_application.m_pPlayer->GetAudioStreamCount() == 1)
            return true;

        if(g_settings.m_currentVideoSettings.m_AudioStream < 0)
            g_settings.m_currentVideoSettings.m_AudioStream = g_application.m_pPlayer->GetAudioStream();

        g_settings.m_currentVideoSettings.m_AudioStream++;
        if (g_settings.m_currentVideoSettings.m_AudioStream >= g_application.m_pPlayer->GetAudioStreamCount())
            g_settings.m_currentVideoSettings.m_AudioStream = 0;
        g_application.m_pPlayer->SetAudioStream(g_settings.m_currentVideoSettings.m_AudioStream);    // Set the audio stream to the one selected
        CStdString aud;
        g_application.m_pPlayer->GetAudioStreamName(g_settings.m_currentVideoSettings.m_AudioStream,aud);
        CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime);
        return true;
    }
    break;
    case REMOTE_0:
    case REMOTE_1:
    case REMOTE_2:
    case REMOTE_3:
    case REMOTE_4:
    case REMOTE_5:
    case REMOTE_6:
    case REMOTE_7:
    case REMOTE_8:
    case REMOTE_9:
    {
        if (g_application.CurrentFileItem().IsLiveTV())
        {
            CPVRChannel channel;
            int iChannelNumber = -1;
            g_PVRManager.GetCurrentChannel(channel);

            if (action.GetID() == REMOTE_0)
            {
                iChannelNumber = g_PVRManager.GetPreviousChannel();
            }
            else
            {
                int autoCloseTime = g_guiSettings.GetBool("pvrplayback.switchautoclose") ? 1500 : 0;
                CStdString strChannel;
                strChannel.Format("%i", action.GetID() - REMOTE_0);
                if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
                    iChannelNumber = atoi(strChannel.c_str());
            }

            if (iChannelNumber > 0 && iChannelNumber != channel.ChannelNumber())
                OnAction(CAction(ACTION_CHANNEL_SWITCH, (float)iChannelNumber));
        }
        else
        {
            ChangetheTimeCode(action.GetID());
        }
        return true;
    }
    break;

    case ACTION_ASPECT_RATIO:
    {   // toggle the aspect ratio mode (only if the info is onscreen)
        if (m_bShowViewModeInfo)
        {
#ifdef HAS_VIDEO_PLAYBACK
            g_renderManager.SetViewMode(++g_settings.m_currentVideoSettings.m_ViewMode);
#endif
        }
        m_bShowViewModeInfo = true;
        m_dwShowViewModeTimeout = XbmcThreads::SystemClockMillis();
    }
    return true;
    break;
    case ACTION_SMALL_STEP_BACK:
        if (m_timeCodePosition > 0)
            SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
        else
        {
            int orgpos = (int)g_application.GetTime();
            int jumpsize = g_advancedSettings.m_videoSmallStepBackSeconds; // secs
            int setpos = (orgpos > jumpsize) ? orgpos - jumpsize : 0;
            g_application.SeekTime((double)setpos);
        }
        return true;
        break;
    case ACTION_SHOW_PLAYLIST:
    {
        CFileItem item(g_application.CurrentFileItem());
        if (item.HasPVRChannelInfoTag())
            g_windowManager.ActivateWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS);
        else if (item.HasVideoInfoTag())
            g_windowManager.ActivateWindow(WINDOW_VIDEO_PLAYLIST);
        else if (item.HasMusicInfoTag())
            g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST);
    }
    return true;
    break;
    case ACTION_ZOOM_IN:
    {
        g_settings.m_currentVideoSettings.m_CustomZoomAmount += 0.01f;
        if (g_settings.m_currentVideoSettings.m_CustomZoomAmount > 2.f)
            g_settings.m_currentVideoSettings.m_CustomZoomAmount = 2.f;
        g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM;
        g_renderManager.SetViewMode(VIEW_MODE_CUSTOM);
        ShowSlider(action.GetID(), 216, g_settings.m_currentVideoSettings.m_CustomZoomAmount, 0.5f, 0.1f, 2.0f);
    }
    return true;
    break;
    case ACTION_ZOOM_OUT:
    {
        g_settings.m_currentVideoSettings.m_CustomZoomAmount -= 0.01f;
        if (g_settings.m_currentVideoSettings.m_CustomZoomAmount < 0.5f)
            g_settings.m_currentVideoSettings.m_CustomZoomAmount = 0.5f;
        g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM;
        g_renderManager.SetViewMode(VIEW_MODE_CUSTOM);
        ShowSlider(action.GetID(), 216, g_settings.m_currentVideoSettings.m_CustomZoomAmount, 0.5f, 0.1f, 2.0f);
    }
    return true;
    break;
    case ACTION_INCREASE_PAR:
    {
        g_settings.m_currentVideoSettings.m_CustomPixelRatio += 0.01f;
        if (g_settings.m_currentVideoSettings.m_CustomPixelRatio > 2.f)
            g_settings.m_currentVideoSettings.m_CustomZoomAmount = 2.f;
        g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM;
        g_renderManager.SetViewMode(VIEW_MODE_CUSTOM);
        ShowSlider(action.GetID(), 217, g_settings.m_currentVideoSettings.m_CustomPixelRatio, 0.5f, 0.1f, 2.0f);
    }
    return true;
    break;
    case ACTION_DECREASE_PAR:
    {
        g_settings.m_currentVideoSettings.m_CustomPixelRatio -= 0.01f;
        if (g_settings.m_currentVideoSettings.m_CustomZoomAmount < 0.5f)
            g_settings.m_currentVideoSettings.m_CustomPixelRatio = 0.5f;
        g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM;
        g_renderManager.SetViewMode(VIEW_MODE_CUSTOM);
        ShowSlider(action.GetID(), 217, g_settings.m_currentVideoSettings.m_CustomPixelRatio, 0.5f, 0.1f, 2.0f);
    }
    return true;
    break;
    case ACTION_VSHIFT_UP:
    {
        g_settings.m_currentVideoSettings.m_CustomVerticalShift -= 0.01f;
        if (g_settings.m_currentVideoSettings.m_CustomVerticalShift < -2.0f)
            g_settings.m_currentVideoSettings.m_CustomVerticalShift = -2.0f;
        g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM;
        g_renderManager.SetViewMode(VIEW_MODE_CUSTOM);
        ShowSlider(action.GetID(), 225, g_settings.m_currentVideoSettings.m_CustomVerticalShift, -2.0f, 0.1f, 2.0f);
    }
    return true;
    break;
    case ACTION_VSHIFT_DOWN:
    {
        g_settings.m_currentVideoSettings.m_CustomVerticalShift += 0.01f;
        if (g_settings.m_currentVideoSettings.m_CustomVerticalShift > 2.0f)
            g_settings.m_currentVideoSettings.m_CustomVerticalShift = 2.0f;
        g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM;
        g_renderManager.SetViewMode(VIEW_MODE_CUSTOM);
        ShowSlider(action.GetID(), 225, g_settings.m_currentVideoSettings.m_CustomVerticalShift, -2.0f, 0.1f, 2.0f);
    }
    return true;
    break;
    case ACTION_SUBTITLE_VSHIFT_UP:
    {
        RESOLUTION_INFO& res_info =  g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()];
        int subalign = g_guiSettings.GetInt("subtitles.align");
        if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE))
        {
            res_info.iSubtitles ++;
            if (res_info.iSubtitles >= res_info.iHeight)
                res_info.iSubtitles = res_info.iHeight - 1;

            ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight);
        }
        else
        {
            res_info.iSubtitles --;
            if (res_info.iSubtitles < 0)
                res_info.iSubtitles = 0;

            if (subalign == SUBTITLE_ALIGN_MANUAL)
                ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight);
            else
                ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f);
        }

        break;
    }
    case ACTION_SUBTITLE_VSHIFT_DOWN:
    {
        RESOLUTION_INFO& res_info =  g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()];
        int subalign = g_guiSettings.GetInt("subtitles.align");
        if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE))
        {
            res_info.iSubtitles--;
            if (res_info.iSubtitles < 0)
                res_info.iSubtitles = 0;

            ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight);
        }
        else
        {
            res_info.iSubtitles++;
            if (res_info.iSubtitles >= res_info.iHeight)
                res_info.iSubtitles = res_info.iHeight - 1;

            if (subalign == SUBTITLE_ALIGN_MANUAL)
                ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight);
            else
                ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f);
        }

        break;
    }
    case ACTION_SUBTITLE_ALIGN:
    {
        RESOLUTION_INFO& res_info =  g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()];
        int subalign = g_guiSettings.GetInt("subtitles.align");

        subalign++;
        if (subalign > SUBTITLE_ALIGN_TOP_OUTSIDE)
            subalign = SUBTITLE_ALIGN_MANUAL;

        res_info.iSubtitles = res_info.iHeight - 1;

        g_guiSettings.SetInt("subtitles.align", subalign);
        CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info,
                                              g_localizeStrings.Get(21460),
                                              g_localizeStrings.Get(21461 + subalign),
                                              TOAST_DISPLAY_TIME, false);

        break;
    }
    default:
        break;
    }

    return CGUIWindow::OnAction(action);
}
Beispiel #2
0
CPVRTimerInfoTag *CPVRTimerInfoTag::InstantTimer()
{
  /* create a new timer */
  CPVRTimerInfoTag *newTag = new CPVRTimerInfoTag();
  if (!newTag)
  {
    CLog::Log(LOGERROR, "%s - couldn't create new timer", __FUNCTION__);
    return NULL;
  }

  CFileItem *curPlayingChannel = g_PVRManager.GetCurrentPlayingItem();
  CPVRChannel *channel = (curPlayingChannel) ? curPlayingChannel->GetPVRChannelInfoTag(): NULL;
  if (!channel)
  {
    CLog::Log(LOGDEBUG, "%s - couldn't find current playing channel", __FUNCTION__);
    channel = PVRChannelsTV.GetByChannelNumber(1);

    if (!channel)
    {
      CLog::Log(LOGERROR, "%s - cannot find any channels",
          __FUNCTION__);
    }
  }

  int iDuration = g_guiSettings.GetInt("pvrrecord.instantrecordtime");
  if (!iDuration)
    iDuration   = 180; /* default to 180 minutes */

  int iPriority = g_guiSettings.GetInt("pvrrecord.defaultpriority");
  if (!iPriority)
    iPriority   = 50;  /* default to 50 */

  int iLifetime = g_guiSettings.GetInt("pvrrecord.defaultlifetime");
  if (!iLifetime)
    iLifetime   = 30;  /* default to 30 days */

  /* set the timer data */
  newTag->m_iClientIndex   = -1;
  newTag->m_bIsActive      = true;
  newTag->m_strTitle       = g_localizeStrings.Get(19056);
  newTag->m_iChannelNumber = channel->ChannelNumber();
  newTag->m_iClientNumber  = channel->ClientChannelNumber();
  newTag->m_iClientID      = channel->ClientID();
  newTag->m_bIsRadio       = channel->IsRadio();
  newTag->m_StartTime      = CDateTime::GetCurrentDateTime();
  newTag->SetDuration(iDuration);
  newTag->m_iPriority      = iPriority;
  newTag->m_iLifetime      = iLifetime;

  /* generate summary string */
  newTag->m_strSummary.Format("%s %s %s %s %s",
      newTag->m_StartTime.GetAsLocalizedDate(),
      g_localizeStrings.Get(19159),
      newTag->m_StartTime.GetAsLocalizedTime("", false),
      g_localizeStrings.Get(19160),
      newTag->m_StopTime.GetAsLocalizedTime("", false));

  /* unused only for reference */
  newTag->m_strFileNameAndPath = "pvr://timers/new";

  return newTag;
}
Beispiel #3
0
bool CPVRManager::UpdateItem(CFileItem& item)
{
  /* Don't update if a recording is played */
  if (item.IsPVRRecording())
    return true;

  if (!item.IsPVRChannel())
  {
    CLog::Log(LOGERROR, "CPVRManager - %s - no channel tag provided", __FUNCTION__);
    return false;
  }

  CSingleLock lock(m_critSection);
  if (*m_currentFile->GetPVRChannelInfoTag() == *item.GetPVRChannelInfoTag())
    return false;

  g_application.CurrentFileItem() = *m_currentFile;
  g_infoManager.SetCurrentItem(*m_currentFile);

  CPVRChannel* channelTag = item.GetPVRChannelInfoTag();
  const CPVREpgInfoTag* epgTagNow = channelTag->GetEPGNow();

  if (channelTag->IsRadio())
  {
    CMusicInfoTag* musictag = item.GetMusicInfoTag();
    if (musictag)
    {
      musictag->SetTitle(epgTagNow ? epgTagNow->Title() : g_localizeStrings.Get(19055));
      musictag->SetGenre(epgTagNow ? epgTagNow->Genre() : "");
      musictag->SetDuration(epgTagNow ? epgTagNow->GetDuration() : 3600);
      musictag->SetURL(channelTag->Path());
      musictag->SetArtist(channelTag->ChannelName());
      musictag->SetAlbumArtist(channelTag->ChannelName());
      musictag->SetLoaded(true);
      musictag->SetComment("");
      musictag->SetLyrics("");
    }
  }
  else
  {
    CVideoInfoTag *videotag = item.GetVideoInfoTag();
    if (videotag)
    {
      videotag->m_strTitle = epgTagNow ? epgTagNow->Title() : g_localizeStrings.Get(19055);
      videotag->m_strGenre = epgTagNow ? epgTagNow->Genre() : "";
      videotag->m_strPath = channelTag->Path();
      videotag->m_strFileNameAndPath = channelTag->Path();
      videotag->m_strPlot = epgTagNow ? epgTagNow->Plot() : "";
      videotag->m_strPlotOutline = epgTagNow ? epgTagNow->PlotOutline() : "";
      videotag->m_iEpisode = epgTagNow ? epgTagNow->EpisodeNum() : 0;
    }
  }

  CPVRChannel* tagPrev = item.GetPVRChannelInfoTag();
  if (tagPrev && tagPrev->ChannelNumber() != m_LastChannel)
  {
    m_LastChannel         = tagPrev->ChannelNumber();
    m_LastChannelChanged  = CTimeUtils::GetTimeMS();
  }
  if (CTimeUtils::GetTimeMS() - m_LastChannelChanged >= (unsigned int) g_guiSettings.GetInt("pvrplayback.channelentrytimeout") && m_LastChannel != m_PreviousChannel[m_PreviousChannelIndex])
     m_PreviousChannel[m_PreviousChannelIndex ^= 1] = m_LastChannel;

  return false;
}
Beispiel #4
0
bool CDVDInputStreamPVRManager::SelectChannel(const CPVRChannel &channel)
{
  if (m_pLiveTV)
    return m_pLiveTV->SelectChannel(channel.ChannelNumber());
  return false;
}
Beispiel #5
0
CPVRTimerInfoTag *CPVRTimerInfoTag::CreateFromEpg(const CEpgInfoTag &tag)
{
  /* create a new timer */
  CPVRTimerInfoTag *newTag = new CPVRTimerInfoTag();
  if (!newTag)
  {
    CLog::Log(LOGERROR, "%s - couldn't create new timer", __FUNCTION__);
    return NULL;
  }

  /* check if a valid channel is set */
  CPVRChannel *channel = (CPVRChannel *) tag.ChannelTag();
  if (channel == NULL)
  {
    CLog::Log(LOGERROR, "%s - no channel set", __FUNCTION__);
    return NULL;
  }

  /* check if the epg end date is in the future */
  if (tag.EndAsLocalTime() < CDateTime::GetCurrentDateTime())
  {
    CLog::Log(LOGERROR, "%s - end time is in the past", __FUNCTION__);
    return NULL;
  }

  /* set the timer data */
  CDateTime newStart = tag.StartAsUTC();
  CDateTime newEnd = tag.EndAsUTC();
  newTag->m_iClientIndex      = -1;
  newTag->m_strTitle          = tag.Title().IsEmpty() ? channel->ChannelName() : tag.Title();
  newTag->m_iChannelNumber    = channel->ChannelNumber();
  newTag->m_iClientChannelUid = channel->UniqueID();
  newTag->m_iClientId         = channel->ClientID();
  newTag->m_bIsRadio          = channel->IsRadio();
  newTag->m_iGenreType        = tag.GenreType();
  newTag->m_iGenreSubType     = tag.GenreSubType();
  newTag->SetStartFromUTC(newStart);
  newTag->SetEndFromUTC(newEnd);

  if (tag.Plot().IsEmpty())
  {
    newTag->m_strSummary.Format("%s %s %s %s %s",
        newTag->StartAsLocalTime().GetAsLocalizedDate(),
        g_localizeStrings.Get(19159),
        newTag->StartAsLocalTime().GetAsLocalizedTime("", false),
        g_localizeStrings.Get(19160),
        newTag->EndAsLocalTime().GetAsLocalizedTime("", false));
  }
  else
  {
    newTag->m_strSummary = tag.Plot();
  }

  /* we might have a copy of the tag here, so get the real one from the pvrmanager */
  const CEpg *epgTable = channel->GetEPG();
  newTag->m_epgInfo = epgTable ? epgTable->GetTag(tag.UniqueBroadcastID(), tag.StartAsUTC()) : NULL;

  /* unused only for reference */
  newTag->m_strFileNameAndPath = "pvr://timers/new";

  return newTag;
}