]> git.sesse.net Git - vlc/commitdiff
* Added AppleScript support
authorDerk-Jan Hartman <hartman@videolan.org>
Wed, 5 Feb 2003 14:58:15 +0000 (14:58 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Wed, 5 Feb 2003 14:58:15 +0000 (14:58 +0000)
* We can now handle mms:// etc on a systemwide level.
  - No way to set this other then trough Explorer Prefs at the moment

extras/MacOSX/Resources/English.lproj/vlc.scriptTerminology [new file with mode: 0644]
extras/MacOSX/Resources/vlc.scriptSuite [new file with mode: 0644]
extras/MacOSX/vlc.pbproj/project.pbxproj
modules/gui/macosx/open.m

diff --git a/extras/MacOSX/Resources/English.lproj/vlc.scriptTerminology b/extras/MacOSX/Resources/English.lproj/vlc.scriptTerminology
new file mode 100644 (file)
index 0000000..a31ee21
--- /dev/null
@@ -0,0 +1,15 @@
+{
+    "Name" = "vlc suite";
+    "Description" = "vlc specific classes.";
+    
+    "Commands" = {
+        "OpenURL" = {
+            Name = "OpenURL"; 
+            Description = "Open a URL";
+        };
+        "GetURL" = {
+            Name = "GetURL";
+            Description = "Get a URL";
+        };
+    };
+}
\ No newline at end of file
diff --git a/extras/MacOSX/Resources/vlc.scriptSuite b/extras/MacOSX/Resources/vlc.scriptSuite
new file mode 100644 (file)
index 0000000..d12be36
--- /dev/null
@@ -0,0 +1,17 @@
+{
+    "Name" = "vlc";
+    "AppleEventCode" = "VLC#";
+    
+    "Commands" = {
+        "OpenURL" = {
+            AppleEventClassCode = "WWW!"; 
+            AppleEventCode = "OURL"; 
+            CommandClass = "VLGetURLScriptCommand"; 
+        };
+        "GetURL" = {
+            AppleEventClassCode = "GURL";
+            AppleEventCode = "GURL";
+            CommandClass = "VLGetURLScriptCommand";
+        };
+    };
+}
\ No newline at end of file
index 5dbc67fe3d0e48794e6aa00c4d5e4f8786ca6339..4f37a487b53f4765ff9f88ca29411450e07d13f1 100644 (file)
        </array>
        <key>CFBundleVersion</key>
        <string>0.5.0</string>
+       <key>NSAppleScriptEnabled</key>
+       <string>YES</string>
        <key>NSMainNibFile</key>
        <string>MainMenu</string>
        <key>NSPrincipalClass</key>
                                8E68B0BF03E2EA230059A3A7,
                                8ED6C29F03E2F32E0059A3A7,
                                8ED6C2A003E2F32E0059A3A7,
+                               8EBF3FA403F13FFB0059A3A7,
+                               8EBF3FA803F140A80059A3A7,
                        );
                        isa = PBXResourcesBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
                                8E68B0BE03E2EA230059A3A7,
                                8ED6C29D03E2F32E0059A3A7,
                                8ED6C29E03E2F32E0059A3A7,
+                               8EBF3FA303F13FFB0059A3A7,
+                               8EBF3FA703F140A80059A3A7,
                        );
                        isa = PBXGroup;
                        name = Resources;
                        settings = {
                        };
                };
+               8EBF3FA303F13FFB0059A3A7 = {
+                       isa = PBXFileReference;
+                       name = vlc.scriptSuite;
+                       path = Resources/vlc.scriptSuite;
+                       refType = 2;
+               };
+               8EBF3FA403F13FFB0059A3A7 = {
+                       fileRef = 8EBF3FA303F13FFB0059A3A7;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
+               8EBF3FA503F140960059A3A7 = {
+                       isa = PBXFileReference;
+                       name = vlc.scriptTerminology;
+                       path = Resources/English.lproj/vlc.scriptTerminology;
+                       refType = 2;
+               };
+               8EBF3FA703F140A80059A3A7 = {
+                       children = (
+                               8EBF3FA503F140960059A3A7,
+                       );
+                       isa = PBXVariantGroup;
+                       name = vlc.scriptTerminology;
+                       refType = 4;
+               };
+               8EBF3FA803F140A80059A3A7 = {
+                       fileRef = 8EBF3FA703F140A80059A3A7;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
                8ED6C27A03E2EB1C0059A3A7 = {
                        fileEncoding = 30;
                        isa = PBXFileReference;
index fb773355005131d3655a3b7bde28c6282b785550..5c47159b4fdd5cb7bfa233663bef6209a410f9ac 100644 (file)
@@ -2,7 +2,7 @@
  * open.m: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: open.m,v 1.19 2003/02/05 02:31:27 hartman Exp $
+ * $Id: open.m,v 1.20 2003/02/05 14:58:15 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -876,13 +876,14 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
 @implementation VLGetURLScriptCommand
 
 - (id)performDefaultImplementation {
-    NSString *command = [[self commandDescription] commandName];
-    NSString *urlString = [self directParameter];
+    NSString *o_command = [[self commandDescription] commandName];
+    NSString *o_urlString = [self directParameter];
 
-    if ( [command isEqualToString:@"GetURL"] )
+    NSLog(@"test1");
+    if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
     {
         intf_thread_t * p_intf = [NSApp getIntf];
-
+        NSLog( o_command );
         playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                         FIND_ANYWHERE );
         if( p_playlist == NULL )
@@ -890,9 +891,22 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
             return nil;
         }
 
-        [p_playlist appendArray: 
-            [NSArray arrayWithObject: urlString] atPos: -1 enqueue:NO];
-        
+        if ( o_urlString )
+        {
+            NSURL * o_url;
+    
+            int i_mode = PLAYLIST_INSERT | PLAYLIST_GO;
+            
+            playlist_Add( p_playlist, [o_urlString fileSystemRepresentation],
+                                                    i_mode, PLAYLIST_END );
+            NSLog( o_urlString );
+            o_url = [NSURL fileURLWithPath: o_urlString];
+            if( o_url != nil )
+            { 
+                [[NSDocumentController sharedDocumentController]
+                    noteNewRecentDocumentURL: o_url]; 
+            }
+        }
         vlc_object_release( p_playlist );
     }
     return nil;