Exemplo n.º 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;
         }
     }
 }
Exemplo n.º 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;
         }
     }
 }
Exemplo n.º 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;
        }
Exemplo n.º 4
0
        private void OnActiveRecordings(List<Guid> ignoreActiveRecordings)
        {
            using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
            {
                List<ActiveRecording> activeRecordings = new List<ActiveRecording>(
                    tvControlAgent.GetActiveRecordings());

                if (activeRecordings != null && activeRecordings.Count > 0)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                    if (dlg == null)
                    {
                        return;
                    }

                    dlg.Reset();
                    dlg.SetHeading(200052); // Active Recordings

                    List<ActiveRecording> listedRecordings = new List<ActiveRecording>();
                    foreach (ActiveRecording activeRecording in activeRecordings)
                    {
                        if (!ignoreActiveRecordings.Contains(activeRecording.RecordingId))
                        {
                            GUIListItem item = new GUIListItem();
                            string channelName = activeRecording.Program.Channel.DisplayName;
                            string programTitle = activeRecording.Program.Title;
                            string time = String.Format("{0}-{1}",
                                activeRecording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                activeRecording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                            item.Label = channelName;
                            item.Label2 = programTitle + "  " + time;

                            string strLogo = string.Empty;
                            using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                            {
                                strLogo = Utility.GetLogoImage(activeRecording.Program.Channel, tvSchedulerAgent);
                            }

                            if (string.IsNullOrEmpty(strLogo))
                            {
                                strLogo = "defaultVideoBig.png";
                            }

                            item.IconImage = strLogo;
                            item.IconImageBig = strLogo;
                            dlg.Add(item);
                            listedRecordings.Add(activeRecording);
                        }
                    }

                    dlg.SelectedLabel = listedRecordings.Count - 1;

                    dlg.DoModal(this.GetID);
                    if (dlg.SelectedLabel < 0 || listedRecordings.Count == 0 || (dlg.SelectedLabel - 1 > listedRecordings.Count))
                    {
                        return;
                    }

                    ActiveRecording selectedRecording = listedRecordings[dlg.SelectedLabel];
                    listedRecordings = null;

                    bool deleted = OnAbortActiveRecording(selectedRecording);
                    if (deleted && !ignoreActiveRecordings.Contains(selectedRecording.RecordingId))
                    {
                        ignoreActiveRecordings.Add(selectedRecording.RecordingId);
                    }

                    if (deleted)
                    {
                        OnActiveRecordings(ignoreActiveRecordings); //keep on showing the list until --> 1) user leaves menu, 2) no more active recordings
                    }
                }
                else if (ignoreActiveRecordings == null || ignoreActiveRecordings.Count == 0)
                {
                    GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    if (pDlgOK != null)
                    {
                        pDlgOK.SetHeading(200052); //my tv
                        pDlgOK.SetLine(1, GUILocalizeStrings.Get(200053)); // No Active recordings
                        pDlgOK.SetLine(2, "");
                        pDlgOK.DoModal(this.GetID);
                    }
                }
            }
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
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;
         }
     }
 }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
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;
         }
     }
 }
Exemplo n.º 9
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));
            }
        }