Example #1
0
 private void _refreshStatusBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     if (this.IsConnected)
     {
         using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
         {
             RefreshStatusResult result = new RefreshStatusResult();
             result.ActiveRecordings  = tvControlAgent.GetActiveRecordings();
             result.LiveStreams       = tvControlAgent.GetLiveStreams();
             result.UpcomingRecording = tvControlAgent.GetNextUpcomingRecording(false);
             e.Result = result;
         }
     }
 }
Example #2
0
 private void RefreshBotPersonalMessage()
 {
     if (_messenger.Owner != null)
     {
         string         message = "Idle";
         PresenceStatus status  = PresenceStatus.Online;
         using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
         {
             ActiveRecording[] activeRecordings = tvControlAgent.GetActiveRecordings();
             if (activeRecordings.Length > 0)
             {
                 message = "Recording";
                 status  = PresenceStatus.Busy;
             }
             else
             {
                 LiveStream[] liveStreams = tvControlAgent.GetLiveStreams();
                 if (liveStreams.Length > 0)
                 {
                     message = "Streaming";
                     status  = PresenceStatus.Away;
                 }
                 else
                 {
                     UpcomingRecording upcomingRecording = tvControlAgent.GetNextUpcomingRecording(false);
                     if (upcomingRecording != null)
                     {
                         message = "Waiting for next scheduled recording";
                     }
                 }
             }
         }
         if (_messenger.Owner.PersonalMessage == null ||
             _messenger.Owner.PersonalMessage.Message != message)
         {
             _messenger.Owner.PersonalMessage = new PersonalMessage(message);
         }
         if (_messenger.Owner.Status != status)
         {
             _messenger.Owner.Status = status;
         }
     }
 }
Example #3
0
        private void _refreshProgramsBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            RefreshProgramsResult result = null;

            //DateTime startTime = DateTime.Now;

            if (this.IsConnected)
            {
                using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
                {
                    result = new RefreshProgramsResult();

                    result.AllUpcomingRecordings = tvControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.Recordings, true);
                    result.ActiveRecordings      = tvControlAgent.GetActiveRecordings();
                    result.LiveStreams           = tvControlAgent.GetLiveStreams();
                    result.UpcomingRecordings    = new UpcomingOrActiveProgramsList(result.AllUpcomingRecordings);
                    result.UpcomingRecordings.RemoveActiveRecordings(result.ActiveRecordings);
                }
            }

            //Utility.EnsureMinimumTime(startTime, 250);

            e.Result = result;
        }
Example #4
0
        private IMBotMessage DoStatusCommand(IMBotConversation conversation, IList<string> arguments)
        {
            using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
            {
                bool fixedWidth = false;

                // Check if currently recording :
                ActiveRecording[] activeRecordings = tvControlAgent.GetActiveRecordings();
                LiveStream[] liveStreams = tvControlAgent.GetLiveStreams();
                UpcomingRecording upcomingRecording = tvControlAgent.GetNextUpcomingRecording(false);

                StringBuilder reply = new StringBuilder();

                if (activeRecordings.Length > 0)
                {
                    reply.Append("Currently recording:");
                    foreach (ActiveRecording activeRecording in activeRecordings)
                    {
                        PluginService pluginService = null;
                        if (activeRecording.CardChannelAllocation != null)
                        {
                            pluginService =
                                RecorderTunersCache.GetRecorderTunerById(activeRecording.CardChannelAllocation.RecorderTunerId);
                        }

                        reply.AppendLine();
                        Utility.AppendProgramDetails(reply, activeRecording.Program.Channel, activeRecording.Program);
                        reply.AppendFormat(" [{0}]", pluginService == null ? "-" : pluginService.Name);
                    }
                    fixedWidth = true;

                    if (liveStreams.Length > 0
                        || upcomingRecording != null)
                    {
                        reply.AppendLine();
                    }
                }
                if (liveStreams.Length > 0)
                {
                    reply.Append("Currently streaming:");
                    foreach (LiveStream liveStream in liveStreams)
                    {
                        reply.AppendLine();
                        reply.AppendFormat("[{0}]", liveStream.Channel.DisplayName);
                    }
                    fixedWidth = true;

                    if (upcomingRecording != null)
                    {
                        reply.AppendLine();
                    }
                }
                if (upcomingRecording != null)
                {
                    if (reply.Length == 0)
                    {
                        reply.AppendLine("Idle, next scheduled recording:");
                    }
                    else
                    {
                        reply.AppendLine("Next scheduled recording:");
                    }

                    PluginService pluginService = null;
                    if (upcomingRecording.CardChannelAllocation != null)
                    {
                        pluginService = RecorderTunersCache.GetRecorderTunerById(upcomingRecording.CardChannelAllocation.RecorderTunerId);
                    }

                    Utility.AppendProgramDetails(reply, upcomingRecording.Program.Channel, upcomingRecording.Program);
                    reply.AppendFormat(" [{0}]", pluginService == null ? "-" : pluginService.Name);

                    fixedWidth = true;
                }
                if (reply.Length == 0)
                {
                    reply.Append("Idle");
                }
                reply.AppendLine().AppendLine();
                reply.Append("ARGUS TV Messenger " + Constants.ProductVersion + @", running on server \\").AppendLine(Dns.GetHostName());
                reply.Append("http://www.argus-tv.com");
                return new IMBotMessage(reply.ToString(), fixedWidth);
            }
        }
