Exemplo n.º 1
0
        public void GrabData(object ParamTo)
        {
            DataGrabArgs ParamToUse = (DataGrabArgs)ParamTo;
            int          ChannelID  = ParamToUse.ChannelID;
            int          Seconds    = ParamToUse.Seconds;
            List <int>   Pids       = ParamToUse.Pids;
            string       Filename   = "Custom_" + ChannelID.ToString() + ".ts";

            Complete = false;
            TvServer server = new TvServer();
            IUser    user   = new User(Filename, false);

            WantedPIDS = Pids;
            TvResult result = default(TvResult);

            //Used to start and ensure we can tune the channel
            result = server.StartTimeShifting(ref user, ChannelID, out _card);

            if ((result == TvResult.Succeeded))
            {
                Thread.Sleep(2000);
                _card.StopTimeShifting();

                result = server.StartTimeShiftingWithCustom(ref user, ChannelID, out _card, Filename, Pids);

                if ((result == TvResult.Succeeded))
                {
                    string NewFile = _card.TimeshiftFolder + "\\" + Filename;
                    TimeStamp = DateTime.Now.AddSeconds(Seconds);
                    ProcessPackets(NewFile);
                    Decoders.Remove(ChannelID);
                }
                else
                {
                    Decoders.Remove(ChannelID);
                    if (OnComplete != null)
                    {
                        OnComplete(true, result.ToString());
                    }
                }
            }
            else
            {
                Decoders.Remove(ChannelID);
                if (OnComplete != null)
                {
                    OnComplete(true, result.ToString());
                }
            }
        }
Exemplo n.º 2
0
 public void GrabData(int ChannelID, int Seconds, List <int> Pids)
 {
     if (Decoders.Contains(ChannelID) == false)
     {
         DataGrabArgs paramstouse = new DataGrabArgs();
         paramstouse.ChannelID = ChannelID;
         paramstouse.Seconds   = Seconds;
         paramstouse.Pids      = Pids;
         Thread thread1 = new Thread(GrabData);
         Decoders.Add(ChannelID);
         thread1.Start(paramstouse);
     }
     else
     {
         if (OnComplete != null)
         {
             OnComplete(true, "Already grabbing on this channel, try again later");
         }
     }
 }