From 8e75a5c7271aa8796acaf89f96939e7d97d019e5 Mon Sep 17 00:00:00 2001 From: Cristian Stoica Date: Fri, 8 Mar 2024 20:24:14 +0200 Subject: [PATCH] Fixed incorrect index in filenames when converting videos to audio (e.g., mp3). --- YoutubePlaylistDownloader/DownloadPage.xaml.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/YoutubePlaylistDownloader/DownloadPage.xaml.cs b/YoutubePlaylistDownloader/DownloadPage.xaml.cs index c6ea6b6..cae51e1 100644 --- a/YoutubePlaylistDownloader/DownloadPage.xaml.cs +++ b/YoutubePlaylistDownloader/DownloadPage.xaml.cs @@ -416,7 +416,8 @@ await Dispatcher.InvokeAsync(() => if (TagAudioFile) { - var afterTagName = await GlobalConsts.TagFile(video, indexes[video], outputFileLoc, Playlist); + var videoIndex = indexes[video]; + var afterTagName = await GlobalConsts.TagFile(video, videoIndex, outputFileLoc, Playlist); FileType = new string(copyFileLoc.Skip(copyFileLoc.LastIndexOf('.') + 1).ToArray()); if (afterTagName != outputFileLoc) { @@ -425,7 +426,7 @@ await Dispatcher.InvokeAsync(() => video = new PlaylistVideo(playlistId.Value, video.Id, afterTagName, video.Author, video.Duration, video.Thumbnails); } - cleanFileName = GlobalConsts.CleanFileName(downloadSettings.GetFilenameByPattern(video, i, title, Playlist)); + cleanFileName = GlobalConsts.CleanFileName(downloadSettings.GetFilenameByPattern(video, videoIndex - 1, title, Playlist)); copyFileLoc = $"{SavePath}\\{cleanFileName}.{FileType}"; } }