コード例 #1
0
 public List<StreamingStatus> GetStreamingStatus()
 {
     List<StreamingStatus> states = new List<StreamingStatus>();
     VirtualCard vcard;
     try
     {
         foreach (Card card in cards)
         {
             User user = new User();
             user.CardId = card.IdCard;
             User[] usersForCard = controller.GetUsersForCard(card.IdCard);
             if (usersForCard == null)
             {
                 StreamingStatus state = new StreamingStatus();
                 vcard = new VirtualCard(user, RemoteControl.HostName);
                 string tmp = "idle";
                 if (vcard.IsScanning) tmp = "Scanning";
                 if (vcard.IsGrabbingEpg) tmp = "Grabbing EPG";
                 state.cardId = card.IdCard;
                 state.cardName = vcard.Name;
                 state.cardType = vcard.Type.ToString();
                 state.status = tmp;
                 state.channelName = "";
                 state.userName = "";
                 states.Add(state);
                 continue;
             }
             if (usersForCard.Length == 0)
             {
                 StreamingStatus state = new StreamingStatus();
                 vcard = new VirtualCard(user, RemoteControl.HostName);
                 string tmp = "idle";
                 if (vcard.IsScanning) tmp = "Scanning";
                 if (vcard.IsGrabbingEpg) tmp = "Grabbing EPG";
                 state.cardId = card.IdCard;
                 state.cardName = vcard.Name;
                 state.cardType = vcard.Type.ToString();
                 state.status = tmp;
                 state.channelName = "";
                 state.userName = "";
                 states.Add(state);
                 continue;
             }
             for (int i = 0; i < usersForCard.Length; ++i)
             {
                 StreamingStatus state = new StreamingStatus();
                 string tmp = "idle";
                 vcard = new VirtualCard(usersForCard[i], RemoteControl.HostName);
                 if (vcard.IsTimeShifting)
                     tmp = "Timeshifting";
                 else
                     if (vcard.IsRecording)
                         tmp = "Recording";
                     else
                         if (vcard.IsScanning)
                             tmp = "Scanning";
                         else
                             if (vcard.IsGrabbingEpg)
                                 tmp = "Grabbing EPG";
                 state.cardId = card.IdCard;
                 state.cardName = vcard.Name;
                 state.cardType = vcard.Type.ToString();
                 state.status = tmp;
                 state.channelName = vcard.ChannelName;
                 state.userName = vcard.User.Name;
                 state.channelId = vcard.IdChannel;
                 state.TimeShiftFileName = vcard.TimeShiftFileName;
                 state.RTSPUrl = vcard.RTSPUrl;
                 states.Add(state);
             }
         }
     }
     catch (Exception ex)
     {
         lastException = ex;
         Console.WriteLine(ex.ToString());
         Log.Error("TVServerXBMC: " + ex.ToString());
         return null;
     }
     return states;
 }
