Large rename of files to move project forward

This commit is contained in:
Anthony Lavado 2020-01-10 01:59:54 -05:00
parent f9197e9bbb
commit f8db56cb75
15 changed files with 59 additions and 65 deletions

View File

@ -26,7 +26,7 @@
C4F0E82F1DA1B9CF00435310 /* STPreferencesGeneralViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4F0E82D1DA1B9CF00435310 /* STPreferencesGeneralViewController.xib */; };
C4F0E8381DA1CB0900435310 /* STPreferencesInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4F0E8361DA1CB0900435310 /* STPreferencesInfoViewController.m */; };
C4F0E8391DA1CB0900435310 /* STPreferencesInfoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4F0E8371DA1CB0900435310 /* STPreferencesInfoViewController.xib */; };
C4FFB0661D0D7F870015D14A /* XGSyncthing.m in Sources */ = {isa = PBXBuildFile; fileRef = C4FFB0641D0D7E4C0015D14A /* XGSyncthing.m */; };
C4FFB0661D0D7F870015D14A /* JellyfinMacOS.m in Sources */ = {isa = PBXBuildFile; fileRef = C4FFB0641D0D7E4C0015D14A /* JellyfinMacOS.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -81,8 +81,8 @@
C4F0E8351DA1CB0900435310 /* STPreferencesInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPreferencesInfoViewController.h; path = UI/STPreferencesWindow/STPreferencesInfoViewController.h; sourceTree = "<group>"; };
C4F0E8361DA1CB0900435310 /* STPreferencesInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = STPreferencesInfoViewController.m; path = UI/STPreferencesWindow/STPreferencesInfoViewController.m; sourceTree = "<group>"; };
C4F0E8371DA1CB0900435310 /* STPreferencesInfoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = STPreferencesInfoViewController.xib; path = UI/STPreferencesWindow/STPreferencesInfoViewController.xib; sourceTree = "<group>"; };
C4FFB0631D0D7E440015D14A /* XGSyncthing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XGSyncthing.h; sourceTree = "<group>"; };
C4FFB0641D0D7E4C0015D14A /* XGSyncthing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XGSyncthing.m; sourceTree = "<group>"; };
C4FFB0631D0D7E440015D14A /* JellyfinMacOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JellyfinMacOS.h; sourceTree = "<group>"; };
C4FFB0641D0D7E4C0015D14A /* JellyfinMacOS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JellyfinMacOS.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -145,8 +145,8 @@
children = (
29AF1BA4210F11DE004212DE /* jellyfin-server-Bridging-Header.h */,
09004F8C238E70BF00F7E9C2 /* DaemonProcess.swift */,
C4FFB0631D0D7E440015D14A /* XGSyncthing.h */,
C4FFB0641D0D7E4C0015D14A /* XGSyncthing.m */,
C4FFB0631D0D7E440015D14A /* JellyfinMacOS.h */,
C4FFB0641D0D7E4C0015D14A /* JellyfinMacOS.m */,
C4A415631D0D579D00DC6018 /* STApplication.h */,
C4A415641D0D579D00DC6018 /* STApplication.m */,
C4D567A11D3A8DFE002AD881 /* STLoginItem.m */,
@ -334,7 +334,7 @@
buildActionMask = 2147483647;
files = (
C4D567A21D3A8DFE002AD881 /* STLoginItem.m in Sources */,
C4FFB0661D0D7F870015D14A /* XGSyncthing.m in Sources */,
C4FFB0661D0D7F870015D14A /* JellyfinMacOS.m in Sources */,
C4A415681D0D579D00DC6018 /* main.m in Sources */,
C4946B031D587878008447A2 /* STAboutWindowController.m in Sources */,
C4D36D801DA3D53F0061FD08 /* STPreferencesAdvancedViewController.m in Sources */,
@ -411,7 +411,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/syncthing/Test";
HEADER_SEARCH_PATHS = "$(SRCROOT)/jellyfin-server/Test";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -464,7 +464,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/syncthing/Test";
HEADER_SEARCH_PATHS = "$(SRCROOT)/jellyfin-server/Test";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "";

View File

@ -80,7 +80,6 @@
</items>
<point key="canvasLocation" x="428" y="223"/>
</menu>
<customObject id="LNQ-zz-nO6" customClass="SUUpdater"/>
<menuItem title="Menu" id="I8M-Pf-BKw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Menu" id="rlz-0G-Jeh">

View File

@ -1,12 +1,11 @@
/**
* Syncthing Objective-C client library
* Jellyfin-Server-macOS Objective-C client library
*/
#import <Foundation/Foundation.h>
@interface XGSyncthing : NSObject<NSXMLParserDelegate>
@interface JellyfinMacOS : NSObject<NSXMLParserDelegate>
@property (nonatomic, copy) NSString *URI;
@property (nonatomic, copy) NSString *ApiKey;
/**
* Load configuration from XML file

View File

@ -1,9 +1,9 @@
#import "XGSyncthing.h"
#import "JellyfinMacOS.h"
// How long we wait for one event poll
#define EVENT_TIMEOUT 60.0
@interface XGSyncthing()
@interface JellyfinMacOS()
@property (nonatomic, strong) NSXMLParser *configParser;
@property (nonatomic, strong) NSMutableArray<NSString *> *parsing;
@ -11,10 +11,10 @@
@end
@implementation XGSyncthing {}
@implementation JellyfinMacOS {}
@synthesize URI = _URI;
@synthesize ApiKey = _apiKey;
@ -29,7 +29,7 @@
appropriateForURL:nil
create:NO
error:&error];
NSURL* configUrl = [supURL URLByAppendingPathComponent:@"jellyfin-Server/config.xml"];
NSURL* configUrl = [supURL URLByAppendingPathComponent:@"jellyfin/config.xml"];
_parsing = [[NSMutableArray alloc] init];
_configParser = [[NSXMLParser alloc] initWithContentsOfURL:configUrl];
[_configParser setDelegate:self];
@ -56,9 +56,7 @@
-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
NSString *keyPath = [_parsing componentsJoinedByString:@"."];
if ([keyPath isEqualToString:@"configuration.gui.apikey"]) {
_apiKey = string;
} else if ([keyPath isEqualToString:@"configuration.gui.address"]) {
if ([keyPath isEqualToString:@"configuration.gui.address"]) {
_URI = [_URI stringByAppendingString:string];
}
}

View File

@ -8,11 +8,10 @@
#import <Cocoa/Cocoa.h>
#import "XGSyncthing.h"
#import "JellyfinMacOS.h"
#import "Controllers/STAboutWindowController.h"
#import "Controllers/STPreferencesWindowController.h"
#import "jellyfin_server_macos-Swift.h"
//#import "Syncthing-Swift.h"
@interface STAppDelegate : NSObject <NSApplicationDelegate, DaemonProcessDelegate>

View File

@ -6,7 +6,7 @@
@interface STAppDelegate ()
@property (nonatomic, strong, readwrite) NSStatusItem *statusItem;
@property (nonatomic, strong, readwrite) XGSyncthing *syncthing;
@property (nonatomic, strong, readwrite) JellyfinMacOS *jfmacos;
@property (nonatomic, strong, readwrite) NSString *executable;
@property (nonatomic, strong, readwrite) DaemonProcess *process;
@property (strong) STPreferencesWindowController *preferencesWindow;
@ -16,9 +16,11 @@
@implementation STAppDelegate
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification {
_syncthing = [[XGSyncthing alloc] init];
_jfmacos = [[JellyfinMacOS alloc] init];
[self applicationLoadConfiguration];
_process = [[DaemonProcess alloc] initWithPath:_executable delegate:self];
@ -45,10 +47,13 @@
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// Watch out! This line gets data from the NSUserDefaults (defaults read org.jellyfin.server.macos)
// If you're updating this area, make sure you run "defaults delete org.jellyfin.server.macos" first!
_executable = [defaults stringForKey:@"Executable"];
if (!_executable) {
// We store the server and runtime files in ~/Library/Application Support/Jellyfin/server by default
_executable = [[self applicationSupportDirectoryFor:@"jellyfin-server/server"] stringByAppendingPathComponent:@"jellyfin"];
// Then the appended path component is the actual executable to run
_executable = [[self applicationSupportDirectoryFor:@"jellyfin/server"] stringByAppendingPathComponent:@"jellyfin"];
[defaults setValue:_executable forKey:@"Executable"];
}
@ -60,12 +65,11 @@
return;
}
_syncthing.URI = [defaults stringForKey:@"URI"];
_syncthing.ApiKey = [defaults stringForKey:@"ApiKey"];
_jfmacos.URI = [defaults stringForKey:@"URI"];
// If no values are set, read from XML and store in defaults
if (!_syncthing.URI.length && !_syncthing.ApiKey.length) {
BOOL success = [_syncthing loadConfigurationFromXML];
if (!_jfmacos.URI.length) {
BOOL success = [_jfmacos loadConfigurationFromXML];
// If XML doesn't exist or is invalid, retry after delay
if (!success && configLoadAttempt <= 3) {
@ -74,18 +78,12 @@
return;
}
[defaults setObject:_syncthing.URI forKey:@"URI"];
[defaults setObject:_syncthing.ApiKey forKey:@"ApiKey"];
[defaults setObject:_jfmacos.URI forKey:@"URI"];
}
if (!_syncthing.URI) {
_syncthing.URI = @"http://localhost:8096";
[defaults setObject:_syncthing.URI forKey:@"URI"];
}
if (!_syncthing.ApiKey) {
_syncthing.ApiKey = @"";
[defaults setObject:_syncthing.ApiKey forKey:@"ApiKey"];
if (!_jfmacos.URI) {
_jfmacos.URI = @"http://localhost:8096";
[defaults setObject:_jfmacos.URI forKey:@"URI"];
}
if (![defaults objectForKey:@"StartAtLogin"]) {
@ -114,7 +112,7 @@
}
// Copy the bundled executable to the desired location. Pass on return and error to the caller.
NSString *bundled = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"jellyfin"];
NSString *bundled = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"server"];
return [manager copyItemAtPath:bundled toPath:path error:error];
}
@ -132,7 +130,7 @@
- (IBAction) clickedOpen:(id)sender {
NSURL *URL = [NSURL URLWithString:[_syncthing URI]];
NSURL *URL = [NSURL URLWithString:[_jfmacos URI]];
[[NSWorkspace sharedWorkspace] openURL:URL];
}

View File

@ -7,11 +7,11 @@
//
#import "STConfiguration.h"
#import "XGSyncthing.h"
#import "JellyfinMacOS.h"
@interface STConfiguration()
@property XGSyncthing *st;
@property JellyfinMacOS *st;
@end

View File

@ -10,7 +10,7 @@
@interface STPreferencesGeneralViewController : NSViewController
@property (weak) IBOutlet NSTextField *Syncthing_URI;
@property (weak) IBOutlet NSTextField *Jellyfin_URI;
@property (weak) IBOutlet NSButton *StartAtLogin;

View File

@ -8,7 +8,7 @@
#import "STPreferencesGeneralViewController.h"
#import "STLoginItem.h"
#import "XGSyncthing.h"
#import "JellyfinMacOS.h"
@interface STPreferencesGeneralViewController ()

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15400" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15702" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15400"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15702"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="STPreferencesGeneralViewController">
<connections>
<outlet property="Jellyfin_URI" destination="kCf-gA-qTB" id="qgf-Ba-Nvw"/>
<outlet property="StartAtLogin" destination="tYl-sb-Hga" id="nUj-DN-esv"/>
<outlet property="Syncthing_URI" destination="kCf-gA-qTB" id="s6U-1e-YmN"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
@ -28,7 +28,7 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kCf-gA-qTB">
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kCf-gA-qTB" userLabel="JellyfinURI">
<rect key="frame" x="69" y="83" width="336" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="http://localhost:8096" drawsBackground="YES" id="hwI-eW-JrI">
@ -36,9 +36,6 @@
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="43V-m6-OJJ" name="value" keyPath="values.URI" id="JcY-Od-80C"/>
</connections>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tYl-sb-Hga">
<rect key="frame" x="67" y="18" width="101" height="18"/>

View File

@ -11,7 +11,7 @@ CURL_ARGS="--connect-timeout 5 --max-time 10 --retry 5 --retry-delay 3 --retry-m
DL_DIR="${BUILT_PRODUCTS_DIR}/dl"
JELLYFIN_TARBALL="${DL_DIR}/jellyfin.macos.tar.gz"
APP_RESOURCES_DIR="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Resources"
TAR_DIR="${APP_RESOURCES_DIR}/jellyfin-server"
TAR_DIR="${APP_RESOURCES_DIR}/server"
# Download jellyfin tarball
if [ -f "${JELLYFIN_TARBALL}" ]; then

View File

@ -10,6 +10,6 @@
@interface STPreferencesAdvancedViewController : NSViewController
- (IBAction)openConfigFolder:(id)sender;
- (IBAction)openAppFolder:(id)sender;
@end

View File

@ -24,11 +24,15 @@
return self;
}
- (IBAction)openConfigFolder:(id)sender {
- (IBAction)openAppFolder:(id)sender {
// TODO: currently we hardcode according to the default folder
// as I have no idea yet how to get the current running config dir
NSString *configDir = [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @"Library/Application Support/Jellyfin/server"];
[[NSWorkspace sharedWorkspace] openFile:configDir];
//NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: "/Users/\(NSUserName())/Library/Application Support/Jellyfin/server")
//NSString *configDir = [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @"Library/Application Support/Jellyfin/server"];
NSString *configDir =@"/Users/anthonylavado/Library/Application Support/jellyfin/server/";
NSURL *folderURL = [NSURL fileURLWithPath: configDir];
[[NSWorkspace sharedWorkspace] openURL:folderURL];
}
@end

View File

@ -18,20 +18,20 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yMQ-uA-Raw">
<rect key="frame" x="133" y="13" width="154" height="32"/>
<rect key="frame" x="141" y="13" width="138" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Open config folder" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ivp-5n-g9s">
<buttonCell key="cell" type="push" title="Open app folder" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ivp-5n-g9s">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="openConfigFolder:" target="-2" id="9Dg-jW-9ab"/>
<action selector="openAppFolder:" target="-2" id="bT0-Y4-qbl"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ydx-qL-zqJ">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ydx-qL-zqJ" userLabel="Jellyfin executable:">
<rect key="frame" x="18" y="88" width="142" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Syncthing executable: " id="gHX-uY-R2s">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Jellyfin executable: " id="gHX-uY-R2s">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15400" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15702" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15400"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15702"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>