public static bool IsChannelMappedToCard(Channel dbChannel, Card card)
    {
      bool isChannelMappedToCard = false;

      IDictionary<int, bool> cardIds;

      bool isChannelFound = _channelMapping.TryGetValue(dbChannel.IdChannel, out cardIds);

      bool channelMappingFound = false;
      if (isChannelFound)
      {
        channelMappingFound = cardIds.TryGetValue(card.IdCard, out isChannelMappedToCard);
      }

      if (!channelMappingFound)
      {
        //check if channel is mapped to this card and that the mapping is not for "Epg Only"        
        isChannelMappedToCard = _businessLayer.IsChannelMappedToCard(dbChannel, card, false);

        if (cardIds == null)
        {
          cardIds = new Dictionary<int, bool>();
        }
        cardIds.Add(card.IdCard, isChannelMappedToCard);
      }

      _channelMapping[dbChannel.IdChannel] = cardIds;
      return isChannelMappedToCard;
    }
示例#2
0
        public override async Task <MediaItem> CreateMediaItem(int slotIndex, string streamUrl, IChannel channel)
        {
            // Channel is usually only passed as placeholder with ID only, so query the details here
            TvDatabase.Channel fullChannel = TvDatabase.Channel.Retrieve(channel.ChannelId);
            bool isTv = fullChannel.IsTv;

            return(await CreateMediaItem(slotIndex, streamUrl, channel, isTv, fullChannel.ToChannel()));
        }
示例#3
0
 public WebChannel(Channel ch)
 {
   this.idChannel = ch.IdChannel;
   this.displayName = ch.DisplayName;
   this.grabEPG = ch.GrabEpg;
   this.isRadio = ch.IsRadio;
   this.isTv = ch.IsTv;
   this.isWebStream = ch.IsWebstream();
 }
示例#4
0
 public WebMiniEPG(Channel ch)
 {
   if (ch == null)
     return;
   this.idChannel = ch.IdChannel;
   this.name = ch.DisplayName;
   this.isWebStream = ch.IsWebstream();
   epgNow = new WebShortProgram(ch.CurrentProgram);
   epgNext=new WebShortProgram(ch.NextProgram);
 }
示例#5
0
        public static TvDatabase.Channel GetChannel(out ChannelMap channelMap)
        {
            channelMap = Isolate.Fake.Instance <ChannelMap>();
            List <ChannelMap> channelMaps = new List <ChannelMap>();

            channelMaps.Add(channelMap);
            TvDatabase.Channel channel = Isolate.Fake.Instance <TvDatabase.Channel>();
            Isolate.WhenCalled(() => channel.DisplayName).WillReturn("Test Channel");
            Isolate.WhenCalled(() => channel.ReferringChannelMap()).WillReturn(channelMaps);
            return(channel);
        }
    public static IList<IChannel> GetTuningDetailsByChannelId(Channel channel)
    {
      IList<IChannel> tuningDetails;
      bool tuningChannelMappingFound = _tuningChannelMapping.TryGetValue(channel.IdChannel, out tuningDetails);

      if (!tuningChannelMappingFound)
      {        
        tuningDetails = _businessLayer.GetTuningChannelsByDbChannel(channel);
        _tuningChannelMapping.Add(channel.IdChannel, tuningDetails);
      }
      return tuningDetails;
    }
示例#7
0
 internal static TvDatabase.Channel GetCurrentTimeShiftingTVChannel()
 {
     if (TVHome.Connected && TVHome.Card.IsTimeShifting)
     {
         int id = TVHome.Card.IdChannel;
         if (id >= 0)
         {
             TvDatabase.Channel current = TvDatabase.Channel.Retrieve(id);
             return(current);
         }
     }
     return(null);
 }
示例#8
0
        private List <TvDatabase.Program> GetPrograms(TvDatabase.Channel channel, DateTime from, DateTime to)
        {
            IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
            SqlBuilder      sb         = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof(TvDatabase.Program));

            sb.AddConstraint(Operator.Equals, "idChannel", channel.IdChannel);
            sb.AddConstraint(String.Format("startTime>='{0}'", from.ToString(GetDateTimeString(), mmddFormat)));
            sb.AddConstraint(String.Format("endTime<='{0}'", to.ToString(GetDateTimeString(), mmddFormat)));
            sb.AddOrderByField(true, "startTime");
            SqlStatement stmt     = sb.GetStatement(true);
            IList        programs = ObjectFactory.GetCollection(typeof(TvDatabase.Program), stmt.Execute());

            return((List <TvDatabase.Program>)programs);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public NowPlayingRadio()
        {
            TvPlugin.TVHome.Navigator.UpdateCurrentChannel();
            TvDatabase.Channel current = TvPlugin.Radio.CurrentChannel;

            if (current != null && current.IsWebstream())
            {
                if (current.ReferringTuningDetail() != null && current.ReferringTuningDetail().Count > 0)
                {
                    IList <TuningDetail> details = current.ReferringTuningDetail();
                    TuningDetail         detail  = details[0];
                    CurrentProgramName = detail.Name;
                    CurrentProgramId   = detail.IdChannel;
                    CurrentUrl         = detail.Url;
                    ChannelName        = GUIPropertyManager.GetProperty("#Play.Current.Album");
                    ArtistName         = GUIPropertyManager.GetProperty("#Play.Current.Artist");
                }
            }
            else if (current != null && !current.IsWebstream())
            {
                ChannelId   = current.IdChannel;
                ChannelName = current.DisplayName;
                ArtistName  = GUIPropertyManager.GetProperty("#Play.Current.Artist");

                if (current.CurrentProgram != null)
                {
                    CurrentProgramId          = current.CurrentProgram.IdProgram;
                    CurrentProgramName        = current.CurrentProgram.Title;
                    CurrentProgramDescription = current.CurrentProgram.Description;
                    CurrentProgramBegin       = current.CurrentProgram.StartTime;
                    CurrentProgramEnd         = current.CurrentProgram.EndTime;
                }

                if (current.NextProgram != null)
                {
                    NextProgramId          = current.NextProgram.IdProgram;
                    NextProgramName        = current.NextProgram.Title;
                    NextProgramDescription = current.NextProgram.Description;
                    NextProgramBegin       = current.NextProgram.StartTime;
                    NextProgramEnd         = current.NextProgram.EndTime;
                }
            }
        }
