//  批量数据Flash下行
        public String BuildQuery_Flash(string sid, EStationType stationType, ETrans trans, DateTime beginTime, DateTime endTime, EChannelType ctype)
        {
            String result       = String.Empty;
            String dataProtocol = Manager.XmlStationData.Instance.GetProtocolBySId(sid);

            //RG30
            if (dataProtocol == "RG30")
            {
                Down = new Data.RG30.DownParser();
            }
            //时差法
            if (dataProtocol == "TDXY")
            {
                Down = new Data.TDXY.DownParser();
            }
            //中游局协议
            if (dataProtocol == "ZYJBX")
            {
                Down = new Data.ZYJBX.DownParser();
            }
            if (dataProtocol == "SM100H")
            {
                Down = new Data.SM100H.DownParser();
            }
            result = Down.BuildQuery_Flash(sid, stationType, trans, beginTime, endTime, ctype);
            return(result);
        }
        //  数据下行设置
        public String BuildSet(string sid, IList <EDownParam> cmds, CDownConf down, EChannelType ctype)
        {
            String result       = String.Empty;
            String dataProtocol = Manager.XmlStationData.Instance.GetProtocolBySId(sid);

            //RG30
            if (dataProtocol == "RG30")
            {
                Down = new Data.RG30.DownParser();
            }
            //时差法
            if (dataProtocol == "TDXY")
            {
                Down = new Data.TDXY.DownParser();
            }
            //中游局协议
            if (dataProtocol == "ZYJBX")
            {
                Down = new Data.ZYJBX.DownParser();
            }
            if (dataProtocol == "SM100H")
            {
                Down = new Data.SM100H.DownParser();
            }
            result = Down.BuildSet(sid, cmds, down, ctype);
            return(result);
        }
 public void InitInterface(IUp up, IDown down, IUBatch udisk, IFlashBatch flash, ISoil soil)
 {
     this.Up         = up;
     this.Down       = down;
     this.UBatch     = udisk;
     this.FlashBatch = flash;
     this.Soil       = soil;
 }
 public void InitInterface(IUp up, IDown down, IUBatch udisk, IFlashBatch flash, ISoil soil)
 {
     this.Up         = up;
     this.Down       = down;
     this.UBatch     = udisk;
     this.FlashBatch = flash;
     this.Soil       = soil;
     Debug.WriteLine("接口初始化完成");
 }
Example #5
0
        public static async Task DownloadShowAsync(One show, Live live, IDown d)
        {
            DownManager.down = d;
            // http://media2.neu6.edu.cn/review/program-1524520800-1524526860-chchd.m3u8
            var url = String.Format("http://media2.neu6.edu.cn/review/program-{0}-{1}-{2}.m3u8",
                                    show.start, show.end, live.GetSimpleName());

            Debug.WriteLine(url);
            //创建下载目录
            var downloadDic = await KnownFolders.VideosLibrary.CreateFolderAsync("NEUTV download",
                                                                                 CreationCollisionOption.OpenIfExists);

            //下载m3u8文件
            HttpClient httpClient = new HttpClient();
            var        response   = await httpClient.GetAsync(new Uri(url));

            var res = await response.Content.ReadAsStringAsync();

            Regex           re      = new Regex(@"(?<url>http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?)");
            MatchCollection mc      = re.Matches(res);
            List <String>   urlList = new List <string>();
            var             tsRe    = new Regex(@"(?<ts>[0-9]+\.ts)");

            foreach (Match m in mc)
            {
                var clipUrl = m.Result("${url}");
                urlList.Add(clipUrl);
            }
            if (down != null)
            {
                down.Start(urlList.Count);
            }
            //创建临时文件夹
            var tempDic = await downloadDic.CreateFolderAsync("temp",
                                                              CreationCollisionOption.GenerateUniqueName);

            //下载 视频分片
            var         Tasks = new List <Task>();
            TaskFactory fac   = new TaskFactory();

            Debug.WriteLine("start all");
            try
            {
                Task.Run(() =>
                {
                    Parallel.ForEach <string>(urlList, new ParallelOptions()
                    {
                        MaxDegreeOfParallelism = 10
                    },
                                              videoUrl => {
                        Act(videoUrl, httpClient, tempDic).Wait();
                    });
                }).ContinueWith((obj) =>
                {
                    Debug.WriteLine("end all");
                    SaveVideoFile(tempDic, downloadDic, urlList);
                });
            }
            catch (Exception e)
            {
            }
        }
Example #6
0
 public void InitInterface(IUp up, IDown down, IUBatch udisk, IFlashBatch flash, ISoil soil)
 {
     throw new NotImplementedException();
 }