diff --git a/TwitchDownloaderWPF/PageChatDownload.xaml.cs b/TwitchDownloaderWPF/PageChatDownload.xaml.cs index f19f6884..e840bc96 100644 --- a/TwitchDownloaderWPF/PageChatDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageChatDownload.xaml.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Globalization; using System.IO; using System.Linq; using System.Net; @@ -312,7 +313,7 @@ private void btnDownload_Click(object sender, RoutedEventArgs e) } else { - TimeSpan vodLength = TimeSpan.Parse(Regex.Replace(videoData["data"][0]["duration"].ToString(), @"[^\d]", ":").TrimEnd(':')); + TimeSpan vodLength = GenerateTimespan(((JValue)videoData["data"][0]["duration"]).ToString(CultureInfo.InvariantCulture)); duration = (int)Math.Ceiling(vodLength.TotalSeconds); } info = new ChatDownloadInfo(downloadType, textUrl.Text, saveFileDialog.FileName, videoData["data"][0]["id"].ToString(), startTime, duration, (bool)radioJson.IsChecked, textStreamer.Text, streamerId); @@ -340,6 +341,21 @@ private void btnDownload_Click(object sender, RoutedEventArgs e) } } + private TimeSpan GenerateTimespan(string input) + { + //There might be a better way to do this, gets string 0h0m0s and returns timespan + TimeSpan returnSpan = new TimeSpan(0); + string[] inputArray = input.Remove(input.Length - 1).Replace('h', ':').Replace('m', ':').Split(':'); + + returnSpan = returnSpan.Add(TimeSpan.FromSeconds(Int32.Parse(inputArray[inputArray.Length - 1]))); + if (inputArray.Length > 1) + returnSpan = returnSpan.Add(TimeSpan.FromMinutes(Int32.Parse(inputArray[inputArray.Length - 2]))); + if (inputArray.Length > 2) + returnSpan = returnSpan.Add(TimeSpan.FromHours(Int32.Parse(inputArray[inputArray.Length - 3]))); + + return returnSpan; + } + public void SetImage(string imageUri, bool isGif) { var image = new BitmapImage(); diff --git a/TwitchDownloaderWPF/PageChatRender.xaml.cs b/TwitchDownloaderWPF/PageChatRender.xaml.cs index 04eeadf9..607036e6 100644 --- a/TwitchDownloaderWPF/PageChatRender.xaml.cs +++ b/TwitchDownloaderWPF/PageChatRender.xaml.cs @@ -1356,14 +1356,14 @@ private bool ValidateInputs() if (colorBackground.SelectedColor.Value.A < 255) { - if ((((VideoContainer)comboFormat.SelectedItem).Name == "MOV" && ((Codec)comboCodec.SelectedItem).Name == "RLE") || ((VideoContainer)comboFormat.SelectedItem).Name == "WEBM") + if ((((VideoContainer)comboFormat.SelectedItem).Name == "MOV" && ( ((Codec)comboCodec.SelectedItem).Name == "RLE") || ((Codec)comboCodec.SelectedItem).Name == "ProRes") || ((VideoContainer)comboFormat.SelectedItem).Name == "WEBM") { return true; } else { AppendLog("ERROR: You've selected an alpha channel (transparency) for a container/codec that does not support it."); - AppendLog("Remove transparency or encode with MOV and RLE (file size will be large)"); + AppendLog("Remove transparency or encode with MOV and RLE/PRORES (file size will be large)"); return false; } } diff --git a/TwitchDownloaderWPF/PageVodDownload.xaml.cs b/TwitchDownloaderWPF/PageVodDownload.xaml.cs index d28c53f7..47d69fc6 100644 --- a/TwitchDownloaderWPF/PageVodDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageVodDownload.xaml.cs @@ -116,7 +116,7 @@ private async void btnGetInfo_Click(object sender, RoutedEventArgs e) numEndHour.Value = vodLength.Hours; numEndMinute.Value = vodLength.Minutes; numEndSecond.Value = vodLength.Seconds; - labelLength.Text = String.Format("{0:00}:{1:00}:{2:00}", vodLength.TotalHours, vodLength.Minutes, vodLength.Seconds); + labelLength.Text = String.Format("{0:00}:{1:00}:{2:00}", vodLength.Hours, vodLength.Minutes, vodLength.Seconds); SetEnabled(true); } @@ -502,7 +502,7 @@ private int ValidateUrl(string text) private bool ValidateInput() { - TimeSpan videoLength = TimeSpan.Parse(labelLength.Text); + TimeSpan videoLength = TimeSpan.Parse(labelLength.Text.ToString(CultureInfo.InvariantCulture)); TimeSpan beginTime = new TimeSpan((int)numStartHour.Value, (int)numStartMinute.Value, (int)numStartSecond.Value); TimeSpan endTime = new TimeSpan((int)numEndHour.Value, (int)numEndMinute.Value, (int)numEndSecond.Value); @@ -601,7 +601,7 @@ public void UpdateValues(PageVodDownload currentPage) title = currentPage.textTitle.Text; quality = (string)currentPage.comboQuality.SelectedItem; streamer = currentPage.textStreamer.Text; - length = TimeSpan.Parse(currentPage.labelLength.Text); + length = TimeSpan.Parse(currentPage.labelLength.Text.ToString(CultureInfo.InvariantCulture)); cropped_begin = (bool)currentPage.checkStart.IsChecked; cropped_end = (bool)currentPage.checkEnd.IsChecked; cropped_begin_time = new TimeSpan((int)currentPage.numStartHour.Value, (int)currentPage.numStartMinute.Value, (int)currentPage.numStartSecond.Value);