示例#10
0
        /// <summary>
        /// Play a tv channel
        /// </summary>
        /// <param name="channelId">Id of the channel</param>
        /// <param name="startFullscreen">If true, will switch to fullscreen after playback is started</param>
        public static void PlayTvChannel(int channelId, bool startFullscreen)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                PlayTvChannelDelegate d = PlayTvChannel;
                GUIGraphicsContext.form.Invoke(d, channelId, startFullscreen);
                return;
            }

            if (g_Player.Playing && !g_Player.IsTimeShifting)
            {
                WifiRemote.LogMessage("Stopping current media so we can start playing tv", WifiRemote.LogType.Debug);
                g_Player.Stop();
            }

            //the tv window isn't active and we're not playing tv fullscreen
            //if (GUIWindowManager.ActiveWindow != (int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_TV &&
            if (!g_Player.Playing)
            {
                WifiRemote.LogMessage("Tv Window not active, activating it", WifiRemote.LogType.Debug);
                MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_TV);
            }

            WifiRemote.LogMessage("Start channel " + channelId, WifiRemote.LogType.Debug);
            TvDatabase.Channel channel = TvDatabase.Channel.Retrieve(channelId);
            if (channel != null)
            {
                bool success = TvPlugin.TVHome.ViewChannelAndCheck(channel);
                WifiRemote.LogMessage("Started channel " + channelId + " Success: " + success, WifiRemote.LogType.Info);
                if (startFullscreen && success)
                {
                    WifiRemote.LogMessage("Switching to fullscreen", WifiRemote.LogType.Debug);
                    g_Player.ShowFullScreenWindowTV();
                }
            }
            else
            {
                Log.Warn("Couldn't retrieve channel for id: " + channelId);
            }
        }
示例#11
0
    /// <summary>
    /// constructor
    /// </summary>
    /// <param name="schedule">Schedule of this recording</param>
    /// <param name="channel">Channel on which the recording is done</param>
    /// <param name="endTime">Date/Time the recording should start without pre-record interval</param>
    /// <param name="endTime">Date/Time the recording should stop with post record interval</param>
    /// <param name="isSerie">Is serie recording</param>
    /// 
    /// 
    public RecordingDetail(Schedule schedule, Channel channel, DateTime endTime, bool isSerie)
    {
      _user = UserFactory.CreateSchedulerUser(schedule.IdSchedule);
      /*User.Name = string.Format("scheduler{0}", schedule.IdSchedule);
      User.CardId = -1;
      User.SubChannel = -1;
      User.IsAdmin = true;
      User.Priority = UserFactory.SCHEDULER_PRIORITY;*/

      _schedule = schedule;
      _channel = channel;
      _endTime = endTime;
      _program = null;
      _isSerie = isSerie;

      DateTime startTime = DateTime.MinValue;

      if (isSerie)
      {
        DateTime now = DateTime.Now.AddMinutes(schedule.PreRecordInterval);
        startTime = new DateTime(now.Year, now.Month, now.Day, schedule.StartTime.Hour, schedule.StartTime.Minute, 0);
      }
      else
      {
        startTime = schedule.StartTime;
      }

      _program = schedule.ReferencedChannel().GetProgramAt(startTime);

      //no program? then treat this as a manual recording
      if (_program == null)
      {
        _program = new TvDatabase.Program(0, DateTime.Now, endTime, "manual", "", "",
                                          TvDatabase.Program.ProgramState.None,
                                          System.Data.SqlTypes.SqlDateTime.MinValue.Value, string.Empty, string.Empty,
                                          string.Empty, string.Empty, -1, string.Empty, 0);
      }
    }
示例#12
0
        private List <TvDatabase.Channel> GetChannelsInGroup(int groupId)
        {
            List <TvDatabase.Channel>       refChannels = new List <TvDatabase.Channel>();
            IList <TvDatabase.ChannelGroup> groups      = TvDatabase.ChannelGroup.ListAll();

            foreach (TvDatabase.ChannelGroup group in groups)
            {
                if (group.IdGroup == groupId)
                {
                    IList <GroupMap> maps = group.ReferringGroupMap();
                    foreach (GroupMap map in maps)
                    {
                        TvDatabase.Channel channel = map.ReferencedChannel();
                        if (channel != null)
                        {
                            refChannels.Add(channel);
                        }
                    }
                    break;
                }
            }
            return(refChannels);
        }
 private static void UpdateChannelStateUserBasedOnCardOwnership(ITvCardHandler tvcard, IList<IUser> allUsers,
                                                                Channel ch)
 {
   for (int i = 0; i < allUsers.Count; i++)
   {
     IUser user = allUsers[i];
     if (user.IsAdmin)
     {
       continue;
     }
     if (!tvcard.Users.IsOwner(user))
     {
       //no
       //Log.Info("Controller:    card:{0} type:{1} is tuned to different transponder", cardId, tvcard.Type);
       //allow admin users like the scheduler to use this card anyway          
       UpdateChannelStateUser(user, ChannelState.nottunable, ch.IdChannel);
     }
     else
     {
       UpdateChannelStateUser(user, ChannelState.tunable, ch.IdChannel);
     }
     allUsers[i] = user;
   }
 }
示例#14
0
    protected override void OnPageLoad()
    {
      Log.Info("TVHome:OnPageLoad");

      if (GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow).PreviousWindowId != (int)Window.WINDOW_TVFULLSCREEN)
      {
        _playbackStopped = false;
      }

      btnActiveStreams.Label = GUILocalizeStrings.Get(692);

      if (!Connected)
      {
        RemoteControl.Clear();
        GUIWindowManager.ActivateWindow((int)Window.WINDOW_SETTINGS_TVENGINE);
        UpdateStateOfRecButton();
        UpdateProgressPercentageBar();
        UpdateRecordingIndicator();
        return;
      }

      try
      {
        int cards = RemoteControl.Instance.Cards;
      }
      catch (Exception)
      {
        RemoteControl.Clear();
      }

      // stop the old recorder.
      // DatabaseManager.Instance.DefaultQueryStrategy = QueryStrategy.DataSourceOnly;
      GUIMessage msgStopRecorder = new GUIMessage(GUIMessage.MessageType.GUI_MSG_RECORDER_STOP, 0, 0, 0, 0, 0, null);
      GUIWindowManager.SendMessage(msgStopRecorder);

      if (!_onPageLoadDone && m_navigator != null)
      {
        m_navigator.ReLoad();
        LoadSettings(false);
      }

      if (m_navigator == null)
      {
        m_navigator = new ChannelNavigator(); // Create the channel navigator (it will load groups and channels)
      }

      base.OnPageLoad();

      // set video window position
      if (videoWindow != null)
      {
        GUIGraphicsContext.VideoWindow = new Rectangle(videoWindow.XPosition, videoWindow.YPosition, videoWindow.Width,
                                                       videoWindow.Height);
      }

      // start viewing tv... 
      GUIGraphicsContext.IsFullScreenVideo = false;
      Channel channel = Navigator.Channel;
      if (channel == null || channel.IsRadio)
      {
        if (Navigator.CurrentGroup != null && Navigator.Groups.Count > 0)
        {
          Navigator.SetCurrentGroup(Navigator.Groups[0].GroupName);
          GUIPropertyManager.SetProperty("#TV.Guide.Group", Navigator.Groups[0].GroupName);
        }
        if (Navigator.CurrentGroup != null)
        {
          if (Navigator.CurrentGroup.ReferringGroupMap().Count > 0)
          {
            GroupMap gm = (GroupMap)Navigator.CurrentGroup.ReferringGroupMap()[0];
            channel = gm.ReferencedChannel();
          }
        }
      }

      if (channel != null)
      {
        Log.Info("tv home init:{0}", channel.DisplayName);
        if (!_suspended)
        {
          AutoTurnOnTv(channel);
        }
        else
        {
          _resumeChannel = channel;
        }
        GUIPropertyManager.SetProperty("#TV.Guide.Group", Navigator.CurrentGroup.GroupName);
        Log.Info("tv home init:{0} done", channel.DisplayName);
      }

      if (!_suspended)
      {
        AutoFullScreenTv();
      }

      _onPageLoadDone = true;
      _suspended = false;

      UpdateGUIonPlaybackStateChange();
      UpdateCurrentChannel();
    }
