Example #1
0
        protected override void OnPageLoad()
        {
            PluginMain.EnsureConnection();

            base.OnPageLoad();
            if (PluginMain.IsConnected())
            {
                LoadSettings();
                if (GUIWindowManager.GetPreviousActiveWindow() != WindowId.ProgramInfo &&
                    GUIWindowManager.GetPreviousActiveWindow() != WindowId.ManualShedule)
                {
                    _selectedSchedule = null;
                }
                LoadUpcomingPrograms(_selectedSchedule);
                _sortByButton.SortChanged += new SortEventHandler(SortChanged);

                if (this._channelType == ChannelType.Television)
                {
                    GUIPropertyManager.SetProperty("#currentmodule", Utility.GetLocalizedText(TextId.TVScheduler));
                }
                else
                {
                    GUIPropertyManager.SetProperty("#currentmodule", Utility.GetLocalizedText(TextId.RadioScheduler));
                }
            }
        }
Example #2
0
        private void CacheMiniGuide()
        {
            lock (chacheLock)
            {
                System.Threading.Thread.Sleep(8000);
                while (!PluginMain.IsConnected())
                {
                    Thread.Sleep(2000);
                }
                Log.Debug("CacheChannelsThread: started");
                using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                {
                    List <CurrentAndNextProgram> _currentAndNextPrograms = new List <CurrentAndNextProgram>();
                    try
                    {
                        ChannelGroup currgroup = PluginMain.Navigator.CurrentGroup;
                        if (currgroup != null)
                        {
                            _currentAndNextPrograms = new List <CurrentAndNextProgram>(tvSchedulerAgent.GetCurrentAndNextForGroup(PluginMain.Navigator.CurrentGroup.ChannelGroupId, true, true, null));
                        }

                        List <ChannelGroup> groups = PluginMain.Navigator.GetGroups(ChannelType.Television);
                        foreach (ChannelGroup group in groups)
                        {
                            _currentAndNextPrograms = new List <CurrentAndNextProgram>(tvSchedulerAgent.GetCurrentAndNextForGroup(group.ChannelGroupId, true, true, null));
                        }
                    }
                    catch { Log.Error("CacheChannelsThread: error"); }
                    _currentAndNextPrograms.Clear();
                    _currentAndNextPrograms = null;
                }
                Log.Debug("CacheChannelsThread: ended");
            }
        }
Example #3
0
 public void ShowPlugin()
 {
     using (Settings xmlwriter = new MPSettings())
     {
         SetupForm setupForm = new SetupForm();
         setupForm.ServerSettings             = PluginMain.LoadServerSettings();
         setupForm.NoClientStandbyWhenNotHome = PluginMain.NoClientStandbyWhenNotHome;
         setupForm.PreferRtspForLiveTv        = PluginMain.PreferRtspForLiveTv;
         setupForm.PlayRecordingsOverRtsp     = PluginMain.PlayRecordingsOverRtsp;
         setupForm.AutoStreamingMode          = PluginMain.AutoStreamingMode;
         setupForm.DisableRadio = PluginMain.DisableRadio;
         if (setupForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             xmlwriter.SetValue(_settingSection, SettingName.Server, setupForm.ServerSettings.ServerName);
             xmlwriter.SetValue(_settingSection, SettingName.TcpPort, setupForm.ServerSettings.Port);
             xmlwriter.SetValue(_settingSection, SettingName.MacAddresses, setupForm.ServerSettings.WakeOnLan.MacAddresses);
             xmlwriter.SetValue(_settingSection, SettingName.IPAddress, setupForm.ServerSettings.WakeOnLan.IPAddress);
             xmlwriter.SetValueAsBool(_settingSection, SettingName.UseWakeOnLan, setupForm.ServerSettings.WakeOnLan.Enabled);
             xmlwriter.SetValue(_settingSection, SettingName.WakeOnLanTimeoutSeconds, setupForm.ServerSettings.WakeOnLan.TimeoutSeconds);
             xmlwriter.SetValueAsBool(_settingSection, SettingName.NoClientStandbyWhenNotHome, setupForm.NoClientStandbyWhenNotHome);
             xmlwriter.SetValueAsBool(_settingSection, SettingName.AvoidRtspForLiveTv, !setupForm.PreferRtspForLiveTv);
             xmlwriter.SetValueAsBool(_settingSection, SettingName.PlayRecordingsOverRtsp, setupForm.PlayRecordingsOverRtsp);
             xmlwriter.SetValueAsBool(_settingSection, SettingName.AutoStreamingMode, setupForm.AutoStreamingMode);
             xmlwriter.SetValueAsBool(_settingSection, SettingName.IsSingleSeat, setupForm.IsSingleSeat);
             xmlwriter.SetValueAsBool(_settingSection, SettingName.DisableRadio, setupForm.DisableRadio);
             PluginMain.ClearCachedBooleanSettings();
         }
     }
 }
