예제 #1
0
        private async Task ProcessYoutubeVideo(VideoDetails videoDetails, string mediaType, string quality)
        {
            if (videoDetails == null)
            {
                return;
            }

            await DownloadThumbnails(videoDetails);

            var path = mediaPath + $"\\{videoDetails.id}.{mediaType}";

            try
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                await clientHelper.DownloadMedia(videoDetails.id, quality, path, mediaType);

                var fileInfo = new FileInfo(path);
                RecordMetadata(videoDetails, mediaType, quality, fileInfo.Length);
            }
            catch (Exception ex)
            {
                // todo: handle error
            }

            UpdateLibraryStatistics();
            UpdateJobStatistics();
            isProcessingJob = false;
            ProcessJobFromQueue();
        }