示例#15
0
    public TuningDetail AddTuningDetails(Channel channel, IChannel tvChannel)
    {
      string channelName = "";
      long channelFrequency = 0;
      int channelNumber = 0;
      int country = 31;
      bool isRadio = false;
      bool isTv = false;
      int tunerSource = 0;
      int videoInputType = 0;
      int audioInputType = 0;
      bool isVCRSignal = false;
      int symbolRate = 0;
      int modulation = 0;
      int polarisation = 0;
      int switchFrequency = 0;
      int diseqc = 0;
      int bandwidth = 8;
      bool freeToAir = true;
      int pmtPid = -1;
      int networkId = -1;
      int serviceId = -1;
      int transportId = -1;
      int minorChannel = -1;
      int majorChannel = -1;
      string provider = "";
      int channelType = 0;
      int band = 0;
      int satIndex = -1;
      int innerFecRate = (int)BinaryConvolutionCodeRate.RateNotSet;
      int pilot = (int)Pilot.NotSet;
      int rollOff = (int)RollOff.NotSet;
      string url = "";

      AnalogChannel analogChannel = tvChannel as AnalogChannel;
      if (analogChannel != null)
      {
        channelName = analogChannel.Name;
        channelFrequency = analogChannel.Frequency;
        channelNumber = analogChannel.ChannelNumber;
        country = analogChannel.Country.Index;
        isRadio = analogChannel.IsRadio;
        isTv = analogChannel.IsTv;
        tunerSource = (int)analogChannel.TunerSource;
        videoInputType = (int)analogChannel.VideoSource;
        audioInputType = (int)analogChannel.AudioSource;
        isVCRSignal = analogChannel.IsVCRSignal;
        channelType = 0;
      }

      ATSCChannel atscChannel = tvChannel as ATSCChannel;
      if (atscChannel != null)
      {
        majorChannel = atscChannel.MajorChannel;
        minorChannel = atscChannel.MinorChannel;
        channelNumber = atscChannel.PhysicalChannel;
        //videoPid = atscChannel.VideoPid;
        //audioPid = atscChannel.AudioPid;
        modulation = (int)atscChannel.ModulationType;
        channelType = 1;
      }

      DVBCChannel dvbcChannel = tvChannel as DVBCChannel;
      if (dvbcChannel != null)
      {
        symbolRate = dvbcChannel.SymbolRate;
        modulation = (int)dvbcChannel.ModulationType;
        channelNumber = dvbcChannel.LogicalChannelNumber;
        channelType = 2;
      }

      DVBSChannel dvbsChannel = tvChannel as DVBSChannel;
      if (dvbsChannel != null)
      {
        symbolRate = dvbsChannel.SymbolRate;
        polarisation = (int)dvbsChannel.Polarisation;
        switchFrequency = dvbsChannel.SwitchingFrequency;
        diseqc = (int)dvbsChannel.DisEqc;
        band = (int)dvbsChannel.BandType;
        satIndex = dvbsChannel.SatelliteIndex;
        modulation = (int)dvbsChannel.ModulationType;
        innerFecRate = (int)dvbsChannel.InnerFecRate;
        pilot = (int)dvbsChannel.Pilot;
        rollOff = (int)dvbsChannel.Rolloff;
        channelNumber = dvbsChannel.LogicalChannelNumber;
        channelType = 3;
      }

      DVBTChannel dvbtChannel = tvChannel as DVBTChannel;
      if (dvbtChannel != null)
      {
        bandwidth = dvbtChannel.BandWidth;
        channelNumber = dvbtChannel.LogicalChannelNumber;
        channelType = 4;
      }

      DVBIPChannel dvbipChannel = tvChannel as DVBIPChannel;
      if (dvbipChannel != null)
      {
        url = dvbipChannel.Url;
        channelNumber = dvbipChannel.LogicalChannelNumber;
        channelType = 7;
      }

      DVBBaseChannel dvbChannel = tvChannel as DVBBaseChannel;
      if (dvbChannel != null)
      {
        pmtPid = dvbChannel.PmtPid;
        networkId = dvbChannel.NetworkId;
        serviceId = dvbChannel.ServiceId;
        transportId = dvbChannel.TransportId;
        channelName = dvbChannel.Name;
        provider = dvbChannel.Provider;
        channelFrequency = dvbChannel.Frequency;
        isRadio = dvbChannel.IsRadio;
        isTv = dvbChannel.IsTv;
        freeToAir = dvbChannel.FreeToAir;
      }

      TuningDetail detail = new TuningDetail(channel.IdChannel, channelName, provider,
                                             channelType, channelNumber, (int)channelFrequency, country, isRadio, isTv,
                                             networkId, transportId, serviceId, pmtPid, freeToAir,
                                             modulation, polarisation, symbolRate, diseqc, switchFrequency,
                                             bandwidth, majorChannel, minorChannel, videoInputType,
                                             audioInputType, isVCRSignal, tunerSource, band,
                                             satIndex,
                                             innerFecRate, pilot, rollOff, url, 0);
      detail.Persist();
      return detail;
    }
示例#16
0
 public List<IChannel> GetTuningChannelsByDbChannel(Channel channel)
 {
   List<IChannel> tvChannels = new List<IChannel>();
   IList<TuningDetail> tuningDetails = channel.ReferringTuningDetail();
   for (int i = 0; i < tuningDetails.Count; ++i)
   {
     TuningDetail detail = tuningDetails[i];
     tvChannels.Add(GetTuningChannel(detail));
   }
   return tvChannels;
 }
示例#17
0
    public IList<Program> GetPrograms(Channel channel, DateTime startTime)
    {
      //The DateTime.MinValue is lower than the min datetime value of the database
      if (startTime == DateTime.MinValue)
      {
        startTime = startTime.AddYears(1900);
      }
      IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));

      sb.AddConstraint(Operator.Equals, "idChannel", channel.IdChannel);
      sb.AddConstraint(String.Format("startTime>='{0}'", startTime.ToString(GetDateTimeString(), mmddFormat)));
      sb.AddOrderByField(true, "startTime");

      SqlStatement stmt = sb.GetStatement(true);
      return ObjectFactory.GetCollection<Program>(stmt.Execute());
    }