コード例 #2
0
        public List <StreamingStatus> GetStreamingStatus()
        {
            List <StreamingStatus> states = new List <StreamingStatus>();
            VirtualCard            vcard;

            try
            {
                foreach (Card card in cards)
                {
                    User   user         = new User();
                    User[] usersForCard = null;
                    user.CardId = card.IdCard;
                    try
                    {
                        usersForCard = RemoteControl.Instance.GetUsersForCard(card.IdCard);
                    }
                    catch (Exception)
                    {
                        continue;
                    }
                    if (usersForCard == null)
                    {
                        StreamingStatus state = new StreamingStatus();
                        vcard = new VirtualCard(user, RemoteControl.HostName);
                        string tmp = "idle";
                        if (vcard.IsScanning)
                        {
                            tmp = "Scanning";
                        }
                        if (vcard.IsGrabbingEpg)
                        {
                            tmp = "Grabbing EPG";
                        }
                        state.cardId      = card.IdCard;
                        state.cardName    = vcard.Name;
                        state.cardType    = vcard.Type.ToString();
                        state.status      = tmp;
                        state.channelName = "";
                        state.userName    = "";
                        states.Add(state);
                        continue;
                    }
                    if (usersForCard.Length == 0)
                    {
                        StreamingStatus state = new StreamingStatus();
                        vcard = new VirtualCard(user, RemoteControl.HostName);
                        string tmp = "idle";
                        if (vcard.IsScanning)
                        {
                            tmp = "Scanning";
                        }
                        if (vcard.IsGrabbingEpg)
                        {
                            tmp = "Grabbing EPG";
                        }
                        state.cardId      = card.IdCard;
                        state.cardName    = vcard.Name;
                        state.cardType    = vcard.Type.ToString();
                        state.status      = tmp;
                        state.channelName = "";
                        state.userName    = "";
                        states.Add(state);
                        continue;
                    }
                    for (int i = 0; i < usersForCard.Length; ++i)
                    {
                        StreamingStatus state = new StreamingStatus();
                        string          tmp   = "idle";
                        vcard = new VirtualCard(usersForCard[i], RemoteControl.HostName);
                        if (vcard.IsTimeShifting)
                        {
                            tmp = "Timeshifting";
                        }
                        else if (vcard.IsRecording)
                        {
                            tmp = "Recording";
                        }
                        else if (vcard.IsScanning)
                        {
                            tmp = "Scanning";
                        }
                        else if (vcard.IsGrabbingEpg)
                        {
                            tmp = "Grabbing EPG";
                        }
                        state.cardId      = card.IdCard;
                        state.cardName    = vcard.Name;
                        state.cardType    = vcard.Type.ToString();
                        state.status      = tmp;
                        state.channelName = vcard.ChannelName;
                        state.userName    = vcard.User.Name;
                        states.Add(state);
                    }
                }
            }
            catch (Exception ex)
            {
                lastException = ex;
                return(null);
            }
            return(states);
        }
コード例 #3
0
 public List<StreamingStatus> GetStreamingStatus()
 {
   List<StreamingStatus> states = new List<StreamingStatus>();
   VirtualCard vcard;
   try
   {
     foreach (Card card in cards)
     {
       IUser user = new User();
       IUser[] usersForCard = null;
       user.CardId = card.IdCard;
       try
       {
         usersForCard = RemoteControl.Instance.GetUsersForCard(card.IdCard);
       }
       catch (Exception)
       {
         continue;
       }
       if (usersForCard == null)
       {
         StreamingStatus state = new StreamingStatus();
         vcard = new VirtualCard(user, RemoteControl.HostName);
         string tmp = "idle";
         if (vcard.IsScanning) tmp = "Scanning";
         if (vcard.IsGrabbingEpg) tmp = "Grabbing EPG";
         state.cardId = card.IdCard;
         state.cardName = vcard.Name;
         state.cardType = vcard.Type.ToString();
         state.status = tmp;
         state.channelName = "";
         state.userName = "";
         states.Add(state);
         continue;
       }
       if (usersForCard.Length == 0)
       {
         StreamingStatus state = new StreamingStatus();
         vcard = new VirtualCard(user, RemoteControl.HostName);
         string tmp = "idle";
         if (vcard.IsScanning) tmp = "Scanning";
         if (vcard.IsGrabbingEpg) tmp = "Grabbing EPG";
         state.cardId = card.IdCard;
         state.cardName = vcard.Name;
         state.cardType = vcard.Type.ToString();
         state.status = tmp;
         state.channelName = "";
         state.userName = "";
         states.Add(state);
         continue;
       }
       for (int i = 0; i < usersForCard.Length; ++i)
       {
         StreamingStatus state = new StreamingStatus();
         string tmp = "idle";
         vcard = new VirtualCard(usersForCard[i], RemoteControl.HostName);
         if (vcard.IsTimeShifting)
           tmp = "Timeshifting";
         else if (vcard.IsRecording)
           tmp = "Recording";
         else if (vcard.IsScanning)
           tmp = "Scanning";
         else if (vcard.IsGrabbingEpg)
           tmp = "Grabbing EPG";
         state.cardId = card.IdCard;
         state.cardName = vcard.Name;
         state.cardType = vcard.Type.ToString();
         state.status = tmp;
         state.channelName = vcard.ChannelName;
         state.userName = vcard.User.Name;
         states.Add(state);
       }
     }
   }
   catch (Exception ex)
   {
     lastException = ex;
     return null;
   }
   return states;
 }