当前位置: 首页>>代码示例>>C#>>正文


C# SchedulerServiceAgent.GetChannelById方法代码示例

本文整理汇总了C#中SchedulerServiceAgent.GetChannelById方法的典型用法代码示例。如果您正苦于以下问题:C# SchedulerServiceAgent.GetChannelById方法的具体用法?C# SchedulerServiceAgent.GetChannelById怎么用?C# SchedulerServiceAgent.GetChannelById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SchedulerServiceAgent的用法示例。


在下文中一共展示了SchedulerServiceAgent.GetChannelById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnsureChannelForDvbEpg

        private static Channel EnsureChannelForDvbEpg(SchedulerServiceAgent tvSchedulerAgent, TvDatabase.Channel mpChannel,
            bool epgSyncAutoCreateChannels, bool epgSyncAutoCreateChannelsWithGroup)
        {
            ChannelLink channelLink = ChannelLinks.GetChannelLinkForMediaPortalChannel(mpChannel);
            ChannelType channelType = mpChannel.IsTv ? ChannelType.Television : ChannelType.Radio;
            Channel channel = null;
            if (channelLink != null)
            {
                channel = tvSchedulerAgent.GetChannelById(channelLink.ChannelId);
                if (channel == null)
                {
                    channel = tvSchedulerAgent.GetChannelByDisplayName(channelType, channelLink.ChannelName);
                }
            }
            if (channel == null)
            {
                channel = tvSchedulerAgent.GetChannelByDisplayName(channelType, mpChannel.DisplayName);
            }
            if (channel == null
                && (epgSyncAutoCreateChannels || epgSyncAutoCreateChannelsWithGroup))
            {
                string groupName = "DVB-EPG";
                if (epgSyncAutoCreateChannelsWithGroup)
                {
                    IList<TvDatabase.GroupMap> groupMaps = mpChannel.ReferringGroupMap();
                    foreach (TvDatabase.GroupMap groupMap in groupMaps)
                    {
                        TvDatabase.ChannelGroup channelGroup = TvDatabase.ChannelGroup.Retrieve(groupMap.IdGroup);
                        if (channelGroup != null)
                        {
                            groupName = channelGroup.GroupName;
                            break;
                        }
                    }
                }

                Guid channelId = tvSchedulerAgent.EnsureChannel(channelType, mpChannel.DisplayName, groupName);
                channel = tvSchedulerAgent.GetChannelById(channelId);

                if (!channel.LogicalChannelNumber.HasValue
                    && mpChannel.ChannelNumber > 0)
                {
                    channel.LogicalChannelNumber = mpChannel.ChannelNumber;
                    tvSchedulerAgent.SaveChannel(channel);
                }
            }
            return channel;
        }
开发者ID:dot-i,项目名称:ARGUS-TV-Recorders,代码行数:48,代码来源:TvServerPlugin.cs

示例2: OnGlobalMessage

        public static void OnGlobalMessage(GUIMessage message)
        {
            switch (message.Message)
            {
                /// <summary>
                /// We need to stop the player if our livestream ends unexpectedly.
                /// If the stream stopped for a recording, we show it in a message.
                /// Without this mediaportal can hang,crash (c++ error in tsreader).
                /// </summary>
                case GUIMessage.MessageType.GUI_MSG_STOP_SERVER_TIMESHIFTING:
                    {
                        Log.Debug("TvHome: GUI_MSG_STOP_SERVER_TIMESHIFTING, param1 = {0}",message.Param1);
                        if (PluginMain.Navigator.IsLiveStreamOn)
                        {
                            if (message.Param1 == 4321)//fired by eventlistener
                            {
                                LiveStream liveStream = message.Object as LiveStream;
                                LiveStream navigatorLiveStream = PluginMain.Navigator.LiveStream;
                                Channel channel = PluginMain.Navigator.CurrentChannel;

                                if (liveStream != null && channel != null
                                    && navigatorLiveStream.TimeshiftFile == liveStream.TimeshiftFile
                                    && liveStream.StreamStartedTime == navigatorLiveStream.StreamStartedTime)
                                {
                                    if (g_Player.Playing && (g_Player.IsTV || g_Player.IsRadio))
                                    {
                                        g_Player.Stop();
                                        Log.Info("TvHome: our live stream seems to be aborted, stop the playback now");
                                    }

                                    string text = GUILocalizeStrings.Get(1516);
                                    if (message.Label == LiveStreamAbortReason.RecordingStartedOnCard.ToString())
                                    {
                                        text = GUILocalizeStrings.Get(1513);
                                    }
                                    text = text.Replace("\\r", " ");

                                    string heading = string.Empty;
                                    string tvlogo = string.Empty;
                                    using (SchedulerServiceAgent SchedulerAgent = new SchedulerServiceAgent())
                                    {
                                        if (channel.ChannelType == ChannelType.Television)
                                            heading = GUILocalizeStrings.Get(605) + " - " + channel.DisplayName; //my tv
                                        else
                                            heading = GUILocalizeStrings.Get(665) + " - " + channel.DisplayName; //my radio

                                        tvlogo = Utility.GetLogoImage(channel, SchedulerAgent);
                                    }

                                    GUIDialogNotify pDlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
                                    if (pDlgNotify != null)
                                    {
                                        pDlgNotify.Reset();
                                        pDlgNotify.ClearAll();
                                        pDlgNotify.SetHeading(heading);
                                        if (!string.IsNullOrEmpty(text))
                                        {
                                            pDlgNotify.SetText(text);
                                        }
                                        pDlgNotify.SetImage(tvlogo);
                                        pDlgNotify.TimeOut = 5;
                                        Utils.PlaySound("notify.wav", false, true);
                                        pDlgNotify.DoModal(GUIWindowManager.ActiveWindow);
                                    }
                                }
                            }
                            else//fired by mp player
                            {
                                PluginMain.Navigator.AsyncStopLiveStream();
                            }
                        }
                    }
                    break;

                case GUIMessage.MessageType.GUI_MSG_NOTIFY_REC:
                    {
                        if (_enableRecNotification)
                        {
                            Log.Debug("TvHome: GUI_MSG_NOTIFY_REC");
                            string head = string.Empty;
                            string logo = string.Empty;
                            Recording recording = message.Object as Recording;

                            if (message.Param1 == 1)
                                head = GUILocalizeStrings.Get(1446);
                            else
                                head = GUILocalizeStrings.Get(1447);

                            using (SchedulerServiceAgent SchedulerAgent = new SchedulerServiceAgent())
                            {
                                Channel chan = SchedulerAgent.GetChannelById(recording.ChannelId);
                                logo = Utility.GetLogoImage(chan, SchedulerAgent);
                            }

                            string _text = String.Format("{0} {1}-{2}",
                                                  recording.Title,
                                                  recording.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                  recording.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                            GUIDialogNotify DlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
//.........这里部分代码省略.........
开发者ID:dot-i,项目名称:ARGUS-TV-Clients,代码行数:101,代码来源:TvHome.cs


注:本文中的SchedulerServiceAgent.GetChannelById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。