diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-09-07 15:37:02 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-09-07 15:37:02 +0200 |
commit | 494d40858351bbe4a83c98758440621d3fcdc5c9 (patch) | |
tree | 78b666f372a9d8b83cd835915acf0784e8886967 /osdep | |
parent | b0797e8fe99bf5eb0b399ad2a57b62e8f0c71fed (diff) | |
download | mpv-494d40858351bbe4a83c98758440621d3fcdc5c9.tar.bz2 mpv-494d40858351bbe4a83c98758440621d3fcdc5c9.tar.xz |
macosx_application: handle mpv:// links
Pretty useful for people writing userscripts for web browsers. Links starting
with 'mpv://' are forwarded to the mpv OSX bundle. The leading 'mpv://' is
stripped from the recived url and the rest of the string is inserted as is in
the playlist.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/macosx_application.m | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 7c5990d912..a522ad77fa 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -26,6 +26,8 @@ #include "osdep/macosx_application_objc.h" #include "osdep/macosx_compat.h" +#define MPV_PROTOCOL @"mpv://" + static pthread_t playback_thread_id; @interface Application (PrivateMethods) @@ -241,6 +243,11 @@ static NSString *escape_loadfile_name(NSString *input) NSString *url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; + url = [url stringByReplacingOccurrencesOfString:MPV_PROTOCOL + withString:@"" + options:NSAnchoredSearch + range:NSMakeRange(0, [MPV_PROTOCOL length])]; + self.files = @[url]; if (self.willStopOnOpenEvent) { |