From c777d6e3d8ab292fed32b0c50c10b7b8006812a7 Mon Sep 17 00:00:00 2001 From: Guillaume Louel Date: Sat, 26 Jan 2019 16:06:06 +0100 Subject: [PATCH] 1.4.7 beta, new videos from jan 25th, sparkle for auto updates, bug fix for missing cache folder, new Update pane interface (in progress) --- Aerial/App/Resources/Info.plist | 8 +- .../PreferencesWindowController.swift | 28 ++- Aerial/Source/Models/AerialVideo.swift | 6 + Aerial/Source/Models/Cache/VideoCache.swift | 13 +- Aerial/Source/Models/ErrorLog.swift | 6 + Aerial/Source/Models/ManifestLoader.swift | 6 +- Resources/Community/en.json | 8 +- Resources/Community/missingvideos.json | 21 -- Resources/Info.plist | 4 +- Resources/PreferencesWindow.xib | 201 ++++++++++++------ 10 files changed, 201 insertions(+), 100 deletions(-) diff --git a/Aerial/App/Resources/Info.plist b/Aerial/App/Resources/Info.plist index 102bac93..dccb0d78 100644 --- a/Aerial/App/Resources/Info.plist +++ b/Aerial/App/Resources/Info.plist @@ -39,11 +39,11 @@ Aerial uses location services to calculate Sunset and Sunrise times from your position NSMainNibFile MainMenu - SUPublicEDKey - fbiQGEFq55xl4bjwj2/SpIO4JMsKmEyhHEWlMMueyDY= - SUFeedURL - https://raw.githubusercontent.com/JohnCoates/Aerial/master/appcast.xml NSPrincipalClass NSApplication + SUFeedURL + https://raw.githubusercontent.com/JohnCoates/Aerial/master/appcast.xml + SUPublicEDKey + fbiQGEFq55xl4bjwj2/SpIO4JMsKmEyhHEWlMMueyDY= diff --git a/Aerial/Source/Controllers/PreferencesWindowController.swift b/Aerial/Source/Controllers/PreferencesWindowController.swift index f596ab2b..fc33f78f 100644 --- a/Aerial/Source/Controllers/PreferencesWindowController.swift +++ b/Aerial/Source/Controllers/PreferencesWindowController.swift @@ -188,6 +188,11 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo @IBOutlet var moveOldVideosButton: NSButton! @IBOutlet var trashOldVideosButton: NSButton! + + @IBOutlet var automaticallyCheckForUpdatesCheckbox: NSButton! + + @IBOutlet var lastCheckedSparkle: NSTextField! + var player: AVPlayer = AVPlayer() var videos: [AerialVideo]? @@ -206,6 +211,7 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo var savedBrightness: Float? var locationManager: CLLocationManager? + var sparkleUpdater: SUUpdater? public var appMode: Bool = false @@ -241,6 +247,7 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo // swiftlint:disable:next cyclomatic_complexity override func awakeFromNib() { super.awakeFromNib() + sparkleUpdater = SUUpdater.init(for: Bundle(for: PreferencesWindowController.self)) // tmp let tm = TimeManagement.sharedInstance @@ -535,6 +542,16 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo newVideosModePopup.selectItem(at: preferences.newVideosMode!) lastCheckedVideosLabel.stringValue = "Last checked on " + preferences.lastVideoCheck! + + // Format date + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd" + let sparkleDate = dateFormatter.string(from: sparkleUpdater!.lastUpdateCheckDate) + lastCheckedSparkle.stringValue = "Last checked on " + sparkleDate + if sparkleUpdater!.automaticallyChecksForUpdates { + automaticallyCheckForUpdatesCheckbox.state = .on + } + colorizeProjectPageLinks() if let cacheDirectory = VideoCache.cacheDirectory { @@ -1309,6 +1326,13 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo debugLog("UI dimInMinutes \(sender.stringValue)") } + // MARK: - Update panel + @IBAction func automaticallyCheckForUpdatesChange(_ button: NSButton) { + let onState = button.state == .on + sparkleUpdater!.automaticallyChecksForUpdates = onState + debugLog("UI automaticallyCheckForUpdatesChange: \(onState)") + } + // MARK: - Advanced panel @IBAction func logButtonClick(_ sender: NSButton) { @@ -1401,9 +1425,9 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo @IBAction func checkForUpdatesButton(_ sender: Any) { debugLog("check for updates") - let supd = SUUpdater.init(for: Bundle(for: PreferencesWindowController.self)) - supd?.checkForUpdates(self) + sparkleUpdater!.checkForUpdates(self) } + @IBAction func trashOldVideosClick(_ sender: Any) { ManifestLoader.instance.trashOldVideos() diff --git a/Aerial/Source/Models/AerialVideo.swift b/Aerial/Source/Models/AerialVideo.swift index 064f4cde..d779b040 100644 --- a/Aerial/Source/Models/AerialVideo.swift +++ b/Aerial/Source/Models/AerialVideo.swift @@ -33,6 +33,9 @@ private let spaceVideos = [ "7719B48A-2005-4011-9280-2F64EEC6FD91", "63C042F0-90EF-4A95-B7CC-CC9A64BF8421", "B1B5DDC5-73C8-4920-8133-BACCE38A08DE", + "03EC0F5E-CCA8-4E0A-9FEC-5BD1CE151182", // 25/01 Antartica Aurora + "737E9E24-49BE-4104-9B72-F352DE1AD2BF", // North America Aurora + "E556BBC5-D0A0-4DB1-AC77-BC76E4A526F4", // Sahara and Italy ] private let timeInformation = [ @@ -52,6 +55,7 @@ private let timeInformation = [ "009BA758-7060-4479-8EE8-FB9B40C8FB97": "night", // Korean and Japan Night (v18) "78911B7E-3C69-47AD-B635-9C2486F6301D": "day", // New Zealand (sunrise...) "D60B4DDA-69EB-4841-9690-E8BAE7BC4F80": "day", // Sahara and Italy + "E556BBC5-D0A0-4DB1-AC77-BC76E4A526F4": "day", // Sahara and Italy "7719B48A-2005-4011-9280-2F64EEC6FD91": "day", // Southern California to Baja "63C042F0-90EF-4A95-B7CC-CC9A64BF8421": "day", // Western Africa to the Alps (sunset...) "BAF76353-3475-4855-B7E1-CE96CC9BC3A7": "night", // Dubai @@ -72,6 +76,8 @@ private let timeInformation = [ "F5804DD6-5963-40DA-9FA0-39C0C6E6DEF9": "night", // Downtown (LA) "640DFB00-FBB9-45DA-9444-9F663859F4BC": "night", // Lower Manhattan "44166C39-8566-4ECA-BD16-43159429B52F": "night", // Seventh Avenue + "03EC0F5E-CCA8-4E0A-9FEC-5BD1CE151182": "night", // Antartica Aurora + "737E9E24-49BE-4104-9B72-F352DE1AD2BF": "night", // North America Aurora ] final class AerialVideo: CustomStringConvertible, Equatable { diff --git a/Aerial/Source/Models/Cache/VideoCache.swift b/Aerial/Source/Models/Cache/VideoCache.swift index 8178136b..27452c0a 100644 --- a/Aerial/Source/Models/Cache/VideoCache.swift +++ b/Aerial/Source/Models/Cache/VideoCache.swift @@ -29,9 +29,16 @@ final class VideoCache { let preferences = Preferences.sharedInstance if let customCacheDirectory = preferences.customCacheDirectory { - // We may have overriden the cache directory - cacheDirectory = customCacheDirectory - } else { + // We may have overriden the cache directory, but it may no longer exist ! + if FileManager.default.fileExists(atPath: customCacheDirectory as String) { + cacheDirectory = customCacheDirectory + } else { + // If it doesn't we need to reset that preference + preferences.customCacheDirectory = nil + } + } + + if cacheDirectory == nil { let localCachePaths = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .localDomainMask, true) diff --git a/Aerial/Source/Models/ErrorLog.swift b/Aerial/Source/Models/ErrorLog.swift index 7fe38f58..c2aa56e7 100644 --- a/Aerial/Source/Models/ErrorLog.swift +++ b/Aerial/Source/Models/ErrorLog.swift @@ -73,6 +73,7 @@ func Log(level: ErrorLevel, message: String) { } // We may log to disk, asyncly + // Comment the firt if to always log to disk if preferences.logToDisk { DispatchQueue.main.async { let dateFormatter = DateFormatter() @@ -80,6 +81,10 @@ func Log(level: ErrorLevel, message: String) { dateFormatter.timeStyle = .medium let string = dateFormatter.string(from: Date()) + " : " + message + "\n" //let string = message + "\n" + + // tmpOverride + //if var cacheFileUrl = try? FileManager.default.url(for: .desktopDirectory, in: .userDomainMask, appropriateFor: nil, create: false) { + if let cacheDirectory = VideoCache.cacheDirectory { var cacheFileUrl = URL(fileURLWithPath: cacheDirectory as String) cacheFileUrl.appendPathComponent("AerialLog.txt") @@ -115,6 +120,7 @@ func debugLog(_ message: String) { print("\(message)\n") #endif + // Comment the condition to always log debug mode let preferences = Preferences.sharedInstance if preferences.debugMode { Log(level: .debug, message: message) diff --git a/Aerial/Source/Models/ManifestLoader.swift b/Aerial/Source/Models/ManifestLoader.swift index 205e1a22..68f382fe 100644 --- a/Aerial/Source/Models/ManifestLoader.swift +++ b/Aerial/Source/Models/ManifestLoader.swift @@ -37,7 +37,8 @@ class ManifestLoader { "b9-1.mov", // Dupe of b2-2 (Hawaii, day) "b9-2.mov", // Dupe of b3-1 (London, night) "comp_LA_A005_C009_v05_t9_6M.mov", // Low quality version of Los Angeles day 687B36CB-BA5D-4434-BA99-2F2B8B6EC163 - "comp_LA_A009_C009_t9_6M_tag0.mov", ] // Low quality version of Los Angeles night 89B1643B-06DD-4DEC-B1B0-774493B0F7B7 + "comp_LA_A009_C009_t9_6M_tag0.mov", + ] // Low quality version of Los Angeles night 89B1643B-06DD-4DEC-B1B0-774493B0F7B7 // This is used for videos where URLs should be merged with different ID // This is used to dedupe old versions of videos @@ -56,6 +57,8 @@ class ManifestLoader { "802866E6-4AAF-4A69-96EA-C582651391F1": "3FFA2A97-7D28-49EA-AA39-5BC9051B2745", // Marina 2 "D34A7B19-EC33-4300-B4ED-0C8BC494C035": "3FFA2A97-7D28-49EA-AA39-5BC9051B2745", // Marina 2 "02EA5DBE-3A67-4DFA-8528-12901DFD6CC1": "00BA71CD-2C54-415A-A68A-8358E677D750", // Downtown + "AC9C09DD-1D97-4013-A09F-B0F5259E64C3": "876D51F4-3D78-4221-8AD2-F9E78C0FD9B9", // Sheikh Zayed Road (day) + "DFA399FA-620A-4517-94D6-BF78BF8C5E5A": "876D51F4-3D78-4221-8AD2-F9E78C0FD9B9", // Sheikh Zayed Road (day) "D388F00A-5A32-4431-A95C-38BF7FF7268D": "B8F204CE-6024-49AB-85F9-7CA2F6DCD226", // Nuusuaq Peninsula "E4ED0B22-EB81-4D4F-A29E-7E1EA6B6D980": "B8F204CE-6024-49AB-85F9-7CA2F6DCD226", // Nuusuaq Peninsula "30047FDA-3AE3-4E74-9575-3520AD77865B": "2F52E34C-39D4-4AB1-9025-8F7141FAA720", // Ilulissat Icefjord day @@ -90,6 +93,7 @@ class ManifestLoader { "b1-4": "3E94AE98-EAF2-4B09-96E3-452F46BC114E", // Bay bridge night "b9-3": "DE851E6D-C2BE-4D9F-AB54-0F9CE994DC51", // Bay and Golden Bridge "b7-3": "29BDF297-EB43-403A-8719-A78DA11A2948", // Fisherman's Wharf + "b3-3": "85CE77BF-3413-4A7B-9B0F-732E96229A73", // Embarcadero, Market Street ] // Extra info to be merged for a given ID, as of right now only one known video diff --git a/Resources/Community/en.json b/Resources/Community/en.json index 1bc3be16..5b45abf3 100644 --- a/Resources/Community/en.json +++ b/Resources/Community/en.json @@ -39,7 +39,7 @@ "name" : "Great Wall 3" }, { - "id" : "AC9C09DD-1D97-4013-A09F-B0F5259E64C3", + "id" : "876D51F4-3D78-4221-8AD2-F9E78C0FD9B9", "name" : "Sheikh Zayed Road" }, { @@ -312,7 +312,7 @@ } }, { - "id" : "b3-3", + "id" : "85CE77BF-3413-4A7B-9B0F-732E96229A73", "name" : "Embarcadero, Market Street", "pointsOfInterest" : { "0" : "Heading southwest over San Francisco Bay to the San Francisco Ferry Building", @@ -373,6 +373,10 @@ "10" : "Passing the Transamerica Pyramid", "50" : "Former Bank of America headquarters blotting out the sun" } + }, + { + "id" : "4AD99907-9E76-408D-A7FC-8429FF014201", + "name" : "Bay and Embarcadero" } ] } diff --git a/Resources/Community/missingvideos.json b/Resources/Community/missingvideos.json index 7529007d..c169b702 100644 --- a/Resources/Community/missingvideos.json +++ b/Resources/Community/missingvideos.json @@ -1,26 +1,5 @@ { "assets" : [ - { - "pointsOfInterest" : { - "285" : "A009_C001_10181A_285", - "245" : "A009_C001_10181A_245", - "310" : "A009_C001_10181A_310", - "0" : "A009_C001_10181A_0", - "30" : "A009_C001_10181A_30", - "195" : "A009_C001_10181A_195", - "110" : "A009_C001_10181A_110", - "230" : "A009_C001_10181A_230", - "155" : "A009_C001_10181A_155", - "210" : "A009_C001_10181A_210" - }, - "url-1080-H264" : "https:\/\/sylvan.apple.com\/Videos\/comp_A009_C001_010181A_v09_SDR_PS_FINAL_20180725_SDR_2K_AVC.mov", - "accessibilityLabel" : "Sahara and Italy", - "id" : "D60B4DDA-69EB-4841-9690-E8BAE7BC4F80", - "url-1080-HDR" : "https:\/\/sylvan.apple.com\/Aerials\/2x\/Videos\/comp_A009_C001_010181A_v09_HDR_PS_FINAL_20180725_HDR_2K_HEVC.mov", - "url-1080-SDR" : "https:\/\/sylvan.apple.com\/Aerials\/2x\/Videos\/comp_A009_C001_010181A_v09_SDR_PS_FINAL_20180725_SDR_2K_HEVC.mov", - "url-4K-SDR" : "https:\/\/sylvan.apple.com\/Aerials\/2x\/Videos\/comp_A009_C001_010181A_v09_SDR_PS_FINAL_20180725_SDR_4K_HEVC.mov", - "url-4K-HDR" : "https:\/\/sylvan.apple.com\/Aerials\/2x\/Videos\/comp_A009_C001_010181A_v09_HDR_PS_FINAL_20180725_HDR_4K_HEVC.mov" - }, { "pointsOfInterest" : { "0" : "HK_H004_C001_0" diff --git a/Resources/Info.plist b/Resources/Info.plist index 02e1be54..019a3491 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.4.6test1 + 1.4.7beta1 CFBundleSignature ???? CFBundleVersion - 1.4.6test1 + 1.4.7beta1 LSApplicationCategoryType LSMinimumSystemVersion diff --git a/Resources/PreferencesWindow.xib b/Resources/PreferencesWindow.xib index de434470..3f5f8b1f 100644 --- a/Resources/PreferencesWindow.xib +++ b/Resources/PreferencesWindow.xib @@ -10,6 +10,7 @@ + @@ -59,6 +60,7 @@ + @@ -526,7 +528,7 @@ is disabled - + @@ -1328,7 +1330,7 @@ Shift, but macOS 10.12.4 or above and a compatible Mac are required) - + @@ -1443,8 +1445,16 @@ Shift, but macOS 10.12.4 or above and a compatible Mac are required) + + + + + + + + - + @@ -1461,8 +1471,28 @@ Shift, but macOS 10.12.4 or above and a compatible Mac are required) + + + + + + + + + + - + @@ -1470,26 +1500,78 @@ Shift, but macOS 10.12.4 or above and a compatible Mac are required) - - + + - + - + + + + + + + + + + @@ -1498,6 +1580,48 @@ Shift, but macOS 10.12.4 or above and a compatible Mac are required) + + + + + + + + + + + + + + + Apple periodically updates its JSON, to either add new videos, or add new versions of existing videos. This will result, over time, in duplicate videos on your disk. You can use the settings below to put aside the old versions of videos or reclaim disk space. + + + + + + + + + + + + + + + + + -