示例#18
0
 public TuningDetail AddWebStreamTuningDetails(Channel channel, string url, int bitrate)
 {
   string channelName = channel.DisplayName;
   const long channelFrequency = 0;
   const int channelNumber = 0;
   const int country = 31;
   bool isRadio = channel.IsRadio;
   bool isTv = channel.IsTv;
   const int tunerSource = 0;
   const int videoInputType = 0;
   const int audioInputType = 0;
   const bool isVCRSignal = false;
   const int symbolRate = 0;
   const int modulation = 0;
   const int polarisation = 0;
   const int switchFrequency = 0;
   const int diseqc = 0;
   const int bandwidth = 8;
   const bool freeToAir = true;
   const int pmtPid = -1;
   const int networkId = -1;
   const int serviceId = -1;
   const int transportId = -1;
   const int minorChannel = -1;
   const int majorChannel = -1;
   const string provider = "";
   const int channelType = 5;
   const int band = 0;
   const int satIndex = -1;
   const int innerFecRate = (int)BinaryConvolutionCodeRate.RateNotSet;
   const int pilot = (int)Pilot.NotSet;
   const int rollOff = (int)RollOff.NotSet;
   if (url == null)
   {
     url = "";
   }
   TuningDetail detail = new TuningDetail(channel.IdChannel, channelName, provider,
                                          channelType, channelNumber, (int)channelFrequency, country, isRadio, isTv,
                                          networkId, transportId, serviceId, pmtPid, freeToAir,
                                          modulation, polarisation, symbolRate, diseqc, switchFrequency,
                                          bandwidth, majorChannel, minorChannel, videoInputType,
                                          audioInputType, isVCRSignal, tunerSource, band,
                                          satIndex,
                                          innerFecRate, pilot, rollOff, url, bitrate);
   detail.Persist();
   return detail;
 }
示例#19
0
 public IList<Program> SearchMinimalPrograms(DateTime startTime, DateTime endTime, string programName,
                                             Channel channel)
 {
   return channel != null
            ? GetProgramsByTitle(channel, startTime, endTime, programName)
            : GetProgramsByTitle(startTime, endTime, programName);
 }
示例#20
0
        /// <summary>
        /// Play a radio channel
        /// </summary>
        /// <param name="channelId">Id of the channel</param>
        public static void PlayRadioChannel(int channelId)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                PlayRadioChannelDelegate d = PlayRadioChannel;
                GUIGraphicsContext.form.Invoke(d, channelId);
                return;
            }

            WifiRemote.LogMessage("Start radio channel " + channelId, WifiRemote.LogType.Debug);
            TvDatabase.Channel channel = TvDatabase.Channel.Retrieve(channelId);

            if (channel != null)
            {
                if (GUIWindowManager.ActiveWindow != (int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_RADIO)
                {
                    WifiRemote.LogMessage("Radio Window not active, activating it", WifiRemote.LogType.Debug);
                    MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_RADIO);
                }

                GUIPropertyManager.RemovePlayerProperties();
                GUIPropertyManager.SetProperty("#Play.Current.ArtistThumb", channel.DisplayName);
                GUIPropertyManager.SetProperty("#Play.Current.Album", channel.DisplayName);
                GUIPropertyManager.SetProperty("#Play.Current.Title", channel.DisplayName);

                GUIPropertyManager.SetProperty("#Play.Current.Title", channel.DisplayName);
                string strLogo = Utils.GetCoverArt(Thumbs.Radio, channel.DisplayName);
                if (string.IsNullOrEmpty(strLogo))
                {
                    strLogo = "defaultMyRadioBig.png";
                }
                GUIPropertyManager.SetProperty("#Play.Current.Thumb", strLogo);

                if (g_Player.Playing && !channel.IsWebstream())
                {
                    if (!g_Player.IsTimeShifting || (g_Player.IsTimeShifting && channel.IsWebstream()))
                    {
                        WifiRemote.LogMessage("Stopping current media so we can start playing radio", WifiRemote.LogType.Debug);
                        g_Player.Stop();
                    }
                }
                bool success = false;
                if (channel.IsWebstream())
                {
                    IList <TuningDetail> details = channel.ReferringTuningDetail();
                    TuningDetail         detail  = details[0];
                    WifiRemote.LogMessage("Play webStream:" + detail.Name + ", url:" + detail.Url, WifiRemote.LogType.Debug);
                    success = g_Player.PlayAudioStream(detail.Url);
                    GUIPropertyManager.SetProperty("#Play.Current.Title", channel.DisplayName);
                }
                else
                {
                    // TV card radio channel
                    WifiRemote.LogMessage("Play TV card radio channel", WifiRemote.LogType.Debug);
                    //Check if same channel is alrady playing
                    if (g_Player.IsRadio && g_Player.Playing)
                    {
                        Channel currentlyPlaying = TvPlugin.TVHome.Navigator.Channel;
                        if (currentlyPlaying != null && currentlyPlaying.IdChannel == channel.IdChannel)
                        {
                            WifiRemote.LogMessage("Already playing TV card radio channel with id:" + channel.IdChannel + ", do not tune again", WifiRemote.LogType.Debug);
                        }
                        else
                        {
                            success = TvPlugin.TVHome.ViewChannelAndCheck(channel);
                        }
                    }
                    else
                    {
                        success = TvPlugin.TVHome.ViewChannelAndCheck(channel);
                    }
                }
                WifiRemote.LogMessage("Started radio channel " + channelId + " Success: " + success, WifiRemote.LogType.Debug);
            }
            else
            {
                Log.Warn("Couldn't retrieve radio channel for id: " + channelId);
            }
        }
示例#21
0
 private void AutoTurnOnTv(Channel channel)
 {
   if (_autoTurnOnTv && !_playbackStopped && !wasPrevWinTVplugin())
   {
     if (!wasPrevWinTVplugin())
     {
       _userChannelChanged = false;
     }
     ViewChannelAndCheck(channel);
   }
 }
示例#22
0
    public static void StartRecordingSchedule(Channel channel, bool manual)
    {
      TvBusinessLayer layer = new TvBusinessLayer();
      TvServer server = new TvServer();
      if (manual) // until manual stop
      {
        Schedule newSchedule = new Schedule(channel.IdChannel,
                                            GUILocalizeStrings.Get(413) + " (" + channel.DisplayName + ")",
                                            DateTime.Now, DateTime.Now.AddDays(1));
        newSchedule.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
        newSchedule.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
        newSchedule.Persist();
        server.OnNewSchedule();
      }
      else // current program
      {
        // lets find any canceled episodes that match this one we want to create, if found uncancel it.
        Schedule existingParentSchedule = Schedule.RetrieveSeries(channel.IdChannel, channel.CurrentProgram.Title,
                                                                  channel.CurrentProgram.StartTime,
                                                                  channel.CurrentProgram.EndTime);
        if (existingParentSchedule != null)
        {
          foreach (CanceledSchedule cancelSched in existingParentSchedule.ReferringCanceledSchedule())
          {
            if (cancelSched.CancelDateTime == channel.CurrentProgram.StartTime)
            {
              existingParentSchedule.UnCancelSerie(channel.CurrentProgram.StartTime, channel.CurrentProgram.IdChannel);
              server.OnNewSchedule();
              return;
            }
          }
        }

        // ok, no existing schedule found with matching canceled schedules found. proceeding to add the schedule normally
        Schedule newSchedule = new Schedule(channel.IdChannel, channel.CurrentProgram.Title,
                                            channel.CurrentProgram.StartTime, channel.CurrentProgram.EndTime);
        newSchedule.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
        newSchedule.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);        
        newSchedule.Persist();
        server.OnNewSchedule();
      }
      GUIMessage msgManualRecord = new GUIMessage(GUIMessage.MessageType.GUI_MSG_MANUAL_RECORDING_STARTED, 0, 0, 0, 0, 0, null);
      GUIWindowManager.SendMessage(msgManualRecord);
    }