Example #4
0
        protected override void OnPageLoad()
        {
            PluginMain.EnsureConnection();

            base.OnPageLoad();
            if (PluginMain.IsConnected())
            {
                LoadSettings();
                if (GUIWindowManager.GetPreviousActiveWindow() != WindowId.ProgramInfo)
                {
                    OnClearRules(false);
                    _selectedTitle      = string.Empty;
                    _selectedTitleIndex = 0;
                }
                ShowSearchResults(_selectedTitle);
                UpdateButtonStates();
                _sortByButton.SortChanged += new SortEventHandler(SortChanged);

                if (this._channelType == ChannelType.Television)
                {
                    GUIPropertyManager.SetProperty("#currentmodule", Utility.GetLocalizedText(TextId.TVGuideSearch));
                }
                else
                {
                    GUIPropertyManager.SetProperty("#currentmodule", Utility.GetLocalizedText(TextId.RadioGuideSearch));
                }
            }
        }
Example #5
0
 private void SaveSettings()
 {
     if (PluginMain.IsConnected() && PluginMain.Navigator != null)
     {
         PluginMain.Navigator.SaveSettings();
         using (Settings xmlreader = new MPSettings())
         {
             //xmlreader.SetValueAsBool("general", "lastactivemoduleTvfullscreen", (g_Player.IsTV && GUIGraphicsContext.IsFullScreenVideo));
         }
     }
 }
Example #6
0
        protected override void OnPageLoad()
        {
            PluginMain.EnsureConnection();
            base.OnPageLoad();

            if (PluginMain.IsConnected())
            {
                LoadSettings();
                UpdateButtons();
                GUIPropertyManager.SetProperty("#currentmodule", Utility.GetLocalizedText(TextId.ArgusServerSettings));
            }
        }
Example #7
0
        protected override void OnPageLoad()
        {
            PluginMain.EnsureConnection();
            base.OnPageLoad();

            if (PluginMain.IsConnected())
            {
                _currentChannelType = ChannelType.Television;
                LoadAll(null);
                GUIPropertyManager.SetProperty("#currentmodule", Utility.GetLocalizedText(TextId.ChannelManager));
            }
        }
Example #8
0
        protected override void OnPageLoad()
        {
            PluginMain.EnsureConnection();
            base.OnPageLoad();

            if (PluginMain.IsConnected())
            {
                UpdateChannels();
                UpdateDateTime();
                UpdateButtonStates();
                UpdateDaysinMonth(Int32.Parse(_spinStartMonth.GetLabel()), Int32.Parse(_spinStartYear.GetLabel()));
                GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(100748));
            }
        }
Example #9
0
        private void LoadSettings(bool onlyServerSettings)
        {
            _serverSettings = PluginMain.LoadServerSettings();
            int timeout = _serverSettings.WakeOnLan.TimeoutSeconds;

            bool valueFoundInList = false;

            for (int i = 0; i <= 100; i++)
            {
                _WolTimeoutButton.AddSpinLabel(i.ToString(), 0);
                if (i == timeout)
                {
                    valueFoundInList = true;
                }
            }

            if (valueFoundInList)
            {
                _WolTimeoutButton.SpinValue = timeout;
            }
            else
            {
                _WolTimeoutButton.AddSpinLabel(timeout.ToString(), 0);
                _WolTimeoutButton.SpinValue = _WolTimeoutButton.SpinMaxValue() - 1;
            }

            _serverNameButton.Label   = _serverSettings.ServerName;
            _tcpPortButton.Label      = _serverSettings.Port.ToString();
            _enableWolButton.Selected = _serverSettings.WakeOnLan.Enabled;

            if (!onlyServerSettings)
            {
                _standbyOnHomeButton.Selected    = PluginMain.NoClientStandbyWhenNotHome;
                _autoStreamingButton.Selected    = PluginMain.AutoStreamingMode;
                _rtspStreamingTVButton.Selected  = PluginMain.PreferRtspForLiveTv;
                _rtspStreamingRecButton.Selected = PluginMain.PlayRecordingsOverRtsp;

                using (Settings xmlreader = new MPSettings())
                {
                    _recordingNotificationButton.Selected = xmlreader.GetValueAsBool("mytv", "enableRecNotifier", false);
                    _autoFullScreenButton.Selected        = xmlreader.GetValueAsBool("mytv", "autofullscreen", true);
                    _showChannelNumbersButton.Selected    = xmlreader.GetValueAsBool("mytv", "showchannelnumber", false);
                    _hideAllChannelsGroupButton.Selected  = xmlreader.GetValueAsBool("mytv", "hideAllChannelsGroup", false);
                    _dvbSubtitlesButton.Selected          = xmlreader.GetValueAsBool("tvservice", "dvbbitmapsubtitles", false);
                    _teletextSubtitleButton.Selected      = xmlreader.GetValueAsBool("tvservice", "dvbttxtsubtitles", false);
                    _preferAC3Button.Selected             = xmlreader.GetValueAsBool("tvservice", "preferac3", false);
                }
            }
        }
