Пример #1
0
        public async Task GetVideoWithHighQuality()
        {
            //arrange
            string videoId = "193970500";

            //act
            Video video = await Vimeo.Download(videoId, VideoQuality.High);

            //assert
            Assert.AreNotEqual(0, video.Data.Length);
            Assert.AreNotEqual(string.Empty, video.FileName);
        }
Пример #2
0
        static async Task Main(string[] args)
        {
            var filePath      = "D:\\Pobrane - Chrome\\plikjson.txt";
            var directoryPath = "C:\\Users\\Mateusz02\\Desktop\\Output";
            var extension     = ".mp4";

            if (IsAdministrator() == false)
            {
                Console.WriteLine("You need to run this application as administrator");
                throw new MemberAccessException("You need to run this application as administrator");
            }

            while (File.Exists(filePath) == false)
            {
                Console.WriteLine($"Type path to json.txt file");
                filePath = Console.ReadLine();
            }


            while (Directory.Exists(directoryPath) == false)
            {
                Console.WriteLine($"Type path to output directory");
                directoryPath = Console.ReadLine();
            }



            JObject json;

            using (StreamReader file = new StreamReader(filePath))
            {
                json = JObject.Parse(file.ReadToEnd());
            }
            foreach (JProperty property in json.Properties())
            {
                CustomFile obj = ProcessAddress(property.Name, property.Value.ToString(), extension, directoryPath);

                Directory.CreateDirectory(obj.FileDirectory);

                Video video = await Vimeo.Download(obj.videoId, VideoQuality.High);

                File.WriteAllBytes(obj.Filename, video.Data);
            }
        }