示例#23
0
 public void AddChannelToGroup(Channel channel, string groupName)
 {
   bool found = false;
   ChannelGroup group = CreateGroup(groupName);
   IList<GroupMap> groupMaps = group.ReferringGroupMap();
   foreach (GroupMap map in groupMaps)
   {
     if (map.IdChannel == channel.IdChannel)
     {
       found = true;
       break;
     }
   }
   if (!found)
   {
     GroupMap map = new GroupMap(group.IdGroup, channel.IdChannel, channel.SortOrder);
     map.Persist();
   }
 }
示例#24
0
 public IList<ChannelLinkageMap> GetLinkagesForChannel(Channel channel)
 {
   IList<ChannelLinkageMap> pmap = channel.ReferringLinkedChannels();
   if (pmap != null)
   {
     if (pmap.Count > 0)
       return pmap;
   }
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (ChannelLinkageMap));
   sb.AddConstraint(Operator.Equals, "idLinkedChannel", channel.IdChannel);
   SqlStatement stmt = sb.GetStatement(true);
   return ObjectFactory.GetCollection<ChannelLinkageMap>(stmt.Execute());
 }
示例#25
0
 public void AddChannelToRadioGroup(Channel channel, RadioChannelGroup group)
 {
   bool found = false;
   IList<RadioGroupMap> groupMaps = group.ReferringRadioGroupMap();
   foreach (RadioGroupMap map in groupMaps)
   {
     if (map.IdChannel == channel.IdChannel)
     {
       found = true;
       break;
     }
   }
   if (!found)
   {
     RadioGroupMap map = new RadioGroupMap(group.IdGroup, channel.IdChannel, channel.SortOrder);
     map.Persist();
   }
 }
示例#26
0
    public IList<Program> GetProgramsByTitle(Channel channel, DateTime startTime, DateTime endTime, string title)
    {
      IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));

      string sub1 = String.Format("(EndTime > '{0}' and EndTime < '{1}')",
                                  startTime.ToString(GetDateTimeString(), mmddFormat),
                                  endTime.ToString(GetDateTimeString(), mmddFormat));
      string sub2 = String.Format("(StartTime >= '{0}' and StartTime <= '{1}')",
                                  startTime.ToString(GetDateTimeString(), mmddFormat),
                                  endTime.ToString(GetDateTimeString(), mmddFormat));
      string sub3 = String.Format("(StartTime <= '{0}' and EndTime >= '{1}')",
                                  startTime.ToString(GetDateTimeString(), mmddFormat),
                                  endTime.ToString(GetDateTimeString(), mmddFormat));

      sb.AddConstraint(Operator.Equals, "idChannel", channel.IdChannel);
      sb.AddConstraint(string.Format("({0} or {1} or {2}) ", sub1, sub2, sub3));
      sb.AddConstraint(Operator.Equals, "title", title);
      sb.AddOrderByField(true, "starttime");

      SqlStatement stmt = sb.GetStatement(true);
      return ObjectFactory.GetCollection<Program>(stmt.Execute());
    }
示例#27
0
 public bool IsChannelMappedToCard(Channel dbChannel, Card card, bool forEpg)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (ChannelMap));
   SqlStatement origStmt = sb.GetStatement(true);
   string sql = "select cm.* from ChannelMap cm where cm.idChannel =" +
                dbChannel.IdChannel + " and cm.idCard=" + card.IdCard + (forEpg ? "" : " and cm.epgOnly=0");
   SqlStatement statement = new SqlStatement(StatementType.Select, origStmt.Command, sql,
                                             typeof (Channel));
   IList<ChannelMap> maps = ObjectFactory.GetCollection<ChannelMap>(statement.Execute());
   return maps != null && maps.Count > 0;
 }
示例#28
0
 // This is really needed
 public Channel AddNewChannel(string name, int channelNumber)
 {
   Channel newChannel = new Channel(false, false, 0, new DateTime(2000, 1, 1), false, new DateTime(2000, 1, 1),
                                    -1, true, "", name, channelNumber);
   return newChannel;
 }
