diff options
author | Zhiming Wang <zmwangx@gmail.com> | 2015-05-04 14:55:10 -0700 |
---|---|---|
committer | Zhiming Wang <zmwangx@gmail.com> | 2015-05-04 14:55:10 -0700 |
commit | 301679861a2440a10c9eac746cec86459f445ef9 (patch) | |
tree | 5aad22ead01cf0da226623f603f33867896c0fea /source/blog/2014-12-23-mpv-launcher.md | |
parent | d0a07c64afba47bbe8bfb56ba9893296a73fc7db (diff) | |
download | my_new_personal_website-301679861a2440a10c9eac746cec86459f445ef9.tar.xz my_new_personal_website-301679861a2440a10c9eac746cec86459f445ef9.zip |
remove all Octopress stuff
Diffstat (limited to 'source/blog/2014-12-23-mpv-launcher.md')
-rw-r--r-- | source/blog/2014-12-23-mpv-launcher.md | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blog/2014-12-23-mpv-launcher.md b/source/blog/2014-12-23-mpv-launcher.md new file mode 100644 index 00000000..1bb85b50 --- /dev/null +++ b/source/blog/2014-12-23-mpv-launcher.md @@ -0,0 +1,26 @@ +--- +layout: post +title: "mpv launcher" +date: 2014-12-23 00:51:05 -0800 +comments: true +categories: +--- +**_04/06/2015 update:_** + +I just noticed that `daemonize` doesn't play too well with the OS; in particular, when you use dark menu bar on OS X Yosemite, apps launched with `daemonize` won't conform to that. So a native shell solution would be using `/bin/zsh` and run + + mpv "$@" >/dev/null 2>&1 </dev/null &! + +instead. + +--- + +[`mpv`](http://mpv.io) is a nice simplistic video player (fork of MPlayer and mplayer2). The CLI is flawless (and you can run as many instances as you want), but when it comes to the OS X application bundle, there's one major annoyance. Each app bundle could only have one running instance (unless `open -n`’ed, which is not how sane people use app bundles), and one instance of `mpv` only supports one video. So, say I'm playing one video with the app bundle, and unsuspectingly opens another in Finder (which is associated to `mpv.app` by default), then the latter video immediately takes over, and the position in the first video is lost. That happens *a lot*. + +Today I finally gave this issue some serious thought (I've been on a bug report/enhancement request spree these days so it's natural for me to start thinking about enhancements). Turns out that there's a pretty simple workaround. I created an automator app `mpv-launcher.app` that does one thing: "Run Shell Script" (pass input as arguments) + + daemonize /usr/local/bin/mpv "$@" + +in the shell of your choice (for me the shell of choice is `zsh` since the env would be readily available from my `zshenv`). `daemonize`, as the name suggests, daemonizes the process so that the process doesn't block; this way, `mpv-launcher.app` immediately quits after launching, making multiple "instances" possible. (`daemonize` can be installed via `brew install daemonize`; note that you need to specify the full path of the command to daemonize, which in my case is `/usr/local/bin/mpv`). And there you go. Associate your video files to `mpv-launcher.app`. Launch as many instances as you want. Enjoy. + +By the way, I also filed an [enhancement request](https://github.com/mpv-player/mpv/issues/1377) with `mpv-player/mpv`. We'll see what the developers can do. Hopefully the app bundle will support multiple videos out of box in the future. |