diff --git a/iina/Base.lproj/Localizable.strings b/iina/Base.lproj/Localizable.strings
index a0142faf2cb..b2e4abcfae6 100644
--- a/iina/Base.lproj/Localizable.strings
+++ b/iina/Base.lproj/Localizable.strings
@@ -80,7 +80,8 @@
"osd.find_online_sub" = "Finding online subtitles…";
"osd.find_online_sub.source" = "from";
"osd.sub_not_found" = "No subtitles found";
-"osd.sub_found" = "%d subtitles found. Downloading…";
+"osd.sub_found" = "%d subtitles found.";
+"osd.sub_downloading" = "Downloading %d subtitles";
"osd.sub_downloaded" = "Subtitle downloaded";
"osd.sub_saved" = "Subtitle saved";
"osd.network_error" = "Network error";
diff --git a/iina/Base.lproj/SubChooseViewController.xib b/iina/Base.lproj/SubChooseViewController.xib
index 4ebd2a46346..abcf5091114 100644
--- a/iina/Base.lproj/SubChooseViewController.xib
+++ b/iina/Base.lproj/SubChooseViewController.xib
@@ -16,30 +16,28 @@
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
+
+
-
+
@@ -52,53 +50,53 @@
-
+
-
-
-
+
+
+
-
+
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -109,9 +107,20 @@
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -120,7 +129,7 @@
-
+
-
+
-
+
-
-
+
+
+
diff --git a/iina/Extensions.swift b/iina/Extensions.swift
index e8037334d20..6e8604e88b6 100644
--- a/iina/Extensions.swift
+++ b/iina/Extensions.swift
@@ -280,6 +280,15 @@ extension BinaryInteger {
}
}
+// Formats a number to max 2 digits after the decimal, rounded, but will omit trailing zeroes, and no commas or other formatting for large numbers
+fileprivate let fmtDecimalMaxFractionDigits2: NumberFormatter = {
+ let fmt = NumberFormatter()
+ fmt.numberStyle = .decimal
+ fmt.usesGroupingSeparator = false
+ fmt.maximumFractionDigits = 2
+ return fmt
+}()
+
extension FloatingPoint {
func clamped(to range: Range) -> Self {
if self < range.lowerBound {
@@ -290,6 +299,12 @@ extension FloatingPoint {
return self
}
}
+
+ /// Formats as String, rounding the number to 2 digits after the decimal
+ var stringMaxFrac2: String {
+ return fmtDecimalMaxFractionDigits2.string(for: self)!
+ }
+
}
extension NSColor {
diff --git a/iina/OSDMessage.swift b/iina/OSDMessage.swift
index 3a9566bfd05..048163303eb 100644
--- a/iina/OSDMessage.swift
+++ b/iina/OSDMessage.swift
@@ -67,6 +67,7 @@ enum OSDMessage {
case startFindingSub(String) // sub source
case foundSub(Int)
+ case downloadingSub(Int, String) // download count, ssub source
case downloadedSub(String) // filename
case savedSub
case cannotLogin
@@ -289,9 +290,13 @@ enum OSDMessage {
case .foundSub(let count):
let str = count == 0 ?
NSLocalizedString("osd.sub_not_found", comment: "No subtitles found.") :
- String(format: NSLocalizedString("osd.sub_found", comment: "%d subtitle(s) found. Downloading..."), count)
+ String(format: NSLocalizedString("osd.sub_found", comment: "%d subtitle(s) found."), count)
return (str, .normal)
+ case .downloadingSub(let count, let source):
+ let str = String(format: NSLocalizedString("osd.sub_downloading", comment: "Downloading %d subtitles"), count)
+ return (str, .withText(NSLocalizedString("osd.find_online_sub.source", comment: "from") + " " + source))
+
case .downloadedSub(let filename):
return (
NSLocalizedString("osd.sub_downloaded", comment: "Subtitle downloaded"),
diff --git a/iina/OnlineSubtitle.swift b/iina/OnlineSubtitle.swift
index 4298557b4df..96359019c0a 100644
--- a/iina/OnlineSubtitle.swift
+++ b/iina/OnlineSubtitle.swift
@@ -144,11 +144,11 @@ class OnlineSubtitle: NSObject {
func fetchSubtitles(url: URL, player: PlayerCore) -> Promise<[URL]> {
return getFetcher().fetch(from: url, withProviderID: providerID, playerCore: player)
- .get { subtitles in
+ .get { [self] subtitles in
if subtitles.isEmpty {
throw OnlineSubtitle.CommonError.noResult
} else {
- player.sendOSD(.foundSub(subtitles.count))
+ player.sendOSD(.downloadingSub(subtitles.count, name))
}
}.thenFlatMap { subtitle in
subtitle.download()
diff --git a/iina/OpenSubClient.swift b/iina/OpenSubClient.swift
index 7135bbaaacc..10d2816829f 100644
--- a/iina/OpenSubClient.swift
+++ b/iina/OpenSubClient.swift
@@ -805,9 +805,7 @@ class OpenSubClient {
var comments: String?
#endif
var downloadCount: Int
-#if DEBUG
var featureDetails: SubtitleFeatureDetails
-#endif
var files: [SubtitleFile]
#if DEBUG
var foreignPartsOnly: Bool?
diff --git a/iina/OpenSubSubtitle.swift b/iina/OpenSubSubtitle.swift
index 8cc2217cbe6..84082b017f5 100644
--- a/iina/OpenSubSubtitle.swift
+++ b/iina/OpenSubSubtitle.swift
@@ -19,7 +19,7 @@ class OpenSub {
private static let dateFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
- dateFormatter.timeStyle = .medium
+ dateFormatter.timeStyle = .none
return dateFormatter
}()
@@ -72,22 +72,25 @@ class OpenSub {
/// view displayed to the user for choosing the subtitle files to download.
override func getDescription() -> (name: String, left: String, right: String) {
let attributes = subtitle.attributes
- let downloadCount = String(attributes.downloadCount)
- let filename = attributes.files[0].fileName
- let framesPerSecond: String
+ var tokens: [String] = []
+
+ tokens.append(attributes.language)
+
+ if let releaseYear = attributes.featureDetails.year, releaseYear > 0 {
+ tokens.append("(\(releaseYear))")
+ }
+
if let fps = attributes.fps, fps != 0 {
- framesPerSecond = " \(String(Int(fps.rounded(.up)))) fps"
- } else {
- framesPerSecond = ""
+ tokens.append("\(fps.stringMaxFrac2) fps")
}
- let language = attributes.language
- let rating = String(attributes.ratings)
+
+ let downloadCount = "\u{2b07}\(attributes.downloadCount)"
+ tokens.append(downloadCount)
+
+ let fileName = attributes.files[0].fileName
+ let description = tokens.joined(separator: " ")
let uploadDate = OpenSub.Subtitle.dateFormatter.string(from: attributes.uploadDate)
- return (
- filename,
- "\(language)\(framesPerSecond) \u{2b07}\(downloadCount) \u{2605}\(rating)",
- uploadDate
- )
+ return (fileName, description, uploadDate)
}
}
diff --git a/iina/SubChooseViewController.swift b/iina/SubChooseViewController.swift
index 7901d120fff..a625cb502da 100644
--- a/iina/SubChooseViewController.swift
+++ b/iina/SubChooseViewController.swift
@@ -26,6 +26,11 @@ class SubChooseViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
+ if let scrollView = tableView.enclosingScrollView {
+ scrollView.wantsLayer = true
+ scrollView.layer?.cornerRadius = 6
+ }
+
tableView.delegate = self
tableView.dataSource = self