diff --git a/.gitignore b/.gitignore index 723a876d..d211a487 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ DerivedData/ release/ debug.plist Examples/debug.html +Aerial/Source/Models/API/APISecrets.swift diff --git a/Aerial/Source/Models/Sources/SourceList.swift b/Aerial/Source/Models/Sources/SourceList.swift index 1f812948..b5bb93ed 100644 --- a/Aerial/Source/Models/Sources/SourceList.swift +++ b/Aerial/Source/Models/Sources/SourceList.swift @@ -220,7 +220,7 @@ struct SourceList { } } - static func updateLocalSource(source: Source) { + static func updateLocalSource(source: Source, reload: Bool) { // We need the raw manifest to find the path inside let videos = source.getUnprocessedVideos() @@ -257,7 +257,9 @@ struct SourceList { SourceList.saveEntries(source: source, manifest: videoManifest) - VideoList.instance.reloadSources() + if reload { + VideoList.instance.reloadSources() + } } catch { errorLog("Could not process directory") } diff --git a/Aerial/Source/Models/Sources/VideoList.swift b/Aerial/Source/Models/Sources/VideoList.swift index f67d58d8..44f811b2 100644 --- a/Aerial/Source/Models/Sources/VideoList.swift +++ b/Aerial/Source/Models/Sources/VideoList.swift @@ -341,6 +341,13 @@ class VideoList { } } + for source in SourceList.list { + if source.type == .local { + debugLog("\(source.name) updating local source") + SourceList.updateLocalSource(source: source, reload: false) + } + } + if !sourceQueue.isEmpty { // Now queue and download for source in sourceQueue { @@ -414,6 +421,12 @@ class VideoList { return filteredVideosFor(mode, filter: PrefsVideos.newShouldPlayString) } } + + func everythingRotation() -> [AerialVideo] { + return videos + .filter({ !PrefsVideos.hidden.contains($0.id) }) + .sorted { $0.secondaryName < $1.secondaryName } + } // MARK: - Playlist management func generatePlaylist(isRestricted: Bool, restrictedTo: String, isVertical: Bool) { @@ -424,9 +437,16 @@ class VideoList { playlistRestrictedTo = restrictedTo playlistHasVerticalVideos = false - let shuffled = currentRotation().shuffled() + var shuffled = currentRotation().shuffled() + + // If we have nothing, just get everything + if shuffled.count == 0 { + shuffled = everythingRotation().shuffled() + } + let cachedShuffled = shuffled.filter({ $0.isAvailableOffline }) + debugLog("Playlist raw count: \(shuffled.count) raw cached count \(cachedShuffled.count) isRestricted: \(isRestricted) restrictedTo: \(restrictedTo)") if PrefsDisplays.viewingMode == .independent && PrefsAdvanced.favorOrientation { diff --git a/Aerial/Source/Views/AerialView.swift b/Aerial/Source/Views/AerialView.swift index b0512a7b..94c70ce3 100644 --- a/Aerial/Source/Views/AerialView.swift +++ b/Aerial/Source/Views/AerialView.swift @@ -208,7 +208,7 @@ final class AerialView: ScreenSaverView, CAAnimationDelegate { // This will lead to crashing in up to Ventura beta5 so disable let debugTextView = NSTextView(frame: bounds.insetBy(dx: 20, dy: 20)) debugTextView.font = .labelFont(ofSize: 10) - debugTextView.string += "Preview is disabled on Ventura beta" + debugTextView.string += "HDR Previews hidden on Ventura" isDisabled = true self.addSubview(debugTextView) diff --git a/Aerial/Source/Views/Layers/DateLayer.swift b/Aerial/Source/Views/Layers/DateLayer.swift index 477ed80c..8288bf20 100644 --- a/Aerial/Source/Views/Layers/DateLayer.swift +++ b/Aerial/Source/Views/Layers/DateLayer.swift @@ -73,18 +73,27 @@ class DateLayer: AnimationTextLayer { } else { template = "EEEE, MMMM dd" } + + dateFormatter.dateFormat = DateFormatter.dateFormat(fromTemplate: template, options: 0, locale: locale) + dateFormatter.locale = locale + return dateFormatter.string(from: Date()).capitalizeFirstLetter() + } else if config!.format == .compact { if config!.withYear { template = "MM/dd/yy" } else { template = "MM/dd" } + + dateFormatter.dateFormat = DateFormatter.dateFormat(fromTemplate: template, options: 0, locale: locale) + dateFormatter.locale = locale + return dateFormatter.string(from: Date()).capitalizeFirstLetter() } else { - template = PrefsInfo.customDateFormat - } + let RFC3339DateFormatter = DateFormatter() + RFC3339DateFormatter.locale = Locale(identifier: "en_US_POSIX") + RFC3339DateFormatter.dateFormat = PrefsInfo.customDateFormat - dateFormatter.dateFormat = DateFormatter.dateFormat(fromTemplate: template, options: 0, locale: locale) - dateFormatter.locale = locale - return dateFormatter.string(from: Date()).capitalizeFirstLetter() + return RFC3339DateFormatter.string(from: Date()) + } } } diff --git a/Aerial/Source/Views/Sources/DescriptionCellView.swift b/Aerial/Source/Views/Sources/DescriptionCellView.swift index 72e05d0b..5b4e8888 100644 --- a/Aerial/Source/Views/Sources/DescriptionCellView.swift +++ b/Aerial/Source/Views/Sources/DescriptionCellView.swift @@ -74,7 +74,7 @@ class DescriptionCellView: NSTableCellView { VideoList.instance.downloadSource(source: source) } else if source.type == .local { debugLog("Checking local directory") - SourceList.updateLocalSource(source: source) + SourceList.updateLocalSource(source: source, reload: true) } else { debugLog("Refreshing non-cacheable source") VideoList.instance.downloadSource(source: source)