Skip to content

Commit

Permalink
2.0.10 fixes double sources and hopefully some other bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
glouel committed Sep 24, 2020
1 parent 5a11d5a commit 1274705
Show file tree
Hide file tree
Showing 18 changed files with 146 additions and 62 deletions.
24 changes: 8 additions & 16 deletions Aerial.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1451,13 +1451,6 @@
path = MainUI;
sourceTree = "<group>";
};
034DEE3524BF255A00A2D3CD /* MainUI */ = {
isa = PBXGroup;
children = (
);
path = MainUI;
sourceTree = "<group>";
};
034F29B523A7A8E1004B34D5 /* PrefPanel */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1675,7 +1668,6 @@
FAC36F3D1BE1756D007F2A20 /* Controllers */ = {
isa = PBXGroup;
children = (
034DEE3524BF255A00A2D3CD /* MainUI */,
0313F9E722942B4500B074BB /* CustomVideoController.swift */,
);
path = Controllers;
Expand Down Expand Up @@ -2943,13 +2935,13 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.0.0appmode;
CURRENT_PROJECT_VERSION = 2.0.10appmode;
DEVELOPMENT_TEAM = 3L54M5L5KK;
ENABLE_TESTABILITY = YES;
INFOPLIST_FILE = Aerial/App/Resources/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 2.0.0appmode;
MARKETING_VERSION = 2.0.10appmode;
PRODUCT_BUNDLE_IDENTIFIER = "com.johncoates.Aerial-Test";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -2966,13 +2958,13 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.0.0appmode;
CURRENT_PROJECT_VERSION = 2.0.10appmode;
DEVELOPMENT_TEAM = 3L54M5L5KK;
ENABLE_TESTABILITY = YES;
INFOPLIST_FILE = Aerial/App/Resources/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 2.0.0appmode;
MARKETING_VERSION = 2.0.10appmode;
PRODUCT_BUNDLE_IDENTIFIER = "com.johncoates.Aerial-Test";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -3138,15 +3130,15 @@
CODE_SIGN_IDENTITY = "Developer ID Application: Guillaume Louel (3L54M5L5KK)";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.0.9;
CURRENT_PROJECT_VERSION = 2.0.10;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3L54M5L5KK;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/Resources/Old stuff/Info.plist";
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 2.0.9;
MARKETING_VERSION = 2.0.10;
PRODUCT_BUNDLE_IDENTIFIER = com.johncoates.Aerial;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -3166,15 +3158,15 @@
CODE_SIGN_IDENTITY = "Developer ID Application: Guillaume Louel (3L54M5L5KK)";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.0.9;
CURRENT_PROJECT_VERSION = 2.0.10;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3L54M5L5KK;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/Resources/Old stuff/Info.plist";
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 2.0.9;
MARKETING_VERSION = 2.0.10;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = com.johncoates.Aerial;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
6 changes: 3 additions & 3 deletions Aerial/App/Resources/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17503.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment version="101100" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17154"/>
<deployment version="101202" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17503.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down
48 changes: 40 additions & 8 deletions Aerial/Source/Controllers/CustomVideoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,53 @@ class CustomVideoController: NSWindowController, NSWindowDelegate, NSDraggingDes
func processPathForVideos(url: URL) {
debugLog("processing url for videos : \(url) ")
let folderName = url.lastPathComponent
let manifestInstance = ManifestLoader.instance
// let manifestInstance = ManifestLoader.instance

do {
let urls = try FileManager.default.contentsOfDirectory(at: url, includingPropertiesForKeys: nil, options: [.skipsHiddenFiles])
var assets = [Asset]()
var assets = [VideoAsset]()

for lurl in urls {
if lurl.path.lowercased().hasSuffix(".mp4") || lurl.path.lowercased().hasSuffix(".mov") {
assets.append(Asset(pointsOfInterest: [:],
url: lurl.path,
accessibilityLabel: lurl.lastPathComponent,
id: NSUUID().uuidString,
time: "day"))
assets.append(VideoAsset(accessibilityLabel: folderName,
id: NSUUID().uuidString,
title: lurl.lastPathComponent,
timeOfDay: "day",
scene: "",
pointsOfInterest: [:],
url4KHDR: "",
url4KSDR: lurl.path,
url1080H264: "",
url1080HDR: "",
url1080SDR: "",
url: "",
type: "nature"))
}
}

// ...
if SourceList.hasNamed(name: url.lastPathComponent) {
Aerial.showInfoAlert(title: "Source name mismatch",
text: "A source with this name already exists. Try renaming your folder and try again.")
} else {
debugLog("Creating source \(url.lastPathComponent)")

// Generate and save the Source
let source = Source(name: url.lastPathComponent,
description: "Local files from \(url.path)",
manifestUrl: "manifest.json",
type: .local,
scenes: [.nature],
isCachable: false,
license: "",
more: "")

SourceList.saveSource(source)

// Then the entries

}
/*
if let cvf = manifestInstance.customVideoFolders {
// check if we have this folder already ?
if !cvf.hasFolder(withUrl: url.path) && !assets.isEmpty {
Expand All @@ -205,7 +236,7 @@ class CustomVideoController: NSWindowController, NSWindowDelegate, NSDraggingDes
} else {
// Create our initial CVF with the parsed folder
manifestInstance.customVideoFolders = CustomVideoFolders(folders: [Folder(url: url.path, label: folderName, assets: assets)])
}
}*/

folderOutlineView.reloadData()
folderOutlineView.expandItem(nil, expandChildren: true)
Expand Down Expand Up @@ -583,3 +614,4 @@ extension CustomVideoController: NSMenuDelegate {
}
}
}
// swiftlint:disable:this file_length
1 change: 1 addition & 0 deletions Aerial/Source/Models/AerialVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ final class AerialVideo: CustomStringConvertible, Equatable {
}
}

