diff --git a/Aerial/App/Resources/Info.plist b/Aerial/App/Resources/Info.plist
index 74bdec92..5fd57064 100644
--- a/Aerial/App/Resources/Info.plist
+++ b/Aerial/App/Resources/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.4.6beta1
+ 1.4.6beta4
CFBundleSignature
????
CFBundleVersion
diff --git a/Aerial/Source/Controllers/PreferencesWindowController.swift b/Aerial/Source/Controllers/PreferencesWindowController.swift
index db795a56..af5d5566 100644
--- a/Aerial/Source/Controllers/PreferencesWindowController.swift
+++ b/Aerial/Source/Controllers/PreferencesWindowController.swift
@@ -181,6 +181,7 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
@IBOutlet var newVideosModePopup: NSPopUpButton!
@IBOutlet var lastCheckedVideosLabel: NSTextField!
+ @IBOutlet var checkNowButton: NSButton!
var player: AVPlayer = AVPlayer()
@@ -568,6 +569,9 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
}
@IBAction func close(_ sender: AnyObject?) {
+ // This seems needed for screensavers as our lifecycle is different from a regular app
+ preferences.synchronize()
+
logPanel.close()
if appMode {
NSApplication.shared.terminate(nil)
@@ -1061,6 +1065,11 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
preferences.newVideosMode = sender.indexOfSelectedItem
}
+ @IBAction func checkNowButtonClick(_ sender: NSButton) {
+ checkNowButton.isEnabled = false
+ // TODO
+ }
+
// MARK: - Time panel
@IBAction func overrideNightOnDarkModeClick(_ button: NSButton) {
@@ -1478,14 +1487,17 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
}
func downloadAllVideos() {
- guard let videos = videos else {
- return
- }
let videoManager = VideoManager.sharedInstance
-
- for video in videos where !video.isAvailableOffline {
- if !videoManager.isVideoQueued(id: video.id) {
- videoManager.queueDownload(video)
+ for city in cities {
+ for video in city.day.videos where !video.isAvailableOffline {
+ if !videoManager.isVideoQueued(id: video.id) {
+ videoManager.queueDownload(video)
+ }
+ }
+ for video in city.night.videos where !video.isAvailableOffline {
+ if !videoManager.isVideoQueued(id: video.id) {
+ videoManager.queueDownload(video)
+ }
}
}
}
@@ -1526,6 +1538,10 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
}
}
+ func reloadJson() {
+ ManifestLoader.instance.reloadFiles()
+ }
+
func loaded(manifestVideos: [AerialVideo]) {
var videos = [AerialVideo]()
var cities = [String: City]()
diff --git a/Aerial/Source/Models/Cache/VideoCache.swift b/Aerial/Source/Models/Cache/VideoCache.swift
index 214da43a..5145ce93 100644
--- a/Aerial/Source/Models/Cache/VideoCache.swift
+++ b/Aerial/Source/Models/Cache/VideoCache.swift
@@ -20,15 +20,21 @@ final class VideoCache {
static var cacheDirectory: String? {
var cacheDirectory: String?
-
let preferences = Preferences.sharedInstance
+
if let customCacheDirectory = preferences.customCacheDirectory {
+ //NSLog("AerialP: \(customCacheDirectory)")
cacheDirectory = customCacheDirectory
} else {
let cachePaths = NSSearchPathForDirectoriesInDomains(.cachesDirectory,
.userDomainMask,
true)
+
+ //NSLog("AerialP: cachePaths.count : \(cachePaths.count)")
+ //NSLog("AerialP: cachePaths \(cachePaths)")
+
if cachePaths.isEmpty {
+ //NSLog("AerialP: no cache paths")
errorLog("Couldn't find cache paths!")
return nil
}
@@ -39,6 +45,8 @@ final class VideoCache {
cacheDirectory = defaultCacheDirectory
}
+ //NSLog("AerialP: cd \(String(describing: cacheDirectory))")
+
guard let appCacheDirectory = cacheDirectory else {
return nil
}
@@ -49,10 +57,13 @@ final class VideoCache {
try fileManager.createDirectory(atPath: appCacheDirectory as String,
withIntermediateDirectories: false, attributes: nil)
} catch let error {
+ //NSLog("AerialP: couldn't create cache directory")
errorLog("Couldn't create cache directory: \(error)")
return nil
}
}
+
+ //NSLog("AerialP: acd \(appCacheDirectory)")
return appCacheDirectory
}
diff --git a/Aerial/Source/Models/ErrorLog.swift b/Aerial/Source/Models/ErrorLog.swift
index 133c9407..fbc2fb53 100644
--- a/Aerial/Source/Models/ErrorLog.swift
+++ b/Aerial/Source/Models/ErrorLog.swift
@@ -72,34 +72,40 @@ func Log(level: ErrorLevel, message: String) {
logger.callBack(level: level)
}
- // We may log to disk
+ // We may log to disk, asyncly
if preferences.logToDisk {
- let dateFormatter = DateFormatter()
- dateFormatter.dateStyle = .none
- dateFormatter.timeStyle = .medium
- let string = dateFormatter.string(from: Date()) + " : " + message + "\n"
- //let string = message + "\n"
- if let cacheDirectory = VideoCache.cacheDirectory {
- var cacheFileUrl = URL(fileURLWithPath: cacheDirectory as String)
- cacheFileUrl.appendPathComponent("AerialLog.txt")
-
- let data = string.data(using: String.Encoding.utf8, allowLossyConversion: false)!
- //let data = message.data(using: String.Encoding.utf8, allowLossyConversion: false)!
-
- if FileManager.default.fileExists(atPath: cacheFileUrl.path) {
- do {
- let fileHandle = try FileHandle(forWritingTo: cacheFileUrl)
- fileHandle.seekToEndOfFile()
- fileHandle.write(data)
- fileHandle.closeFile()
- } catch {
- print("Can't open handle")
+ DispatchQueue.main.async {
+ let dateFormatter = DateFormatter()
+ dateFormatter.dateStyle = .none
+ dateFormatter.timeStyle = .medium
+ let string = dateFormatter.string(from: Date()) + " : " + message + "\n"
+ //let string = message + "\n"
+ if let cacheDirectory = VideoCache.cacheDirectory {
+ if VideoCache.cacheDirectory == nil {
+ NSLog("AerialError: No cache directory, this is super bad")
}
- } else {
- do {
- try data.write(to: cacheFileUrl, options: .atomic)
- } catch {
- print("Can't write to file")
+
+ var cacheFileUrl = URL(fileURLWithPath: cacheDirectory as String)
+ cacheFileUrl.appendPathComponent("AerialLog.txt")
+
+ let data = string.data(using: String.Encoding.utf8, allowLossyConversion: false)!
+ //let data = message.data(using: String.Encoding.utf8, allowLossyConversion: false)!
+
+ if FileManager.default.fileExists(atPath: cacheFileUrl.path) {
+ do {
+ let fileHandle = try FileHandle(forWritingTo: cacheFileUrl)
+ fileHandle.seekToEndOfFile()
+ fileHandle.write(data)
+ fileHandle.closeFile()
+ } catch {
+ print("Can't open handle")
+ }
+ } else {
+ do {
+ try data.write(to: cacheFileUrl, options: .atomic)
+ } catch {
+ print("Can't write to file")
+ }
}
}
}
diff --git a/Aerial/Source/Models/ManifestLoader.swift b/Aerial/Source/Models/ManifestLoader.swift
index c6414637..51bf2148 100644
--- a/Aerial/Source/Models/ManifestLoader.swift
+++ b/Aerial/Source/Models/ManifestLoader.swift
@@ -293,6 +293,10 @@ class ManifestLoader {
}
}
+ func reloadFiles() {
+ // TODO
+ }
+
func addCallback(_ callback:@escaping ManifestLoadCallback) {
if !loadedManifest.isEmpty {
callback(loadedManifest)
diff --git a/Resources/Info.plist b/Resources/Info.plist
index 3a443bef..dc63ba39 100644
--- a/Resources/Info.plist
+++ b/Resources/Info.plist
@@ -15,11 +15,11 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 1.4.6beta3
+ 1.4.6beta4
CFBundleSignature
????
CFBundleVersion
- 1.4.6beta3
+ 1.4.6beta4
LSApplicationCategoryType
LSMinimumSystemVersion
diff --git a/Resources/PreferencesWindow.xib b/Resources/PreferencesWindow.xib
index 3be80b47..2de08168 100644
--- a/Resources/PreferencesWindow.xib
+++ b/Resources/PreferencesWindow.xib
@@ -15,6 +15,7 @@
+
@@ -137,7 +138,7 @@
-
+
@@ -1323,7 +1324,7 @@ Shift, but macOS 10.12.4 or above and a compatible Mac are required)
-
+
@@ -1474,6 +1475,17 @@ Shift, but macOS 10.12.4 or above and a compatible Mac are required)
+