示例#29
0
    private static void UpdateNextEpgProperties(Channel ch)
    {
      Program next = null;
      if (ch == null)
      {
        Log.Debug("UpdateNextEpgProperties: no channel, returning");
      }
      else
      {
        next = ch.NextProgram;
        if (next == null)
        {
          Log.Debug("UpdateNextEpgProperties: no EPG data, returning");
        }
      }

      if (next != null)
      {
        GUIPropertyManager.SetProperty("#TV.Next.title", next.Title);
        GUIPropertyManager.SetProperty("#TV.Next.compositetitle", TVUtil.GetDisplayTitle(next));
        GUIPropertyManager.SetProperty("#TV.Next.start",
                                               next.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
        GUIPropertyManager.SetProperty("#TV.Next.stop",
                                       next.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
        GUIPropertyManager.SetProperty("#TV.Next.description", next.Description);
        GUIPropertyManager.SetProperty("#TV.Next.subtitle", next.EpisodeName);
        GUIPropertyManager.SetProperty("#TV.Next.episode", next.EpisodeNumber);
        GUIPropertyManager.SetProperty("#TV.Next.genre", next.Genre);
        GUIPropertyManager.SetProperty("#TV.Next.remaining", Utils.SecondsToHMSString(next.EndTime - next.StartTime));
      }
      else
      {
        GUIPropertyManager.SetProperty("#TV.Next.title", GUILocalizeStrings.Get(736));          // no epg for this channel
        GUIPropertyManager.SetProperty("#TV.Next.compositetitle", GUILocalizeStrings.Get(736)); // no epg for this channel
        GUIPropertyManager.SetProperty("#TV.Next.start", String.Empty);
        GUIPropertyManager.SetProperty("#TV.Next.stop", String.Empty);
        GUIPropertyManager.SetProperty("#TV.Next.description", String.Empty);
        GUIPropertyManager.SetProperty("#TV.Next.subtitle", String.Empty);
        GUIPropertyManager.SetProperty("#TV.Next.episode", String.Empty);
        GUIPropertyManager.SetProperty("#TV.Next.genre", String.Empty);
      }
    }
示例#30
0
    /// <summary>
    /// Add a radio channel to radio group by name
    /// </summary>
    /// <param name="channel">channel to add</param>
    /// <param name="groupName">target group name</param>
    public void AddChannelToRadioGroup(Channel channel, string groupName)
    {
      RadioChannelGroup currentRadioGroup = null;
      IList<RadioChannelGroup> allRadioGroups = RadioChannelGroup.ListAll();

      // check for existing group
      foreach (RadioChannelGroup radioGroup in allRadioGroups)
      {
        if (radioGroup.GroupName == groupName)
        {
          currentRadioGroup = radioGroup;
          break;
        }
      }
      // no group found yet? then create new one
      if (currentRadioGroup == null)
      {
        currentRadioGroup = new RadioChannelGroup(groupName, allRadioGroups.Count);
        currentRadioGroup.Persist();
      }
      // add channel to group
      AddChannelToRadioGroup(channel, currentRadioGroup);
    }
示例#31
0
    private static void ChannelTuneFailedNotifyUser(TvResult succeeded, bool wasPlaying, Channel channel)
    {
      GUIGraphicsContext.RenderBlackImage = false;

      _lastError.Result = succeeded;
      _lastError.FailingChannel = channel;
      _lastError.Messages.Clear();

      int TextID = 0;
      _lastError.Messages.Add(GUILocalizeStrings.Get(1500));
      switch (succeeded)
      {
        case TvResult.NoPmtFound:
          TextID = 1498;
          break;
        case TvResult.NoSignalDetected:
          TextID = 1499;
          break;
        case TvResult.CardIsDisabled:
          TextID = 1501;
          break;
        case TvResult.AllCardsBusy:
          TextID = 1502;
          break;
        case TvResult.ChannelIsScrambled:
          TextID = 1503;
          break;
        case TvResult.NoVideoAudioDetected:
          TextID = 1504;
          break;
        case TvResult.UnableToStartGraph:
          TextID = 1505;
          break;
        case TvResult.TuneCancelled:
          TextID = 1524;
          break;
        case TvResult.UnknownError:
          // this error can also happen if we have no connection to the server.
          if (!Connected) // || !IsRemotingConnected())
          {
            TextID = 1510;
          }
          else
          {
            TextID = 1506;
          }
          break;
        case TvResult.UnknownChannel:
          TextID = 1507;
          break;
        case TvResult.ChannelNotMappedToAnyCard:
          TextID = 1508;
          break;
        case TvResult.NoTuningDetails:
          TextID = 1509;
          break;
        case TvResult.GraphBuildingFailed:
          TextID = 1518;
          break;
        case TvResult.SWEncoderMissing:
          TextID = 1519;
          break;
        case TvResult.NoFreeDiskSpace:
          TextID = 1520;
          break;
        default:
          // this error can also happen if we have no connection to the server.
          if (!Connected) // || !IsRemotingConnected())
          {
            TextID = 1510;
          }
          else
          {
            TextID = 1506;
          }
          break;
      }

      if (TextID != 0)
      {
        _lastError.Messages.Add(GUILocalizeStrings.Get(TextID));
      }

      GUIDialogNotify pDlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY);
      string caption = GUILocalizeStrings.Get(605) + " - " + _lastError.FailingChannel.DisplayName;
      pDlgNotify.SetHeading(caption); //my tv
      pDlgNotify.SetImage(TVUtil.GetChannelLogo(_lastError.FailingChannel));
      StringBuilder sbMessage = new StringBuilder();
      // ignore the "unable to start timeshift" line to avoid scrolling, because NotifyDLG has very few space available.
      for (int idx = 1; idx < _lastError.Messages.Count; idx++)
      {
        sbMessage.AppendFormat("\n{0}", _lastError.Messages[idx]);
      }
      pDlgNotify.SetText(sbMessage.ToString());

      // Fullscreen shows the TVZapOSD to handle error messages
      if (GUIWindowManager.ActiveWindow == (int)(int)Window.WINDOW_TVFULLSCREEN)
      {
        // If failed and wasPlaying TV, left screen as it is and show osd with error message 
        Log.Info("send message to fullscreen tv");
        GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_TV_ERROR_NOTIFY, GUIWindowManager.ActiveWindow, 0,
                                        0, 0, 0,
                                        null);
        msg.SendToTargetWindow = true;
        msg.TargetWindowId = (int)(int)Window.WINDOW_TVFULLSCREEN;
        msg.Object = _lastError; // forward error info object
        msg.Param1 = 3; // sec timeout
        GUIGraphicsContext.SendMessage(msg);
        return;
      }
      else
      {
        // show notify dialog 
        pDlgNotify.DoModal((int)GUIWindowManager.ActiveWindowEx);
      }
    }
示例#32
0
 public void DeleteChannel(Channel channel)
 {
   channel.Remove();
 }
示例#33
0
    /// <summary>
    /// Pre-tune checks "outsourced" to reduce code complexity
    /// </summary>
    /// <param name="channel">the channel to tune</param>
    /// <param name="doContinue">indicate to continue</param>
    /// <returns>return value when not continuing</returns>
    private static bool PreTuneChecks(Channel channel, out bool doContinue)
    {
      doContinue = false;
      if (_suspended && _waitonresume > 0)
      {
        Log.Info("TVHome.ViewChannelAndCheck(): system just woke up...waiting {0} ms., suspended {2}", _waitonresume,
                 _suspended);
        Thread.Sleep(_waitonresume);
      }

      _waitForVideoReceived.Reset();

      if (channel == null)
      {
        Log.Info("TVHome.ViewChannelAndCheck(): channel==null");
        return false;
      }
      Log.Info("TVHome.ViewChannelAndCheck(): View channel={0}", channel.DisplayName);

      //if a channel is untunable, then there is no reason to carry on or even stop playback.   
      var userCopy = Card.User.Clone() as IUser;
      if (userCopy != null) 
      {
        userCopy.Name = Dns.GetHostName();
        ChannelState CurrentChanState = TvServer.GetChannelState(channel.IdChannel, userCopy);
        if (CurrentChanState == ChannelState.nottunable)
        {
          ChannelTuneFailedNotifyUser(TvResult.AllCardsBusy, false, channel);
          return false;
        }
      }      

      //BAV: fixing mantis bug 1263: TV starts with no video if Radio is previously ON & channel selected from TV guide
      if ((!channel.IsRadio && g_Player.IsRadio) || (channel.IsRadio && !g_Player.IsRadio))
      {
        Log.Info("TVHome.ViewChannelAndCheck(): Stop g_Player");
        g_Player.Stop(true);
      }
      // do we stop the player when changing channel ?
      // _userChannelChanged is true if user did interactively change the channel, like with mini ch. list. etc.
      if (!_userChannelChanged)
      {
        if (g_Player.IsTVRecording)
        {
          return true;
        }
        if (!_autoTurnOnTv) //respect the autoturnontv setting.
        {
          if (g_Player.IsVideo || g_Player.IsDVD || g_Player.IsMusic)
          {
            return true;
          }
        }
        else
        {
          if (g_Player.IsVideo || g_Player.IsDVD || g_Player.IsMusic || g_Player.IsCDA) // || g_Player.IsRadio)
          {
            g_Player.Stop(true); // tell that we are zapping so exclusive mode is not going to be disabled
          }
        }
      }
      else if (g_Player.IsTVRecording && _userChannelChanged)
      //we are watching a recording, we have now issued a ch. change..stop the player.
      {
        _userChannelChanged = false;
        g_Player.Stop(true);
      }
      else if ((channel.IsTv && g_Player.IsRadio) || (channel.IsRadio && g_Player.IsTV) || g_Player.IsCDA ||
               g_Player.IsMusic || g_Player.IsVideo)
      {
        g_Player.Stop(true);
      }

      if (Card != null)
      {
        if (g_Player.Playing && g_Player.IsTV && !g_Player.IsTVRecording)
        //modified by joboehl. Avoids other video being played instead of TV. 
        {
          //if we're already watching this channel, then simply return
          if (Card.IsTimeShifting == true && Card.IdChannel == channel.IdChannel)
          {
            return true;
          }
        }
      }

      // if all checks passed then we won't return
      doContinue = true;
      return true; // will be ignored
    }