// swiftlint:disable cyclomatic_complexity
// MARK: - Init
init(id: String,
name: String,
Expand Down
2 changes: 2 additions & 0 deletions Aerial/Source/Models/Cache/Cache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import CoreWLAN
- Attention: Shared by multiple users writable locations are no longer possible, because sandboxing is awesome !
*/

// swiftlint:disable:next type_body_length
struct Cache {
/**
Returns the SSID of the Wi-Fi network the user is currently connected to.
Expand Down Expand Up @@ -261,6 +262,7 @@ struct Cache {
let filename = video.lastPathComponent
var found = false

// swiftlint:disable for_where
for candidate in VideoList.instance.videos {
if candidate.url.lastPathComponent == filename {
found = true
Expand Down
1 change: 1 addition & 0 deletions Aerial/Source/Models/Sources/Source.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum SourceScene: String, Codable {
case nature = "Nature", city = "City", space = "Space", sea = "Sea", beach = "Beach", countryside = "Countryside"
}

// swiftlint:disable:next type_body_length
struct Source: Codable {
var name: String
var description: String
Expand Down
1 change: 1 addition & 0 deletions Aerial/Source/Models/Sources/SourceInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import Foundation

// swiftlint:disable:next type_body_length
struct SourceInfo {
// Those videos will be ignored
static let blacklist = ["b10-1.mov", // Dupe of b1-1 (Hawaii, day)
Expand Down
13 changes: 12 additions & 1 deletion Aerial/Source/Models/Sources/SourceList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct SourceList {
&& !folder.lastPathComponent.starts(with: "Thumbnails")
&& !folder.lastPathComponent.starts(with: "Cache") {

if folder.lastPathComponent.starts(with: "Community") || folder.lastPathComponent.starts(with: "Josh") {
if folder.lastPathComponent.starts(with: "Community") || folder.lastPathComponent.starts(with: "From") {
foundCommunity = true
}

Expand All @@ -87,6 +87,17 @@ struct SourceList {
return sources
}

// swiftlint:disable for_where
static func hasNamed(name: String) -> Bool {
for source in list where source.type == .local {
if source.name == name {
return true
}
}

return false
}

static func categorizedSourceList() -> [SourceHeader] {
var communities: [Source] = []
var online: [Source] = []
Expand Down
1 change: 1 addition & 0 deletions Aerial/Source/Models/Sources/VideoList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extension RangeReplaceableCollection {
}
}

// swiftlint:disable:next type_body_length
class VideoList {
enum FilterMode {
case location, cache, time, scene, source, rotation, favorite, hidden
Expand Down
2 changes: 1 addition & 1 deletion Aerial/Source/Models/Time/TimeManagement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class TimeManagement: NSObject {
}, success: { (coordinates) in
self.lsLatitude = coordinates.latitude
self.lsLongitude = coordinates.longitude
debugLog("Location found \(self.lsLatitude) \(self.lsLongitude)")
debugLog("Location found \(self.lsLatitude ?? 0) \(self.lsLongitude ?? 0)")
_ = self.calculateFrom(latitude: self.lsLatitude!, longitude: self.lsLongitude!)
})
} else {
Expand Down
16 changes: 16 additions & 0 deletions Aerial/Source/Views/AerialView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ final class AerialView: ScreenSaverView, CAAnimationDelegate {
func setup() {
_ = TimeManagement.sharedInstance

tryCompanion()

if let version = Bundle(identifier: "com.JohnCoates.Aerial")?.infoDictionary?["CFBundleShortVersionString"] as? String {
debugLog("\(self.description) AerialView setup init (V\(version)) preview: \(self.isPreview)")
debugLog("Running \(ProcessInfo.processInfo.operatingSystemVersionString)")
Expand Down Expand Up @@ -614,4 +616,18 @@ final class AerialView: ScreenSaverView, CAAnimationDelegate {
preferencesController = controller
return controller.window
}

func tryCompanion() {
/*debugLog("trying companion")

do {

try NSWorkspace.shared.open(URL(fileURLWithPath: "/Applications/Aerial.app"),
options: [.default],
configuration: [NSWorkspace.LaunchConfigurationKey.arguments: ["--silent"]])
} catch {
errorLog("error \(error.localizedDescription)")
}*/
}
}
// swiftlint:disable:this file_length
2 changes: 1 addition & 1 deletion Resources/MainUI/Infos panels/CreditsViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Since version 1.4, Aerial is developed and maintained by Guillaume Louel.</strin
- Italian by Angelo Marguglio
- Japanese by Junji 'Dr.MORO' Morokuma
- Polish by Aleksander Kasprzyk
- Portuguese/Brazil by Renan Sigolo Ferreira
- Portuguese/Brazil by Renan Sigolo
- Simplified &amp; Traditional Chinese by Linkey Leo
- Spanish by Aitor García Rey
- Swedish by Samuel Holm
Expand Down
21 changes: 20 additions & 1 deletion Resources/MainUI/Settings panels/SourcesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Cocoa

