Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ CC = clang
ARCHS = -arch arm64 -arch x86_64
MIN_VERSION = -mmacosx-version-min=14.0
FRAMEWORKS = -framework Foundation -framework AppKit -framework AVFoundation -framework CoreServices
OBJC_FLAGS = -fobjc-arc -fmodules
MODULE_CACHE_DIR = $(BUILD_DIR)/ModuleCache
OBJC_FLAGS = -fobjc-arc -fmodules -fmodules-cache-path=$(abspath $(MODULE_CACHE_DIR))
LINKER_FLAGS = -undefined dynamic_lookup -dynamiclib
INSTALL_NAME = -install_name @rpath/SpliceKit.framework/Versions/A/SpliceKit

Expand All @@ -12,6 +13,7 @@ SOURCES = Sources/SpliceKit.m \
Sources/SpliceKitRuntime.m \
Sources/SpliceKitSwizzle.m \
Sources/SpliceKitServer.m \
Sources/SpliceKitURLImport.m \
Sources/SpliceKitLogPanel.m \
Sources/SpliceKitTranscriptPanel.m \
Sources/SpliceKitCaptionPanel.m \
Expand Down Expand Up @@ -46,12 +48,29 @@ PARAKEET_PKG_DIR = patcher/SpliceKitPatcher.app/Contents/Resources/tools/parakee
PARAKEET_RELEASE_BIN = $(PARAKEET_PKG_DIR)/.build/release/parakeet-transcriber
PARAKEET_DEBUG_BIN = $(PARAKEET_PKG_DIR)/.build/debug/parakeet-transcriber

.PHONY: all clean deploy launch tools
.PHONY: all clean deploy launch tools url-import-tools

all: $(OUTPUT)

tools: $(SILENCE_DETECTOR) $(STRUCTURE_ANALYZER)

url-import-tools:
@mkdir -p "$(TOOLS_DIR)"
@YTDLP_PATH="$$(command -v yt-dlp || true)"; \
if [ -n "$$YTDLP_PATH" ]; then \
ln -sf "$$YTDLP_PATH" "$(TOOLS_DIR)/yt-dlp"; \
echo "Linked yt-dlp -> $$YTDLP_PATH"; \
else \
echo "yt-dlp not found in PATH. Install with: brew install yt-dlp"; \
fi
@FFMPEG_PATH="$$(command -v ffmpeg || true)"; \
if [ -n "$$FFMPEG_PATH" ]; then \
ln -sf "$$FFMPEG_PATH" "$(TOOLS_DIR)/ffmpeg"; \
echo "Linked ffmpeg -> $$FFMPEG_PATH"; \
else \
echo "ffmpeg not found in PATH. Install with: brew install ffmpeg"; \
fi

$(BUILD_DIR):
@mkdir -p $(BUILD_DIR)

Expand Down Expand Up @@ -100,6 +119,7 @@ deploy: $(OUTPUT) $(SILENCE_DETECTOR) $(STRUCTURE_ANALYZER)
@/usr/libexec/PlistBuddy -c "Add :NSSpeechRecognitionUsageDescription string 'SpliceKit uses speech recognition to transcribe timeline audio for text-based editing.'" "$(MODDED_APP)/Contents/Info.plist" 2>/dev/null || true
@# Deploy tools
@mkdir -p "$(TOOLS_DIR)"
@$(MAKE) url-import-tools
@cp $(SILENCE_DETECTOR) "$(TOOLS_DIR)/silence-detector" 2>/dev/null || true
@cp $(STRUCTURE_ANALYZER) "$(TOOLS_DIR)/structure-analyzer" 2>/dev/null || true
@if [ -f "$(PARAKEET_RELEASE_BIN)" ]; then \
Expand Down
330 changes: 324 additions & 6 deletions Sources/SpliceKitCommandPalette.m

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions Sources/SpliceKitLua.m
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,62 @@ static int sk_selected(lua_State *L) {
return 1;
}

// --- URL Import ---

static int sk_import_url(lua_State *L) {
const char *url = luaL_checkstring(L, 1);
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:@(url) forKey:@"url"];
if (lua_istable(L, 2)) {
NSDictionary *options = SpliceKitLua_toNSDictionary(L, 2);
if (options) [params addEntriesFromDictionary:options];
}
NSDictionary *response = SpliceKit_handleRequest(@{
@"method": @"urlImport.import",
@"params": params
});
id result = response[@"result"];
SpliceKitLua_pushValue(L, result ?: response);
return 1;
}

static int sk_import_url_start(lua_State *L) {
const char *url = luaL_checkstring(L, 1);
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:@(url) forKey:@"url"];
if (lua_istable(L, 2)) {
NSDictionary *options = SpliceKitLua_toNSDictionary(L, 2);
if (options) [params addEntriesFromDictionary:options];
}
NSDictionary *response = SpliceKit_handleRequest(@{
@"method": @"urlImport.start",
@"params": params
});
id result = response[@"result"];
SpliceKitLua_pushValue(L, result ?: response);
return 1;
}

static int sk_import_url_status(lua_State *L) {
const char *jobID = luaL_checkstring(L, 1);
NSDictionary *response = SpliceKit_handleRequest(@{
@"method": @"urlImport.status",
@"params": @{@"job_id": @(jobID)}
});
id result = response[@"result"];
SpliceKitLua_pushValue(L, result ?: response);
return 1;
}

static int sk_import_url_cancel(lua_State *L) {
const char *jobID = luaL_checkstring(L, 1);
NSDictionary *response = SpliceKit_handleRequest(@{
@"method": @"urlImport.cancel",
@"params": @{@"job_id": @(jobID)}
});
id result = response[@"result"];
SpliceKitLua_pushValue(L, result ?: response);
return 1;
}

// --- Generic RPC Passthrough ---

// sk.rpc("method.name", {param = value}) → calls any RPC method
Expand Down Expand Up @@ -1304,6 +1360,10 @@ static int sk_set_config(lua_State *L) {
{"clips", sk_clips},
{"position", sk_position},
{"selected", sk_selected},
{"import_url", sk_import_url},
{"import_url_start", sk_import_url_start},
{"import_url_status", sk_import_url_status},
{"import_url_cancel", sk_import_url_cancel},

// Generic access
{"timeline", sk_timeline_action},
Expand Down
Loading