示例#34
0
 public IChannel GetTuningChannelByType(Channel channel, int channelType)
 {
   IList<TuningDetail> tuningDetails = channel.ReferringTuningDetail();
   for (int i = 0; i < tuningDetails.Count; ++i)
   {
     TuningDetail detail = tuningDetails[i];
     if (detail.ChannelType != channelType)
     {
       continue;
     }
     return GetTuningChannel(detail);
   }
   return null;
 }
示例#35
0
    /// <summary>
    /// Tunes to a new channel
    /// </summary>
    /// <param name="channel"></param>
    /// <returns></returns>
    public static bool ViewChannelAndCheck(Channel channel)
    {
      bool checkResult;
      bool doContinue;

      if (!Connected)
      {
        return false;
      }

      _status.Clear();

      _doingChannelChange = false;

      try
      {
        checkResult = PreTuneChecks(channel, out doContinue);
        if (doContinue == false)
          return checkResult;

        _doingChannelChange = true;
        TvResult succeeded;


        IUser user = new User();
        if (Card != null)
        {
          user.CardId = Card.Id;
        }

        if ((g_Player.Playing && g_Player.IsTimeShifting && !g_Player.Stopped) && (g_Player.IsTV || g_Player.IsRadio))
        {
          _status.Set(LiveTvStatus.WasPlaying);
        }

        //Start timeshifting the new tv channel
        TvServer server = new TvServer();
        VirtualCard card;
        int newCardId = -1;

        // check which card will be used
        newCardId = server.TimeShiftingWouldUseCard(ref user, channel.IdChannel);

        //Added by joboehl - If any major related to the timeshifting changed during the start, restart the player.           
        if (newCardId != -1 && Card.Id != newCardId)
        {
          _status.Set(LiveTvStatus.CardChange);
          RegisterCiMenu(newCardId);
        }

        // we need to stop player HERE if card has changed.        
        if (_status.AllSet(LiveTvStatus.WasPlaying | LiveTvStatus.CardChange))
        {
          Log.Debug("TVHome.ViewChannelAndCheck(): Stopping player. CardId:{0}/{1}, RTSP:{2}", Card.Id, newCardId,
                    Card.RTSPUrl);
          Log.Debug("TVHome.ViewChannelAndCheck(): Stopping player. Timeshifting:{0}", Card.TimeShiftFileName);
          Log.Debug("TVHome.ViewChannelAndCheck(): rebuilding graph (card changed) - timeshifting continueing.");
        }
        if (_status.IsSet(LiveTvStatus.WasPlaying))
        {
          RenderBlackImage();
          g_Player.PauseGraph();
        }
        else
        {
          // if CI menu is not attached due to card change, do it if graph was not playing 
          // (some handlers use polling threads that get stopped on graph stop)
          if (_status.IsNotSet(LiveTvStatus.CardChange))
            RegisterCiMenu(newCardId);
        }

        // if card was not changed
        if (_status.IsNotSet(LiveTvStatus.CardChange))
        {
          g_Player.OnZapping(0x80); // Setup Zapping for TsReader, requesting new PAT from stream
        }
        bool cardChanged = false;
        succeeded = server.StartTimeShifting(ref user, channel.IdChannel, out card, out cardChanged);

        if (_status.IsSet(LiveTvStatus.WasPlaying))
        {
          if (card != null)
            g_Player.OnZapping((int)card.Type);
          else
            g_Player.OnZapping(-1);
        }


        if (succeeded != TvResult.Succeeded)
        {
          //timeshifting new channel failed. 
          g_Player.Stop();

          // ensure right channel name, even if not watchable:Navigator.Channel = channel; 
          ChannelTuneFailedNotifyUser(succeeded, _status.IsSet(LiveTvStatus.WasPlaying), channel);

          _doingChannelChange = true; // keep fullscreen false;
          return true; // "success"
        }

        if (card != null && card.NrOfOtherUsersTimeshiftingOnCard > 0)
        {
          _status.Set(LiveTvStatus.SeekToEndAfterPlayback);
        }

        if (cardChanged)
        {
          _status.Set(LiveTvStatus.CardChange);
          if (card != null)
          {
            RegisterCiMenu(card.Id);
          }
          _status.Reset(LiveTvStatus.WasPlaying);
        }
        else
        {
          _status.Reset(LiveTvStatus.CardChange);
          _status.Set(LiveTvStatus.SeekToEnd);
        }

        // Update channel navigator
        if (Navigator.Channel != null &&
            (channel.IdChannel != Navigator.Channel.IdChannel || (Navigator.LastViewedChannel == null)))
        {
          Navigator.LastViewedChannel = Navigator.Channel;
        }
        Log.Info("succeeded:{0} {1}", succeeded, card);
        Card = card; //Moved by joboehl - Only touch the card if starttimeshifting succeeded. 

        // if needed seek to end
        if (_status.IsSet(LiveTvStatus.SeekToEnd))
        {
          SeekToEnd(true);
        }

        // continue graph
        g_Player.ContinueGraph();
        if (!g_Player.Playing || _status.IsSet(LiveTvStatus.CardChange) || (g_Player.Playing && !(g_Player.IsTV || g_Player.IsRadio)))
        {
          StartPlay();

          // if needed seek to end
          if (_status.IsSet(LiveTvStatus.SeekToEndAfterPlayback))
          {
            double dTime = g_Player.Duration - 5;
            g_Player.SeekAbsolute(dTime);
          }
        }

        _playbackStopped = false;
        _doingChannelChange = false;
        _ServerNotConnectedHandled = false;
        return true;
      }
      catch (Exception ex)
      {
        Log.Debug("TvPlugin:ViewChannelandCheckV2 Exception {0}", ex.ToString());
        _doingChannelChange = false;
        Card.User.Name = new User().Name;
        g_Player.Stop();
        Card.StopTimeShifting();
        return false;
      }
      finally
      {
        StopRenderBlackImage();        
        _userChannelChanged = false;
        FireOnChannelChangedEvent();
        Navigator.UpdateCurrentChannel();
      }
    }
