Ejemplo n.º 1
0
            protected void GetValue(string url, string mergePath = null)
            {
                var uri = new Uri(url);

                Console.WriteLine(uri.AbsoluteUri);
                Console.WriteLine(uri.AbsolutePath);

                var fileList = GetM3U8(url).ToList();

                //fileList.AsParallel().ForAll(p =>
                fileList.ForEach((p, i, count) =>
                {
                    //http://v1.benbi123.com/20190409/yzqObCmT/index.m3u8
                    var temp = p.StartsWith("http") ? p : uri.AbsoluteUri.Replace(uri.AbsolutePath, p);
                    SystemConsole.SetProgress(temp, ((float)i / count));
                    GetWebFile(temp);
                });
                SystemConsole.ClearProgress();

                mergePath = string.IsNullOrEmpty(mergePath) ? uri.AbsolutePath : mergePath;

                FileHelper.FileMerge(fileList.Select(p => p.StartsWith("http") ? new Uri(p).AbsolutePath : p).ToArray(),
                                     Path.ChangeExtension(mergePath, ".mp4"));

                var dic = FileHelper.String2Dictionary(fileList);
                //dic.Keys.ToList().ForEach(p =>
                //{
                //    Directory.Delete(p, true);
                //});
            }