From 559039b00d30e5caac3b0d37cf6b6b896f9294eb Mon Sep 17 00:00:00 2001 From: Artem Tyurin Date: Sat, 29 Jul 2023 12:40:24 +0200 Subject: [PATCH] Add ability to use $VIDEO_ID in custom URL setting --- Telik/Model.swift | 4 +++- Telik/SettingsView.swift | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Telik/Model.swift b/Telik/Model.swift index 9b57367..84fd7f2 100644 --- a/Telik/Model.swift +++ b/Telik/Model.swift @@ -210,7 +210,9 @@ struct SourceInfo { case .usual: return video.getStandardYouTubeURL() case .customURL: - let finalURL = customOpenCommand.replacingOccurrences(of: "$URL", with: "\(video.getStandardYouTubeURL())") + let finalURL = customOpenCommand + .replacingOccurrences(of: "$URL", with: "\(video.getStandardYouTubeURL())") + .replacingOccurrences(of: "$VIDEO_ID", with: "\(video.id)") guard let url = URL(string: finalURL) else { return video.getStandardYouTubeURL() } diff --git a/Telik/SettingsView.swift b/Telik/SettingsView.swift index 60a103d..6be2854 100644 --- a/Telik/SettingsView.swift +++ b/Telik/SettingsView.swift @@ -39,7 +39,7 @@ struct SettingsView: View { } if model.selectedDomain == .customURL { TextField("Custom URL", text: $model.customOpenCommand) - Text("Use $URL for YouTube URL").font(.caption).foregroundColor(.gray) + Text("Use $URL for the full YouTube URL or $VIDEO_ID for the video ID").font(.caption).foregroundColor(.gray) } Toggle(isOn: $model.hideShorts) { Text("Hide videos with #shorts in the title")