示例#36
0
 public ChannelMap MapChannelToCard(Card card, Channel channel, bool epgOnly)
 {
   IList<ChannelMap> channelMaps = card.ReferringChannelMap();
   for (int i = 0; i < channelMaps.Count; ++i)
   {
     ChannelMap map = channelMaps[i];
     if (map.IdChannel == channel.IdChannel && map.IdCard == card.IdCard)
     {
       return map;
     }
   }
   ChannelMap newMap = new ChannelMap(channel.IdChannel, card.IdCard, epgOnly);
   newMap.Persist();
   return newMap;
 }
示例#37
0
 public static void ViewChannel(Channel channel)
 {
   ViewChannelAndCheck(channel);      
   UpdateProgressPercentageBar();
   return;
 }
示例#38
0
    public TuningDetail UpdateTuningDetails(Channel channel, IChannel tvChannel, TuningDetail detail)
    {
      string channelName = "";
      long channelFrequency = 0;
      int channelNumber = 0;
      int country = 31;
      bool isRadio = false;
      bool isTv = false;
      int tunerSource = 0;
      int videoInputType = 0;
      int audioInputType = 0;
      bool isVCRSignal = false;
      int symbolRate = 0;
      int modulation = 0;
      int polarisation = 0;
      int switchFrequency = 0;
      int diseqc = 0;
      int bandwidth = 8;
      bool freeToAir = true;
      int pmtPid = -1;
      int networkId = -1;
      int serviceId = -1;
      int transportId = -1;
      int minorChannel = -1;
      int majorChannel = -1;
      string provider = "";
      int channelType = 0;
      int band = 0;
      int satIndex = -1;
      int innerFecRate = (int)BinaryConvolutionCodeRate.RateNotSet;
      int pilot = (int)Pilot.NotSet;
      int rollOff = (int)RollOff.NotSet;
      string url = "";

      AnalogChannel analogChannel = tvChannel as AnalogChannel;
      if (analogChannel != null)
      {
        channelName = analogChannel.Name;
        channelFrequency = analogChannel.Frequency;
        channelNumber = analogChannel.ChannelNumber;
        country = analogChannel.Country.Index;
        isRadio = analogChannel.IsRadio;
        isTv = analogChannel.IsTv;
        tunerSource = (int)analogChannel.TunerSource;
        videoInputType = (int)analogChannel.VideoSource;
        audioInputType = (int)analogChannel.AudioSource;
        isVCRSignal = analogChannel.IsVCRSignal;
        channelType = 0;
      }
      ATSCChannel atscChannel = tvChannel as ATSCChannel;
      if (atscChannel != null)
      {
        majorChannel = atscChannel.MajorChannel;
        minorChannel = atscChannel.MinorChannel;
        channelNumber = atscChannel.PhysicalChannel;
        //videoPid = atscChannel.VideoPid;
        //audioPid = atscChannel.AudioPid;
        modulation = (int)atscChannel.ModulationType;
        channelType = 1;
      }

      DVBCChannel dvbcChannel = tvChannel as DVBCChannel;
      if (dvbcChannel != null)
      {
        symbolRate = dvbcChannel.SymbolRate;
        modulation = (int)dvbcChannel.ModulationType;
        channelNumber = dvbcChannel.LogicalChannelNumber;
        channelType = 2;
      }

      DVBSChannel dvbsChannel = tvChannel as DVBSChannel;
      if (dvbsChannel != null)
      {
        symbolRate = dvbsChannel.SymbolRate;
        polarisation = (int)dvbsChannel.Polarisation;
        switchFrequency = dvbsChannel.SwitchingFrequency;
        diseqc = (int)dvbsChannel.DisEqc;
        band = (int)dvbsChannel.BandType;
        satIndex = dvbsChannel.SatelliteIndex;
        modulation = (int)dvbsChannel.ModulationType;
        innerFecRate = (int)dvbsChannel.InnerFecRate;
        pilot = (int)dvbsChannel.Pilot;
        rollOff = (int)dvbsChannel.Rolloff;
        channelNumber = dvbsChannel.LogicalChannelNumber;
        channelType = 3;
      }

      DVBTChannel dvbtChannel = tvChannel as DVBTChannel;
      if (dvbtChannel != null)
      {
        bandwidth = dvbtChannel.BandWidth;
        channelNumber = dvbtChannel.LogicalChannelNumber;
        channelType = 4;
      }

      DVBIPChannel dvbipChannel = tvChannel as DVBIPChannel;
      if (dvbipChannel != null)
      {
        url = dvbipChannel.Url;
        channelNumber = dvbipChannel.LogicalChannelNumber;
        channelType = 7;
      }

      DVBBaseChannel dvbChannel = tvChannel as DVBBaseChannel;
      if (dvbChannel != null)
      {
        pmtPid = dvbChannel.PmtPid;
        networkId = dvbChannel.NetworkId;
        serviceId = dvbChannel.ServiceId;
        transportId = dvbChannel.TransportId;
        channelName = dvbChannel.Name;
        provider = dvbChannel.Provider;
        channelFrequency = dvbChannel.Frequency;
        isRadio = dvbChannel.IsRadio;
        isTv = dvbChannel.IsTv;
        freeToAir = dvbChannel.FreeToAir;
      }

      detail.Name = channelName;
      detail.Provider = provider;
      detail.ChannelType = channelType;
      detail.ChannelNumber = channelNumber;
      detail.Frequency = (int)channelFrequency;
      detail.CountryId = country;
      detail.IsRadio = isRadio;
      detail.IsTv = isTv;
      detail.NetworkId = networkId;
      detail.TransportId = transportId;
      detail.ServiceId = serviceId;
      detail.PmtPid = pmtPid;
      detail.FreeToAir = freeToAir;
      detail.Modulation = modulation;
      detail.Polarisation = polarisation;
      detail.Symbolrate = symbolRate;
      detail.Diseqc = diseqc;
      detail.SwitchingFrequency = switchFrequency;
      detail.Bandwidth = bandwidth;
      detail.MajorChannel = majorChannel;
      detail.MinorChannel = minorChannel;
      detail.VideoSource = videoInputType;
      detail.AudioSource = audioInputType;
      detail.IsVCRSignal = isVCRSignal;
      detail.TuningSource = tunerSource;
      detail.Band = band;
      detail.SatIndex = satIndex;
      detail.InnerFecRate = innerFecRate;
      detail.Pilot = pilot;
      detail.RollOff = rollOff;
      detail.Url = url;
      return detail;
    }
示例#39
0
 /// <summary>
 ///
 /// </summary>
 public Channel ReferencedChannel()
 {
     return(Channel.Retrieve(IdChannel));
 }