Example #5
0
 private void _refreshStatusBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     if (this.IsConnected)
     {
         using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
         {
             RefreshStatusResult result = new RefreshStatusResult();
             result.ActiveRecordings = tvControlAgent.GetActiveRecordings();
             result.LiveStreams = tvControlAgent.GetLiveStreams();
             result.UpcomingRecording = tvControlAgent.GetNextUpcomingRecording(false);
             e.Result = result;
         }
     }
 }
Example #6
0
        private void _refreshProgramsBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            RefreshProgramsResult result = null;
            //DateTime startTime = DateTime.Now;

            if (this.IsConnected)
            {
                using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
                {
                    result = new RefreshProgramsResult();

                    result.AllUpcomingRecordings = tvControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.Recordings, true);
                    result.ActiveRecordings = tvControlAgent.GetActiveRecordings();
                    result.LiveStreams = tvControlAgent.GetLiveStreams();
                    result.UpcomingRecordings = new UpcomingOrActiveProgramsList(result.AllUpcomingRecordings);
                    result.UpcomingRecordings.RemoveActiveRecordings(result.ActiveRecordings);
                }
            }

            //Utility.EnsureMinimumTime(startTime, 250);

            e.Result = result;
        }
Example #7
0
 private void RefreshBotPersonalMessage()
 {
     if (_messenger.Owner != null)
     {
         string message = "Idle";
         PresenceStatus status = PresenceStatus.Online;
         using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
         {
             ActiveRecording[] activeRecordings = tvControlAgent.GetActiveRecordings();
             if (activeRecordings.Length > 0)
             {
                 message = "Recording";
                 status = PresenceStatus.Busy;
             }
             else
             {
                 LiveStream[] liveStreams = tvControlAgent.GetLiveStreams();
                 if (liveStreams.Length > 0)
                 {
                     message = "Streaming";
                     status = PresenceStatus.Away;
                 }
                 else
                 {
                     UpcomingRecording upcomingRecording = tvControlAgent.GetNextUpcomingRecording(false);
                     if (upcomingRecording != null)
                     {
                         message = "Waiting for next scheduled recording";
                     }
                 }
             }
         }
         if (_messenger.Owner.PersonalMessage == null
             || _messenger.Owner.PersonalMessage.Message != message)
         {
             _messenger.Owner.PersonalMessage = new PersonalMessage(message);
         }
         if (_messenger.Owner.Status != status)
         {
             _messenger.Owner.Status = status;
         }
     }
 }
Example #8
0
        private IMBotMessage DoStatusCommand(IMBotConversation conversation, IList <string> arguments)
        {
            using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
            {
                bool fixedWidth = false;

                // Check if currently recording :
                ActiveRecording[] activeRecordings  = tvControlAgent.GetActiveRecordings();
                LiveStream[]      liveStreams       = tvControlAgent.GetLiveStreams();
                UpcomingRecording upcomingRecording = tvControlAgent.GetNextUpcomingRecording(false);

                StringBuilder reply = new StringBuilder();

                if (activeRecordings.Length > 0)
                {
                    reply.Append("Currently recording:");
                    foreach (ActiveRecording activeRecording in activeRecordings)
                    {
                        PluginService pluginService = null;
                        if (activeRecording.CardChannelAllocation != null)
                        {
                            pluginService =
                                RecorderTunersCache.GetRecorderTunerById(activeRecording.CardChannelAllocation.RecorderTunerId);
                        }

                        reply.AppendLine();
                        Utility.AppendProgramDetails(reply, activeRecording.Program.Channel, activeRecording.Program);
                        reply.AppendFormat(" [{0}]", pluginService == null ? "-" : pluginService.Name);
                    }
                    fixedWidth = true;

                    if (liveStreams.Length > 0 ||
                        upcomingRecording != null)
                    {
                        reply.AppendLine();
                    }
                }
                if (liveStreams.Length > 0)
                {
                    reply.Append("Currently streaming:");
                    foreach (LiveStream liveStream in liveStreams)
                    {
                        reply.AppendLine();
                        reply.AppendFormat("[{0}]", liveStream.Channel.DisplayName);
                    }
                    fixedWidth = true;

                    if (upcomingRecording != null)
                    {
                        reply.AppendLine();
                    }
                }
                if (upcomingRecording != null)
                {
                    if (reply.Length == 0)
                    {
                        reply.AppendLine("Idle, next scheduled recording:");
                    }
                    else
                    {
                        reply.AppendLine("Next scheduled recording:");
                    }

                    PluginService pluginService = null;
                    if (upcomingRecording.CardChannelAllocation != null)
                    {
                        pluginService = RecorderTunersCache.GetRecorderTunerById(upcomingRecording.CardChannelAllocation.RecorderTunerId);
                    }

                    Utility.AppendProgramDetails(reply, upcomingRecording.Program.Channel, upcomingRecording.Program);
                    reply.AppendFormat(" [{0}]", pluginService == null ? "-" : pluginService.Name);

                    fixedWidth = true;
                }
                if (reply.Length == 0)
                {
                    reply.Append("Idle");
                }
                reply.AppendLine().AppendLine();
                reply.Append("ARGUS TV Messenger " + Constants.ProductVersion + @", running on server \\").AppendLine(Dns.GetHostName());
                reply.Append("http://www.argus-tv.com");
                return(new IMBotMessage(reply.ToString(), fixedWidth));
            }
        }