00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "intf.h"
00028 #include "applescript.h"
00029 #include "controls.h"
00030 #include "open.h"
00031
00032
00033
00034
00035
00036 @implementation VLGetURLScriptCommand
00037
00038 - (id)performDefaultImplementation {
00039 NSString *o_command = [[self commandDescription] commandName];
00040 NSString *o_urlString = [self directParameter];
00041
00042 if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
00043 {
00044 intf_thread_t * p_intf = VLCIntf;
00045 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
00046 FIND_ANYWHERE );
00047 if( p_playlist == NULL )
00048 {
00049 return nil;
00050 }
00051
00052 if ( o_urlString )
00053 {
00054 NSURL * o_url;
00055
00056 playlist_Add( p_playlist, [o_urlString fileSystemRepresentation],
00057 [[[NSFileManager defaultManager] displayNameAtPath: o_urlString] UTF8String],
00058 PLAYLIST_INSERT, PLAYLIST_END );
00059
00060 o_url = [NSURL fileURLWithPath: o_urlString];
00061 if( o_url != nil )
00062 {
00063 [[NSDocumentController sharedDocumentController]
00064 noteNewRecentDocumentURL: o_url];
00065 }
00066 }
00067 vlc_object_release( p_playlist );
00068 }
00069 return nil;
00070 }
00071
00072 @end
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 @implementation VLControlScriptCommand
00083
00084 - (id)performDefaultImplementation {
00085 NSString *o_command = [[self commandDescription] commandName];
00086
00087 intf_thread_t * p_intf = VLCIntf;
00088 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
00089 FIND_ANYWHERE );
00090 if( p_playlist == NULL )
00091 {
00092 return nil;
00093 }
00094
00095 VLCControls * o_controls = (VLCControls *)[[NSApp delegate] getControls];
00096
00097 if ( o_controls )
00098 {
00099 if ( [o_command isEqualToString:@"play"] )
00100 {
00101 [o_controls play:self];
00102 return nil;
00103 }
00104 else if ( [o_command isEqualToString:@"stop"] )
00105 {
00106 [o_controls stop:self];
00107 return nil;
00108 }
00109 else if ( [o_command isEqualToString:@"previous"] )
00110 {
00111 [o_controls prev:self];
00112 return nil;
00113 }
00114 else if ( [o_command isEqualToString:@"next"] )
00115 {
00116 [o_controls next:self];
00117 return nil;
00118 }
00119 else if ( [o_command isEqualToString:@"fullscreen"] )
00120 {
00121 NSMenuItem *o_mi = [[NSMenuItem alloc] initWithTitle: _NS("Fullscreen") action: nil keyEquivalent:@""];
00122 [o_controls windowAction:[o_mi autorelease]];
00123 return nil;
00124 }
00125 else if ( [o_command isEqualToString:@"mute"] )
00126 {
00127 [o_controls mute:self];
00128 return nil;
00129 }
00130 else if ( [o_command isEqualToString:@"volumeUp"] )
00131 {
00132 [o_controls volumeUp:self];
00133 return nil;
00134 }
00135 else if ( [o_command isEqualToString:@"volumeDown"] )
00136 {
00137 [o_controls volumeDown:self];
00138 return nil;
00139 }
00140 }
00141 vlc_object_release( p_playlist );
00142 return nil;
00143 }
00144
00145 @end