Пример #1
0
        private Progressive.PecaStarter5.Plugins.BroadcastingParameter StartBroadcastAwait(IPeercast peercast, BroadcastParameter parameter,
            IYellowPages yellowPages, Dictionary<string, string> yellowPagesParameter,
            IProgress<string> progress)
        {
            progress.Report("チャンネルを作成中...");
            var param = parameter.Clone();
            param.Genre = yellowPages.GetPrefix(yellowPagesParameter) + param.Genre;
            var tuple = peercast.BroadcastAsync(
                new Peercast4Net.Datas.YellowPages() { Name = yellowPages.Name, Url = yellowPages.Host },
                param).Result;

            return new Progressive.PecaStarter5.Plugins.BroadcastingParameter
            {
                Bitrate = tuple.Item2,
                Id = tuple.Item1,
                YellowPagesParameters = yellowPagesParameter,
                BroadcastParameter = parameter
            };
        }
Пример #2
0
        public Task<Progressive.PecaStarter5.Plugins.UpdatedParameter> UpdateAsync(
            IPeercast peercast, IEnumerable<IExternalYellowPages> externalYellowPagesList,
            IYellowPages yellowPages, Dictionary<string, string> yellowPagesParameter,
            UpdateParameter parameter, IProgress<string> progress)
        {
            return Task.Factory.StartNew(() =>
            {
                // 更新
                progress.Report("通信中...");
                var param = (UpdateParameter)parameter.Clone();
                param.Genre = yellowPages.GetPrefix(yellowPagesParameter) + param.Genre;
                peercast.UpdateAsync(param).Wait();

                var updatedParameter = new Progressive.PecaStarter5.Plugins.UpdatedParameter
                {
                    YellowPagesParameters = yellowPagesParameter,
                    UpdateParameter = parameter
                };

                // 外部YPに通知
                if (yellowPages.IsExternal)
                {
                    Find(externalYellowPagesList, yellowPages.Name).OnUpdatedAsync(updatedParameter).Wait();
                }

                progress.Report("チャンネル情報を更新しました");
                return updatedParameter;
            });
        }