Exemple #1
0
        internal void LoadSettings()
        {
            try
            {
                TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
                _serverSettings.ServerName = layer.GetSetting(SettingName.ServerName, _defaultServerName).Value;
                _serverSettings.Transport  = ServiceTransport.Http;
                _serverSettings.Port       = Convert.ToInt32(layer.GetSetting(SettingName.Port, _defaultPort.ToString()).Value);
                if (_serverSettings.Port == 49942)
                {
                    // Auto-adjust old net.tcp port to HTTP.
                    _serverSettings.Port = 49943;
                }
                _restartTvServerOnResume = Convert.ToBoolean(layer.GetSetting(SettingName.ResetTvServerOnResume, false.ToString()).Value);
                _epgSyncOn = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncOn, false.ToString()).Value);
                _epgSyncAutoCreateChannels          = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannels, false.ToString()).Value);
                _epgSyncAutoCreateChannelsWithGroup = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannelsWithGroup, false.ToString()).Value);
                _epgSyncAllHours      = Convert.ToInt32(layer.GetSetting(SettingName.EpgSyncAllHours, DefaultSyncAllHours.ToString()).Value);
                _recorderTunerTcpPort = Convert.ToInt32(layer.GetSetting(SettingName.RecorderTunerTcpPort, DefaultRecorderTunerTcpPort.ToString()).Value);
            }
            catch (Exception ex)
            {
                _serverSettings.ServerName = _defaultServerName;
                _serverSettings.Transport  = ServiceTransport.Http;
                _serverSettings.Port       = _defaultPort;

                Log.Error("ArgusTV.Recorder.MediaPortalTvServer: LoadSettings(): {0}", ex.Message);
            }
        }
Exemple #2
0
        internal void SaveSettings()
        {
            bool forceReload = false;

            try
            {
                TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
                TvDatabase.Setting         setting;

                setting = layer.GetSetting("TVServerKodi.port");
                if (Convert.ToInt32(setting.Value) != m_serverPort)
                {
                    Log.Info("TVServerKodi: port setting changed from " + setting.Value + " to " + m_serverPort);
                    setting.Value = m_serverPort.ToString();
                    setting.Persist();
                    forceReload = true;
                }
            }
            catch (Exception ex)
            {
                Log.Error("TVServerKodi: SaveSettings(): {0}", ex.Message);
            }

            if (forceReload)
            {
                StopListenThread();
                StartListenThread();
            }
        }
Exemple #3
0
 internal void LoadSettings()
 {
     try
     {
         TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
         m_serverPort = Convert.ToInt32(layer.GetSetting("TVServerKodi.port", m_defaultServerPort.ToString()).Value);
     }
     catch (Exception ex)
     {
         m_serverPort = m_defaultServerPort;
         Log.Error("TVServerKodi: LoadSettings(): {0}", ex.Message);
     }
 }
Exemple #4
0
        internal void SaveSettings()
        {
            try
            {
                TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
                TvDatabase.Setting         setting;

                setting       = layer.GetSetting(SettingName.ServerName);
                setting.Value = _serverSettings.ServerName;
                setting.Persist();

                setting       = layer.GetSetting(SettingName.Port);
                setting.Value = _serverSettings.Port.ToString();
                setting.Persist();

                setting       = layer.GetSetting(SettingName.ResetTvServerOnResume);
                setting.Value = _restartTvServerOnResume.ToString();
                setting.Persist();

                setting       = layer.GetSetting(SettingName.EpgSyncOn);
                setting.Value = _epgSyncOn.ToString();
                setting.Persist();

                setting       = layer.GetSetting(SettingName.EpgSyncAutoCreateChannels);
                setting.Value = _epgSyncAutoCreateChannels.ToString();
                setting.Persist();

                setting       = layer.GetSetting(SettingName.EpgSyncAutoCreateChannelsWithGroup);
                setting.Value = _epgSyncAutoCreateChannelsWithGroup.ToString();
                setting.Persist();

                setting       = layer.GetSetting(SettingName.EpgSyncAllHours);
                setting.Value = _epgSyncAllHours.ToString();
                setting.Persist();

                setting       = layer.GetSetting(SettingName.RecorderTunerTcpPort);
                setting.Value = _recorderTunerTcpPort.ToString();
                setting.Persist();
            }
            catch (Exception ex)
            {
                Log.Error("ArgusTV.Recorder.MediaPortalTvServer: SaveSettings(): {0}", ex.Message);
            }
        }