Example #10
0
        private void _timer_Tick(object sender, EventArgs e)
        {
            try
            {
                if (!_busy)
                {
                    _busy = true;

                    if (PluginMain.UpcomingAlertsChanged || _nextCheckTimeAlerts <= DateTime.Now)
                    {
                        if (!PluginMain.IsConnected())
                        {
                            _busy = false;
                            return;
                        }

                        _nextCheckTimeAlerts = DateTime.Now.AddDays(10);
                        DateTime preNotifySecs = DateTime.Now.AddSeconds(_preNotifyConfig);
                        ProcessAlerts(preNotifySecs);
                        _nextCheckTimeAlerts.AddSeconds(-_preNotifyConfig);
                        PluginMain.UpcomingAlertsChanged = false;
                    }

                    if ((PluginMain.UpcomingRecordingsChanged || _nextCheckTimeConflicts <= DateTime.Now) &&
                        _enableConflictNotification)
                    {
                        if (!PluginMain.IsConnected())
                        {
                            _busy = false;
                            return;
                        }

                        _nextCheckTimeConflicts = DateTime.Now.AddDays(10);
                        DateTime preNotifySecs = DateTime.Now.AddSeconds(_preNotifyConfig);
                        ProcessConflicts(preNotifySecs);
                        _nextCheckTimeConflicts.AddSeconds(-_preNotifyConfig);
                        PluginMain.UpcomingRecordingsChanged = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("NotifyManager: error in _timer_Tick - {0}", ex.Message);
            }
            finally
            {
                _busy = false;
            }
        }
Example #11
0
 private void Get_TimeInfo()
 {
   string strTime = channelName;
   GuideProgram prog = PluginMain.GetCurrentForChannel(channel);
   if (prog != null)
   {
     strTime = String.Format("{0}-{1}",
                             prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                             prog.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
   }
   if (lblCurrentTime != null)
   {
     lblCurrentTime.Label = strTime;
   }
 }
Example #12
0
    private void UpdateProgressBar()
    {
      double fPercent = 0.0;
      GuideProgram prog = PluginMain.GetCurrentForChannel(channel);
      if (prog != null)
      {
          string strTime = String.Format("{0}-{1}",
                                         prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                         prog.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

          TimeSpan ts = prog.StopTime - prog.StartTime;
          double iTotalSecs = ts.TotalSeconds;
          ts = DateTime.Now - prog.StartTime;
          double iCurSecs = ts.TotalSeconds;
          fPercent = ((double)iCurSecs) / ((double)iTotalSecs);
          fPercent *= 100.0d;
      }
      GUIPropertyManager.SetProperty("#TV.View.Percentage", fPercent.ToString());
    }
Example #13
0
        public bool ShouldRenderLayer()
        {
            if (GUIGraphicsContext.IsFullScreenVideo)
            {
                return(false);
            }

            TimeSpan ts = DateTime.Now - _updateTimer;

            if (ts.TotalMilliseconds < 1000)
            {
                return(_lastStatus);
            }
            _updateTimer = DateTime.Now;

            if (!PluginMain.IsConnected())
            {
                return(false);
            }

            try
            {
                _lastStatus = (PluginMain.ActiveRecordings.Length > 0);
            }
            catch
            {
                _lastStatus = false;
            }

            OnUpdateState(_lastStatus);

            if (!_lastStatus)
            {
                return(base.IsAnimating(AnimationType.WindowClose));
            }
            else
            {
                return(_lastStatus);
            }
        }
Example #14
0
        private void SaveSettings(bool onlyServerSettings)
        {
            using (Settings xmlwriter = new MPSettings())
            {
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.Server, _serverSettings.ServerName);
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.TcpPort, _serverSettings.Port);
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.MacAddresses, _serverSettings.WakeOnLan.MacAddresses);
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.IPAddress, _serverSettings.WakeOnLan.IPAddress);
                xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.UseWakeOnLan, _serverSettings.WakeOnLan.Enabled);
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.WakeOnLanTimeoutSeconds, _serverSettings.WakeOnLan.TimeoutSeconds);

                if (!onlyServerSettings)
                {
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.NoClientStandbyWhenNotHome, _standbyOnHomeButton.Selected);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.AvoidRtspForLiveTv, !_rtspStreamingTVButton.Selected);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.PlayRecordingsOverRtsp, _rtspStreamingRecButton.Selected);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.AutoStreamingMode, _autoStreamingButton.Selected);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.IsSingleSeat, Utility.IsThisASingleSeatSetup(_serverSettings.ServerName));

                    xmlwriter.SetValueAsBool("mytv", "enableRecNotifier", _recordingNotificationButton.Selected);
                    xmlwriter.SetValueAsBool("mytv", "autofullscreen", _autoFullScreenButton.Selected);
                    xmlwriter.SetValueAsBool("mytv", "showchannelnumber", _showChannelNumbersButton.Selected);
                    xmlwriter.SetValueAsBool("mytv", "hideAllChannelsGroup", _hideAllChannelsGroupButton.Selected);
                    xmlwriter.SetValueAsBool("tvservice", "dvbbitmapsubtitles", _dvbSubtitlesButton.Selected);
                    xmlwriter.SetValueAsBool("tvservice", "dvbttxtsubtitles", _teletextSubtitleButton.Selected);
                    xmlwriter.SetValueAsBool("tvservice", "preferac3", _preferAC3Button.Selected);
                }
            }

            PluginMain.ClearCachedBooleanSettings();
            if (PluginMain.Navigator != null)
            {
                PluginMain.Navigator.Reload();
            }

            TvHome.SettingChanged();
            HomeBase.OnSettingChanged();
        }
