Commit 5f5167f1 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: re-write and simplify the apple event handlers for GetURL and OpenURL,...

macosx: re-write and simplify the apple event handlers for GetURL and OpenURL, make it respect 'macosx-autoplay' (close #6319)
parent 6e303ee3
...@@ -131,6 +131,8 @@ OS X Interface: ...@@ -131,6 +131,8 @@ OS X Interface:
* add support for playing video and showing audio visualizations side by side * add support for playing video and showing audio visualizations side by side
* improve fullscreen controller time slider with larger click target * improve fullscreen controller time slider with larger click target
* rewrite of minimal macosx module for use within VLCKit * rewrite of minimal macosx module for use within VLCKit
* add support for 'macosx-autoplay' to the Apple Event / Apple Script bindings
when adding new inputs
* The Streaming/Transcoding wizard and the open dialog's output panel are * The Streaming/Transcoding wizard and the open dialog's output panel are
deprecated now deprecated now
......
/***************************************************************************** /*****************************************************************************
* applescript.m: MacOS X AppleScript support * applescript.m: MacOS X AppleScript support
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2012 VLC authors and VideoLAN * Copyright (C) 2002-2013 VLC authors and VideoLAN
* $Id$ * $Id$
* *
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net> * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
...@@ -25,9 +25,10 @@ ...@@ -25,9 +25,10 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include "intf.h" #import "intf.h"
#include "applescript.h" #import "applescript.h"
#include "CoreInteraction.h" #import "CoreInteraction.h"
#import "playlist.h"
/***************************************************************************** /*****************************************************************************
* VLGetURLScriptCommand implementation * VLGetURLScriptCommand implementation
...@@ -39,30 +40,18 @@ ...@@ -39,30 +40,18 @@
NSString *o_urlString = [self directParameter]; NSString *o_urlString = [self directParameter];
if ([o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"]) { if ([o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"]) {
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get(p_intf);
if (o_urlString) { if (o_urlString) {
NSURL * o_url; BOOL b_autoplay = config_GetInt(VLCIntf, "macosx-autoplay");
input_item_t *p_input; NSURL * o_url = [NSURL fileURLWithPath: o_urlString];
int returnValue;
p_input = input_item_New([o_urlString fileSystemRepresentation],
[[[NSFileManager defaultManager]
displayNameAtPath: o_urlString] UTF8String]);
if (!p_input)
return nil;
returnValue = playlist_AddInput(p_playlist, p_input, PLAYLIST_INSERT,
PLAYLIST_END, true, pl_Unlocked);
vlc_gc_decref(p_input);
if (returnValue != VLC_SUCCESS)
return nil;
o_url = [NSURL fileURLWithPath: o_urlString];
if (o_url != nil) if (o_url != nil)
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: o_url]; [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: o_url];
NSMutableArray *o_result = [NSMutableArray arrayWithObject:[NSDictionary dictionaryWithObject:o_urlString forKey:@"ITEM_URL"]];
if (b_autoplay)
[[[VLCMain sharedInstance] playlist] appendArray: o_result atPos: -1 enqueue: NO];
else
[[[VLCMain sharedInstance] playlist] appendArray: o_result atPos: -1 enqueue: YES];
} }
} }
return nil; return nil;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment