/// <summary> /// checks if a received EPGChannel should be filtered from the resultlist /// </summary> /// <value></value> protected override bool FilterOutEPGChannel(EpgChannel epgChannel) { TvBusinessLayer layer = new TvBusinessLayer(); if (layer.GetSetting("generalGrapOnlyForSameTransponder", "no").Value == "yes") { DVBBaseChannel chan = epgChannel.Channel as DVBBaseChannel; Channel dbchannel = layer.GetChannelByTuningDetail(chan.NetworkId, chan.TransportId, chan.ServiceId); DVBTChannel dvbtchannel = new DVBTChannel(); if (dbchannel == null) { return(false); } foreach (TuningDetail detail in dbchannel.ReferringTuningDetail()) { if (detail.ChannelType == 4) { dvbtchannel.Frequency = detail.Frequency; dvbtchannel.BandWidth = detail.Bandwidth; } } return(this.CurrentChannel.IsDifferentTransponder(dvbtchannel)); } else { return(false); } }
/// <summary> /// checks if a received EPGChannel should be filtered from the resultlist /// </summary> /// <value></value> protected override bool FilterOutEPGChannel(EpgChannel epgChannel) { TvBusinessLayer layer = new TvBusinessLayer(); if (layer.GetSetting("generalGrapOnlyForSameTransponder", "no").Value == "yes") { DVBBaseChannel chan = epgChannel.Channel as DVBBaseChannel; Channel dbchannel = layer.GetChannelByTuningDetail(chan.NetworkId, chan.TransportId, chan.ServiceId); ATSCChannel atscchannel = new ATSCChannel(); if (dbchannel == null) { return(false); } foreach (TuningDetail detail in dbchannel.ReferringTuningDetail()) { if (detail.ChannelType == 1) { atscchannel.MajorChannel = detail.MajorChannel; atscchannel.MinorChannel = detail.MinorChannel; atscchannel.PhysicalChannel = detail.ChannelNumber; } } return(this.CurrentChannel.IsDifferentTransponder(atscchannel)); } else { return(false); } }
/// <summary> /// checks if a received EPGChannel should be filtered from the resultlist /// </summary> /// <value></value> protected override bool FilterOutEPGChannel(EpgChannel epgChannel) { TvBusinessLayer layer = new TvBusinessLayer(); if (layer.GetSetting("generalGrapOnlyForSameTransponder", "no").Value == "yes") { DVBBaseChannel chan = epgChannel.Channel as DVBBaseChannel; Channel dbchannel = layer.GetChannelByTuningDetail(chan.NetworkId, chan.TransportId, chan.ServiceId); DVBSChannel dvbschannel = new DVBSChannel(); if (dbchannel == null) { return(false); } foreach (TuningDetail detail in dbchannel.ReferringTuningDetail()) { if (detail.ChannelType == 3) { dvbschannel.Frequency = detail.Frequency; dvbschannel.Polarisation = (Polarisation)detail.Polarisation; dvbschannel.ModulationType = (ModulationType)detail.Modulation; dvbschannel.SatelliteIndex = detail.SatIndex; dvbschannel.InnerFecRate = (BinaryConvolutionCodeRate)detail.InnerFecRate; dvbschannel.Pilot = (Pilot)detail.Pilot; dvbschannel.Rolloff = (RollOff)detail.RollOff; dvbschannel.DisEqc = (DisEqcType)detail.Diseqc; } } return(this.CurrentChannel.IsDifferentTransponder(dvbschannel)); } else { return(false); } }
private Channel IsInsertAllowed(EpgChannel epgChannel) { DVBBaseChannel dvbChannel = (DVBBaseChannel)epgChannel.Channel; //are there any epg infos for this channel? if (epgChannel.Programs.Count == 0) { Log.Epg("{0}: no epg infos found for channel networkid:0x{1:X} transportid:0x{2:X} serviceid:0x{3:X}", _grabberName, dvbChannel.NetworkId, dvbChannel.TransportId, dvbChannel.ServiceId); return(null); } //do we know a channel with these tuning details? Channel dbChannel = null; TuningDetail tuningDetail = _layer.GetTuningDetail(dvbChannel); if (tuningDetail != null) { dbChannel = tuningDetail.ReferencedChannel(); } if (dbChannel == null) { Log.Epg("{0}: no channel found for networkid:0x{1:X} transportid:0x{2:X} serviceid:0x{3:X}", _grabberName, dvbChannel.NetworkId, dvbChannel.TransportId, dvbChannel.ServiceId); /*foreach (EpgProgram ei in epgChannel.Programs) * { * string title = ""; * if (ei.Text.Count > 0) * { * title = ei.Text[0].Title; * } * Log.Epg(" -> {0}-{1} {2}", ei.StartTime, ei.EndTime, title); * }*/ return(null); } //should we store epg for this channel? if ((dbChannel.IsRadio && _storeOnlySelectedChannelsRadio) || (!dbChannel.IsRadio && _storeOnlySelectedChannels)) { if (!dbChannel.GrabEpg) { Log.Epg("{0}: channel {1} is not configured to grab epg.", _grabberName, dbChannel.DisplayName); return(null); } } if (_checkForLastUpdate) { //is the regrab time reached? TimeSpan ts = DateTime.Now - dbChannel.LastGrabTime; if (ts.TotalMinutes < _epgReGrabAfter) { Log.Epg("{0}: {1} not needed lastUpdate:{2}", _grabberName, dbChannel.DisplayName, dbChannel.LastGrabTime); return(null); } } return(dbChannel); }
public void UpdateEpgForChannel(EpgChannel epgChannel) { Channel dbChannel = IsInsertAllowed(epgChannel); if (dbChannel == null) { return; } Log.Epg("{0}: {1} lastUpdate:{2}", _grabberName, dbChannel.DisplayName, dbChannel.LastGrabTime); // Store the data in our database ImportPrograms(dbChannel, epgChannel.Programs); // Raise an event with the data so that other plugins can handle the data on their own _epgEvents.OnImportEpgPrograms(epgChannel); }
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."); } } } } }
/// <summary> /// Initializes a new instance of the <see cref="TvServerEventArgs"/> class. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="epgChannel">The epg channel</param> public TvServerEventArgs(TvServerEventType eventType, EpgChannel epgChannel) { _eventType = eventType; _epgChannel = epgChannel; }