Example #15
0
        private void OnStart(bool resume)
        {
            if (!_started)
            {
                try
                {
                    using (Settings xmlreader = new MPSettings())
                    {
                        _lastActivemoduleWasFullscreen = xmlreader.GetValueAsBool("general", "lastactivemoduleTvfullscreen", false);
                    }

                    PluginMain.EnsureConnection(true, false);
                    _notifyManager.start();
                    _eventListener.StartListener();
                    StartKeepAliveThread();
                    StartCacheMiniGuideChannelsThread();

                    if (PluginMain.IsConnected())
                    {
                        //TODO
                        if (_showlastactivemodule && _lastActivemoduleWasFullscreen)
                        {
                            Channel previousChannel = PluginMain.Navigator.GetPreviousChannel(ChannelType.Television);
                            if (previousChannel != null)
                            {
                                //PluginMain.Navigator.ZapToChannel(previousChannel, false);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("TvHome: OnStart error -{0}", ex.Message);
                }
                _started = true;
            }
        }
Example #16
0
        /// <summary>
        /// Fill the list with channels
        /// </summary>
        private void FillChannelList()
        {
            using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
            {
                _channelsListControl.Clear();

                int    i           = 0;
                int    SelectedID  = 0;
                string ChannelLogo = string.Empty;

                if (_currentGroup != null)
                {
                    _currentAndNextPrograms = new List <CurrentAndNextProgram>(
                        tvSchedulerAgent.GetCurrentAndNextForGroup(_currentGroup.ChannelGroupId, true, true, PluginMain.Navigator.LiveStream));
                }
                else
                {
                    _currentAndNextPrograms = new List <CurrentAndNextProgram>();
                }

                Channel currentChannel = PluginMain.Navigator.CurrentChannel;
                Channel prevChannel    = PluginMain.Navigator.GetPreviousChannel(this.ChannelType);

                foreach (CurrentAndNextProgram currentAndNext in _currentAndNextPrograms)
                {
                    i++;
                    sb.Length = 0;
                    GUIListItem item = new GUIListItem("");
                    item.TVTag = currentAndNext.Channel;

                    sb.Append(currentAndNext.Channel.DisplayName);
                    ChannelLogo = Utility.GetLogoImage(currentAndNext.Channel, tvSchedulerAgent);

                    if (!string.IsNullOrEmpty(ChannelLogo))
                    {
                        item.IconImageBig = ChannelLogo;
                        item.IconImage    = ChannelLogo;
                    }
                    else
                    {
                        item.IconImageBig = string.Empty;
                        item.IconImage    = string.Empty;
                    }

                    ActiveRecording activeRecording;
                    if (PluginMain.IsChannelRecording(currentAndNext.Channel.ChannelId, out activeRecording))
                    {
                        if (_showStateIcons)
                        {
                            item.PinImage = RecordingIcon;
                        }
                        else
                        {
                            sb.Append(" ");
                            sb.Append(recordingText);
                        }
                        item.IsPlayed = (currentAndNext.LiveState == ChannelLiveState.NotTunable ||
                                         currentAndNext.LiveState == ChannelLiveState.NoFreeCard);
                    }
                    else
                    {
                        switch (currentAndNext.LiveState)
                        {
                        case ChannelLiveState.NotTunable:
                        case ChannelLiveState.NoFreeCard:
                            item.IsPlayed = true;
                            if (_showStateIcons)
                            {
                                item.PinImage = UnavailableIcon;
                            }
                            else
                            {
                                sb.Append(" ");
                                sb.Append(unavailableText);
                            }
                            break;

                        default:
                            item.IsPlayed = false;
                            if (_showStateIcons)
                            {
                                item.PinImage = AvailableIcon;
                            }
                            break;
                        }
                    }

                    if (currentChannel != null)
                    {
                        if (currentChannel.ChannelId == currentAndNext.Channel.ChannelId)
                        {
                            item.IsRemote = true;
                            SelectedID    = _channelsListControl.Count;

                            if (_showStateIcons && item.PinImage != RecordingIcon &&
                                item.PinImage != UnavailableIcon)
                            {
                                item.PinImage = TimeshiftingIcon;
                            }
                            else if (!_showStateIcons)
                            {
                                sb.Append(" ");
                                sb.Append(timeshiftingText);
                            }
                        }
                    }
                    else if (prevChannel != null &&
                             prevChannel.ChannelId == currentAndNext.Channel.ChannelId)
                    {
                        item.IsRemote = true;
                        SelectedID    = _channelsListControl.Count;
                    }

                    sbTmp.Length = 0;

                    bool hasNow = currentAndNext.Current != null;
                    if (hasNow)
                    {
                        sbTmp.Append(currentAndNext.Current.CreateProgramTitle());
                    }
                    else
                    {
                        sbTmp.Append(noDataAvailableText);
                    }

                    item.Label2 = sbTmp.ToString();
                    sbTmp.Insert(0, nowText);
                    item.Label3 = sbTmp.ToString();

                    sbTmp.Length = 0;

                    if (_showChannelNumber)
                    {
                        sb.Append(" - ");
                        if (!_byIndex)
                        {
                            if (currentAndNext.Channel.LogicalChannelNumber.HasValue)
                            {
                                sb.Append(currentAndNext.Channel.LogicalChannelNumber.Value.ToString());
                            }
                        }
                        else
                        {
                            sb.Append(i);
                        }
                    }

                    if (hasNow)
                    {
                        sb.Append(" - ");
                        sb.Append(currentAndNext.CurrentPercentageComplete);
                        sb.Append("%");
                    }

                    if (currentAndNext.Next != null)
                    {
                        sbTmp.Append(/*currentAndNext.Next.StartTime.ToShortTimeString() + " " + */ currentAndNext.Next.CreateProgramTitle());
                    }
                    else
                    {
                        sbTmp.Append(noDataAvailableText);
                    }

                    item.Label2 = sb.ToString();
                    sbTmp.Insert(0, nextText);
                    item.Label = sbTmp.ToString();

                    _channelsListControl.Add(item);
                }
                _channelsListControl.SelectedListItemIndex = SelectedID;
                Log.Debug("miniguide: state check + filling channel list completed");

                if (_channelsListControl.GetID == 37)
                {
                    GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SETFOCUS, GetID, 0, 37, 0, 0, null);
                    OnMessage(msg);
                }

                sb.Length    = 0;
                sbTmp.Length = 0;
            }
        }
Example #17
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();

            if (!g_Player.Playing || !g_Player.IsTV)
            {
                GUIWindowManager.CloseCurrentWindow();
                return;
            }

            g_Player.PlayBackStopped += new global::MediaPortal.Player.g_Player.StoppedHandler(OnPlayBackStopped);
            g_Player.PlayBackEnded   += new global::MediaPortal.Player.g_Player.EndedHandler(OnPlayBackEnded);
            g_Player.PlayBackChanged += new global::MediaPortal.Player.g_Player.ChangedHandler(OnPlayBackChanged);

            LiveStream _livestream = PluginMain.Navigator.LiveStream;
            Channel    _channel    = PluginMain.Navigator.CurrentChannel;

            if (g_Player.Playing && g_Player.IsTV && _livestream != null && _channel != null &&
                PluginMain.IsConnected())
            {
                ServiceTuning _serviceTuning = ControlAgent.GetLiveStreamTuningDetails(_livestream);

                if (_livestream.RtspUrl.StartsWith("rtsp://", StringComparison.CurrentCultureIgnoreCase))
                {
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.RTSPURL.value", _livestream.RtspUrl);
                }
                else
                {
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.RTSPURL.value", Utility.GetLocalizedText(TextId.UnavailableText));
                }


                if (g_Player.CurrentFile.StartsWith("rtsp:", StringComparison.InvariantCultureIgnoreCase))
                {
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.StreamingMode.value", "RTSP");
                }
                else
                {
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.StreamingMode.value", "UNC");
                }


                if (g_Player.EnableSubtitle)
                {
                    if ((g_Player.SubtitleStreams > 0 /*|| g_Player.SupportsCC*/) && g_Player.CurrentSubtitleStream >= 0)
                    {
                        GUIPropertyManager.SetProperty("#TV.TuningDetails.SubtitleStream.value", g_Player.SubtitleLanguage(g_Player.CurrentSubtitleStream));
                    }
                    else
                    {
                        GUIPropertyManager.SetProperty("#TV.TuningDetails.SubtitleStream.value", Utility.GetLocalizedText(TextId.UnavailableText));
                    }
                }
                else
                {
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.SubtitleStream.value", Utility.GetLocalizedText(TextId.Off));
                }


                GUIPropertyManager.SetProperty("#TV.TuningDetails.RTSPURL.label", "RTSP URL");
                GUIPropertyManager.SetProperty("#TV.TuningDetails.SubtitleStream.label", Utility.GetLocalizedText(TextId.CurrentSubtitle));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.StreamingMode.label", Utility.GetLocalizedText(TextId.StreamingMode));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.AudioType.label", Utility.GetLocalizedText(TextId.AudioType));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.AudioType.value", g_Player.AudioType(g_Player.CurrentAudioStream));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.AudioLanguage.label", Utility.GetLocalizedText(TextId.AudioLanguage));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.AudioLanguage.value", g_Player.AudioLanguage(g_Player.CurrentAudioStream));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.VideoResolution.label", Utility.GetLocalizedText(TextId.VideoResolution));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.VideoResolution.value", g_Player.Width.ToString() + "x" + g_Player.Height.ToString());
                GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelName.label", Utility.GetLocalizedText(TextId.Channel));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelName.value", _serviceTuning.Name);
                GUIPropertyManager.SetProperty("#TV.TuningDetails.Frequency.label", Utility.GetLocalizedText(TextId.Frequency));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.Frequency.value", _serviceTuning.Frequency.ToString());
                GUIPropertyManager.SetProperty("#TV.TuningDetails.Provider.label", Utility.GetLocalizedText(TextId.Provider));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.Provider.value", _serviceTuning.ProviderName);
                GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelType.label", Utility.GetLocalizedText(TextId.Type));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.SignalLevel.label", Utility.GetLocalizedText(TextId.SignalLevel));
                GUIPropertyManager.SetProperty("#TV.TuningDetails.SignalQuality.label", Utility.GetLocalizedText(TextId.SignalQuality));

                switch (_serviceTuning.CardType)
                {
                case CardType.Analog:
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelType.value", "Analog");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Provider.value", Utility.GetLocalizedText(TextId.Unknown));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.value", "");
                    break;

                case CardType.Atsc:
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelType.value", "ATSC");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Provider.value", Utility.GetLocalizedText(TextId.Unknown));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.label", Utility.GetLocalizedText(TextId.Encrypted));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.value", _serviceTuning.IsFreeToAir ? Utility.GetLocalizedText(TextId.No) : Utility.GetLocalizedText(TextId.Yes));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.label", Utility.GetLocalizedText(TextId.Modulation));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.value", _serviceTuning.Modulation.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.label", "Symbol Rate");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.value", _serviceTuning.SymbolRate.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.label", "Service ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.value", _serviceTuning.SID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.label", "Transport ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.value", _serviceTuning.TSID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.label", "InnerFecRate");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.value", _serviceTuning.InnerFecRate.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.label", "Physical Channel");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.value", _serviceTuning.PhysicalChannel.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.value", "");
                    break;

                case CardType.DvbC:
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelType.value", "DVB-C");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.label", Utility.GetLocalizedText(TextId.Encrypted));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.value", _serviceTuning.IsFreeToAir ? Utility.GetLocalizedText(TextId.No) : Utility.GetLocalizedText(TextId.Yes));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.label", Utility.GetLocalizedText(TextId.Modulation));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.value", _serviceTuning.Modulation.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.label", "Symbol Rate");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.value", _serviceTuning.SymbolRate.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.label", "Service ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.value", _serviceTuning.SID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.label", "Network ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.value", _serviceTuning.ONID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.label", "Transport ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.value", _serviceTuning.TSID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.label", "InnerFecRate");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.value", _serviceTuning.InnerFecRate.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.label", "OuterFecRate");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.value", _serviceTuning.OuterFecRate.ToString());
                    break;

                case CardType.DvbS:
                    if (_serviceTuning.IsDvbS2)
                    {
                        GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelType.value", "DVB-S2");
                    }
                    else
                    {
                        GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelType.value", "DVB-S");
                    }

                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.label", Utility.GetLocalizedText(TextId.SatellitePosition));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.value", _serviceTuning.OrbitalPosition.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.label", Utility.GetLocalizedText(TextId.Encrypted));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.value", _serviceTuning.IsFreeToAir ? Utility.GetLocalizedText(TextId.No) : Utility.GetLocalizedText(TextId.Yes));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.label", Utility.GetLocalizedText(TextId.Modulation));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.value", _serviceTuning.Modulation.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.label", Utility.GetLocalizedText(TextId.Polarisation));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.value", _serviceTuning.SignalPolarisation.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.label", "Symbol Rate");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.value", _serviceTuning.SymbolRate.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.label", "Service ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.value", _serviceTuning.SID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.label", "Network ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.value", _serviceTuning.ONID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.label", "Transport ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.value", _serviceTuning.TSID.ToString());
                    break;

                case CardType.DvbT:
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelType.value", "DVB-T");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.label", Utility.GetLocalizedText(TextId.Encrypted));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.value", _serviceTuning.IsFreeToAir ? Utility.GetLocalizedText(TextId.No) : Utility.GetLocalizedText(TextId.Yes));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.label", Utility.GetLocalizedText(TextId.Modulation));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.value", _serviceTuning.Modulation.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.label", Utility.GetLocalizedText(TextId.Bandwidth));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.value", _serviceTuning.Bandwidth.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.label", "Service ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.value", _serviceTuning.SID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.label", "Network ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.value", _serviceTuning.ONID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.label", "Transport ID");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.value", _serviceTuning.TSID.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.label", "InnerFecRate");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.value", _serviceTuning.InnerFecRate.ToString());
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.label", Utility.GetLocalizedText(TextId.TransmissionMode));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.value", _serviceTuning.TransmissionMode.ToString());
                    break;

                default:
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.ChannelType.value", Utility.GetLocalizedText(TextId.Unknown));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Provider.value", Utility.GetLocalizedText(TextId.Unknown));
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail1.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail2.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail3.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail4.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail5.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail6.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail7.value", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.label", "");
                    GUIPropertyManager.SetProperty("#TV.TuningDetails.Detail8.value", "");
                    break;
                }
            }
        }
