mirror of
https://github.com/yattee/yattee.git
synced 2026-08-06 07:11:28 +00:00
Add loading external subtitle files for media-source playback
Adds a "Load subtitle from file…" row to the Subtitles section on iOS (document picker) and macOS (open panel), available when playing files from local folder, SMB, or WebDAV sources. The picked file is copied into the per-video temp subtitle directory, registered as a selectable Caption (displayed by filename), and activated through the existing loadCaption flow. The Subtitles tab and captions control button now also appear for media-source files without any subtitles.
This commit is contained in:
@@ -18,6 +18,11 @@ struct Caption: Identifiable, Codable, Hashable, Sendable {
|
||||
/// The URL to fetch the caption content
|
||||
let url: URL
|
||||
|
||||
/// Original filename of a user-picked external subtitle file.
|
||||
/// When set, it is used as the display name so two picked files with the
|
||||
/// same language remain distinguishable from API captions and each other.
|
||||
var pickedFileName: String? = nil
|
||||
|
||||
/// Whether this is an auto-generated caption
|
||||
var isAutoGenerated: Bool {
|
||||
label.contains("auto-generated")
|
||||
@@ -37,6 +42,9 @@ struct Caption: Identifiable, Codable, Hashable, Sendable {
|
||||
|
||||
/// Formatted display name for the caption
|
||||
var displayName: String {
|
||||
if let pickedFileName {
|
||||
return pickedFileName
|
||||
}
|
||||
// Try to get localized language name (AUTO badge shown separately in UI)
|
||||
if let localizedName = Locale.current.localizedString(forLanguageCode: baseLanguageCode) {
|
||||
return localizedName
|
||||
|
||||
Reference in New Issue
Block a user