class SourcesViewController: NSViewController {
var customVideoController: CustomVideoController?

@IBOutlet var sourceOutlineView: SourceOutlineView!

Expand Down Expand Up @@ -70,6 +71,23 @@ class SourcesViewController: NSViewController {
}
}

@IBAction func addLocalClick(_ sender: NSButton) {
// We also load our CustomVideos nib here
let bundle = Bundle(for: CustomVideoController.self)

customVideoController = CustomVideoController()
var topLevelObjects: NSArray? = NSArray()
if !bundle.loadNibNamed(NSNib.Name("CustomVideos"),
owner: customVideoController,
topLevelObjects: &topLevelObjects) {
errorLog("Could not load nib for CustomVideos, please report")
}
DispatchQueue.main.async {
self.customVideoController!.windowDidLoad()
self.customVideoController!.show(sender: sender, controller: self)
//self.customVideoController!.window!.makeKeyAndOrderFront(self)
}
}
@IBAction func addOnlineClick(_ sender: Any) {
addOnlineWindow.makeKeyAndOrderFront(self)
}
Expand Down Expand Up @@ -153,6 +171,7 @@ extension SourcesViewController: NSOutlineViewDataSource, NSOutlineViewDelegate
}

// Set the content for each row/column element
// swiftlint:disable cyclomatic_complexity
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {

guard let columnIdentifier = tableColumn?.identifier.rawValue else {
Expand Down Expand Up @@ -259,7 +278,7 @@ extension SourcesViewController: NSOutlineViewDataSource, NSOutlineViewDelegate
}

func outlineView(_ outlineView: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat {
if let item = item as? SourceHeader {
if item is SourceHeader {
return 24
} else {
return 70
Expand Down
Loading

0 comments on commit 1274705

Please sign in to comment.