Example #18
0
    private void ShowPrograms()
    {
      if (lblOnTvNow != null)
      {
        lblOnTvNow.EnableUpDown = false;
        lblOnTvNow.Clear();
      }
      if (lblOnTvNext != null)
      {
        lblOnTvNext.EnableUpDown = false;
        lblOnTvNext.Clear();
      }

      // Set recorder status
      if (imgRecIcon != null)
      {
          ActiveRecording activeRecording;
          imgRecIcon.IsVisible = PluginMain.IsChannelRecording( channelId, out activeRecording);
      }

      if (lblCurrentChannel != null)
      {
        lblCurrentChannel.Label = channelName;
      }
      if (lblZapToCannelNo != null)
      {
        lblZapToCannelNo.Label = channelNr;
        lblZapToCannelNo.Visible = !string.IsNullOrEmpty(channelNr);
      }

      if (m_lastError != string.Empty)
      {
          lblOnTvNow.Label = m_lastError;// first line in "NOW"
          m_lastError = string.Empty;

          if (lblStartTime != null)
          {
              lblStartTime.Label = String.Empty;
          }
          if (lblEndTime != null)
          {
              lblEndTime.Label = String.Empty;
          }
          if (lblCurrentTime != null)
          {
              lblCurrentTime.Label = String.Empty;
          }
      }
      else
      {
        GuideProgram prog = PluginMain.GetCurrentForChannel(channel);
        if (prog != null)
        {
          string strTime = String.Format("{0}-{1}",
                                         prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                         prog.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

          if (lblCurrentTime != null)
          {
            lblCurrentTime.Label = strTime;
          }

          if (lblOnTvNow != null)
          {
            lblOnTvNow.Label = prog.Title;
          }
          if (lblStartTime != null)
          {
            strTime = String.Format("{0}", prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
            lblStartTime.Label = strTime;
          }
          if (lblEndTime != null)
          {
            strTime = String.Format("{0} ", prog.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
            lblEndTime.Label = strTime;
          }

          // next program
          prog = PluginMain.GetNextForChannel(channel);
          if (prog != null)
          {
            if (lblOnTvNext != null)
            {
              lblOnTvNext.Label = prog.Title;
            }
          }
        }
        else
        {
          lblOnTvNow.Label = GUILocalizeStrings.Get(736); // no epg for this channel

          if (lblStartTime != null)
          {
            lblStartTime.Label = String.Empty;
          }
          if (lblEndTime != null)
          {
            lblEndTime.Label = String.Empty;
          }
          if (lblCurrentTime != null)
          {
            lblCurrentTime.Label = String.Empty;
          }
        }
      }
      UpdateProgressBar();
    }
Example #19
0
        /// <summary>
        /// To keep the stream, server and this system alive when needed.
        /// - System and server are kept alive when there is playing something, when a slideshow is active
        ///   or when you aren't on the home screen (if configured).
        /// - So no need for the powerscheduler plugin.
        /// </summary>
        private int DoKeepAlive(int param1, int param2, object data)
        {
            if (DateTime.Now >= _keepAliveServerTime)
            {
                _keepAliveServerTime = DateTime.Now.AddSeconds(110);
                bool systemNeeded  = false;
                bool displayNeeded = false;

                if (!g_Player.Playing)
                {
                    int activeWindow = GUIWindowManager.ActiveWindow;
                    if (PluginMain.NoClientStandbyWhenNotHome)
                    {
                        if (activeWindow != (int)GUIWindow.Window.WINDOW_HOME &&
                            activeWindow != (int)GUIWindow.Window.WINDOW_SECOND_HOME)
                        {
                            systemNeeded = true;
                        }
                    }
                    if (activeWindow == (int)GUIWindow.Window.WINDOW_SLIDESHOW)
                    {
                        systemNeeded  = true;
                        displayNeeded = true;
                    }
                }
                else
                {
                    displayNeeded = true;
                    systemNeeded  = true;
                }

                if (systemNeeded)
                {
                    try
                    {
                        //tell the system we need it
                        SetThreadExecutionState(EXECUTION_STATE.ES_SYSTEM_REQUIRED);

                        if (PluginMain.IsConnected())
                        {
                            // Tell the server we need it.
                            this.CoreAgent.KeepServerAlive();
                        }

                        if (displayNeeded)
                        {
                            SetThreadExecutionState(EXECUTION_STATE.ES_DISPLAY_REQUIRED);
                        }
                    }
                    catch { Log.Error("TvHome: DoKeepAlive error"); }
                }
            }

            try
            {
                if (PluginMain.IsConnected())
                {
                    PluginMain.Navigator.SendLiveStreamKeepAlive();
                    _eventListener.EnsureListener();
                }
            }
            catch { }
            return(0);
        }