diff --git a/Sources/Firelink/DownloadController.swift b/Sources/Firelink/DownloadController.swift index 4724401..a8be0af 100644 --- a/Sources/Firelink/DownloadController.swift +++ b/Sources/Firelink/DownloadController.swift @@ -572,9 +572,6 @@ final class DownloadController: ObservableObject { $0.etaText = progress.etaText } $0.connectionCount = progress.connectionCount - if $0.message == "Starting" { - $0.message = "Downloading Media" - } } } }, diff --git a/Sources/Firelink/MediaDownloadEngine.swift b/Sources/Firelink/MediaDownloadEngine.swift index 15faaa8..0d33a9b 100644 --- a/Sources/Firelink/MediaDownloadEngine.swift +++ b/Sources/Firelink/MediaDownloadEngine.swift @@ -263,6 +263,7 @@ final class YTDLPOutputHandler: @unchecked Sendable { private let outputPathTracker: YTDLPOutputPathTracker private let progress: @Sendable (DownloadProgress) -> Void private let messageUpdate: @Sendable (String) -> Void + private var trackCount = 0 init( parser: YTDLPProgressParser, @@ -280,18 +281,17 @@ final class YTDLPOutputHandler: @unchecked Sendable { for line in text.split(whereSeparator: \.isNewline) { let stringLine = String(line) outputPathTracker.observe(stringLine) - if let update = parser.parse(stringLine) { - progress(update) - messageUpdate("Downloading Media") - } else if let message = statusMessage(for: stringLine) { + if let message = statusMessage(for: stringLine) { messageUpdate(message) + } else if let update = parser.parse(stringLine) { + progress(update) } } } private func statusMessage(for line: String) -> String? { if line.contains("[Merger]") || line.contains("[ExtractAudio]") || line.contains("[Fixup") { - return "Processing Media..." + return "Merging Media Tracks..." } if line.contains("[youtube]") && line.localizedCaseInsensitiveContains("Downloading") { return "Fetching YouTube data..." @@ -309,7 +309,14 @@ final class YTDLPOutputHandler: @unchecked Sendable { return "YouTube challenge solver unavailable" } if line.contains("Destination:") { - return "Starting media download..." + trackCount += 1 + if trackCount == 1 { + return "Downloading Video Track" + } else if trackCount == 2 { + return "Downloading Audio Track" + } else { + return "Downloading Track \(trackCount)" + } } return nil }