Exemple #5
0
        private void ImportEpgPrograms(EpgChannel epgChannel)
        {
            if (!this.IsArgusTVConnectionInitialized)
            {
                InitializeArgusTVConnection(null);
            }
            if (this.IsArgusTVConnectionInitialized)
            {
                TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
                bool epgSyncOn = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncOn, false.ToString()).Value);
                if (epgSyncOn)
                {
                    DVBBaseChannel dvbChannel = epgChannel.Channel as DVBBaseChannel;
                    if (dvbChannel != null)
                    {
                        TvDatabase.Channel mpChannel = layer.GetChannelByTuningDetail(dvbChannel.NetworkId, dvbChannel.TransportId, dvbChannel.ServiceId);
                        if (mpChannel != null)
                        {
                            Log.Debug("ArgusTV.Recorder.MediaPortalTvServer: ImportEpgPrograms(): received {0} programs on {1}", epgChannel.Programs.Count, mpChannel.DisplayName);

                            bool   epgSyncAutoCreateChannels          = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannels, false.ToString()).Value);
                            bool   epgSyncAutoCreateChannelsWithGroup = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannelsWithGroup, false.ToString()).Value);
                            string epgLanguages = layer.GetSetting("epgLanguages").Value;

                            Channel channel = EnsureChannelForDvbEpg(mpChannel, epgSyncAutoCreateChannels, epgSyncAutoCreateChannelsWithGroup);
                            if (channel != null)
                            {
                                EnsureGuideChannelForDvbEpg(channel, mpChannel);

                                List <GuideProgram> guidePrograms = new List <GuideProgram>();

                                foreach (EpgProgram epgProgram in epgChannel.Programs)
                                {
                                    string title;
                                    string description;
                                    string genre;
                                    int    starRating;
                                    string classification;
                                    int    parentalRating;
                                    GetProgramInfoForLanguage(epgProgram.Text, epgLanguages, out title, out description, out genre,
                                                              out starRating, out classification, out parentalRating);

                                    if (!String.IsNullOrEmpty(title))
                                    {
                                        GuideProgram guideProgram = new GuideProgram();
                                        guideProgram.GuideChannelId = channel.GuideChannelId.Value;
                                        guideProgram.StartTime      = epgProgram.StartTime;
                                        guideProgram.StopTime       = epgProgram.EndTime;
                                        guideProgram.StartTimeUtc   = epgProgram.StartTime.ToUniversalTime();
                                        guideProgram.StopTime       = epgProgram.EndTime;
                                        guideProgram.StopTimeUtc    = epgProgram.EndTime.ToUniversalTime();
                                        guideProgram.Title          = title;
                                        guideProgram.Description    = description;
                                        guideProgram.Category       = genre;
                                        guideProgram.Rating         = classification;
                                        guideProgram.StarRating     = starRating / 7.0;
                                        guidePrograms.Add(guideProgram);
                                    }
                                }

                                _dvbEpgThread.ImportProgramsAsync(guidePrograms);
                            }
                            else
                            {
                                Log.Info("ArgusTV.Recorder.MediaPortalTvServer: ImportEpgPrograms() failed to ensure channel.");
                            }
                        }
                        else
                        {
                            Log.Info("ArgusTV.Recorder.MediaPortalTvServer: ImportEpgPrograms() failed to find MP channel.");
                        }
                    }
                }
            }
        }
        private void ImportEpgPrograms(EpgChannel epgChannel)
        {
            if (!this.IsArgusTVConnectionInitialized)
            {
                InitializeArgusTVConnection(null);
            }
            if (this.IsArgusTVConnectionInitialized)
            {
                TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
                bool epgSyncOn = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncOn, false.ToString()).Value);
                if (epgSyncOn)
                {
                    DVBBaseChannel dvbChannel = epgChannel.Channel as DVBBaseChannel;
                    if (dvbChannel != null)
                    {
                        TvDatabase.Channel mpChannel = layer.GetChannelByTuningDetail(dvbChannel.NetworkId, dvbChannel.TransportId, dvbChannel.ServiceId);
                        if (mpChannel != null)
                        {
                            Log.Debug("ArgusTV.Recorder.MediaPortalTvServer: ImportEpgPrograms(): received {0} programs on {1}", epgChannel.Programs.Count, mpChannel.DisplayName);

                            using (CoreServiceAgent coreAgent = new CoreServiceAgent())
                            using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                            using (GuideServiceAgent tvGuideAgent = new GuideServiceAgent())
                            {
                                bool epgSyncAutoCreateChannels = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannels, false.ToString()).Value);
                                bool epgSyncAutoCreateChannelsWithGroup = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannelsWithGroup, false.ToString()).Value);
                                string epgLanguages = layer.GetSetting("epgLanguages").Value;

                                Channel channel = EnsureChannelForDvbEpg(tvSchedulerAgent, mpChannel, epgSyncAutoCreateChannels, epgSyncAutoCreateChannelsWithGroup);
                                if (channel != null)
                                {
                                    EnsureGuideChannelForDvbEpg(tvSchedulerAgent, tvGuideAgent, channel, mpChannel);

                                    List<GuideProgram> guidePrograms = new List<GuideProgram>();

                                    foreach (EpgProgram epgProgram in epgChannel.Programs)
                                    {
                                        string title;
                                        string description;
                                        string genre;
                                        int starRating;
                                        string classification;
                                        int parentalRating;
                                        GetProgramInfoForLanguage(epgProgram.Text, epgLanguages, out title, out description, out genre,
                                            out starRating, out classification, out parentalRating);

                                        if (!String.IsNullOrEmpty(title))
                                        {
                                            GuideProgram guideProgram = new GuideProgram();
                                            guideProgram.GuideChannelId = channel.GuideChannelId.Value;
                                            guideProgram.StartTime = epgProgram.StartTime;
                                            guideProgram.StopTime = epgProgram.EndTime;
                                            guideProgram.StartTimeUtc = epgProgram.StartTime.ToUniversalTime();
                                            guideProgram.StopTime = epgProgram.EndTime;
                                            guideProgram.StopTimeUtc = epgProgram.EndTime.ToUniversalTime();
                                            guideProgram.Title = title;
                                            guideProgram.Description = description;
                                            guideProgram.Category = genre;
                                            guideProgram.Rating = classification;
                                            guideProgram.StarRating = starRating / 7.0;
                                            guidePrograms.Add(guideProgram);
                                        }
                                    }

                                    _dvbEpgThread.ImportProgramsAsync(guidePrograms);
                                }
                                else
                                {
                                    Log.Info("ArgusTV.Recorder.MediaPortalTvServer: ImportEpgPrograms() failed to ensure channel.");
                                }
                            }
                        }
                        else
                        {
                            Log.Info("ArgusTV.Recorder.MediaPortalTvServer: ImportEpgPrograms() failed to find MP channel.");
                        }
                    }
                }
            }
        }
        internal void SaveSettings()
        {
            try
            {
                TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
                TvDatabase.Setting setting;

                setting = layer.GetSetting(SettingName.ServerName);
                setting.Value = _serverSettings.ServerName;
                setting.Persist();

                setting = layer.GetSetting(SettingName.Port);
                setting.Value = _serverSettings.Port.ToString();
                setting.Persist();

                setting = layer.GetSetting(SettingName.ResetTvServerOnResume);
                setting.Value = _restartTvServerOnResume.ToString();
                setting.Persist();

                setting = layer.GetSetting(SettingName.EpgSyncOn);
                setting.Value = _epgSyncOn.ToString();
                setting.Persist();

                setting = layer.GetSetting(SettingName.EpgSyncAutoCreateChannels);
                setting.Value = _epgSyncAutoCreateChannels.ToString();
                setting.Persist();

                setting = layer.GetSetting(SettingName.EpgSyncAutoCreateChannelsWithGroup);
                setting.Value = _epgSyncAutoCreateChannelsWithGroup.ToString();
                setting.Persist();

                setting = layer.GetSetting(SettingName.EpgSyncAllHours);
                setting.Value = _epgSyncAllHours.ToString();
                setting.Persist();

                setting = layer.GetSetting(SettingName.RecorderTunerTcpPort);
                setting.Value = _recorderTunerTcpPort.ToString();
                setting.Persist();
            }
            catch (Exception ex)
            {
                Log.Error("ArgusTV.Recorder.MediaPortalTvServer: SaveSettings(): {0}", ex.Message);
            }
        }
        internal void LoadSettings()
        {
            try
            {
                TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
                _serverSettings.ServerName = layer.GetSetting(SettingName.ServerName, _defaultServerName).Value;
                _serverSettings.Transport = ServiceTransport.NetTcp;
                _serverSettings.Port = Convert.ToInt32(layer.GetSetting(SettingName.Port, _defaultPort.ToString()).Value);
                _restartTvServerOnResume = Convert.ToBoolean(layer.GetSetting(SettingName.ResetTvServerOnResume, false.ToString()).Value);
                _epgSyncOn = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncOn, false.ToString()).Value);
                _epgSyncAutoCreateChannels = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannels, false.ToString()).Value);
                _epgSyncAutoCreateChannelsWithGroup = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannelsWithGroup, false.ToString()).Value);
                _epgSyncAllHours = Convert.ToInt32(layer.GetSetting(SettingName.EpgSyncAllHours, DefaultSyncAllHours.ToString()).Value);
                _recorderTunerTcpPort = Convert.ToInt32(layer.GetSetting(SettingName.RecorderTunerTcpPort, DefaultRecorderTunerTcpPort.ToString()).Value);
            }
            catch (Exception ex)
            {
                _serverSettings.ServerName = _defaultServerName;
                _serverSettings.Transport = ServiceTransport.NetTcp;
                _serverSettings.Port = _defaultPort;

                Log.Error("ArgusTV.Recorder.MediaPortalTvServer: LoadSettings(): {0}", ex.Message);
            }
        }
Exemple #9
0
        internal void SaveSettings()
        {
            bool forceReload = false;

            try
            {
              TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
              TvDatabase.Setting setting;

              setting = layer.GetSetting("TVServerKodi.port");
              if (Convert.ToInt32(setting.Value) != m_serverPort)
              {
            Log.Info("TVServerKodi: port setting changed from " + setting.Value + " to " + m_serverPort);
            setting.Value = m_serverPort.ToString();
            setting.Persist();
            forceReload = true;
              }
            }
            catch (Exception ex)
            {
              Log.Error("TVServerKodi: SaveSettings(): {0}", ex.Message);
            }

            if (forceReload)
            {
              StopListenThread();
              StartListenThread();
            }
        }
Exemple #10
0
 internal void LoadSettings()
 {
     try
     {
       TvDatabase.TvBusinessLayer layer = new TvDatabase.TvBusinessLayer();
       m_serverPort = Convert.ToInt32(layer.GetSetting("TVServerKodi.port", m_defaultServerPort.ToString()).Value);
     }
     catch (Exception ex)
     {
       m_serverPort = m_defaultServerPort;
       Log.Error("TVServerKodi: LoadSettings(): {0}", ex.Message);
     }
 }