« get me outta code hell

Use mpv-nofifo if `mkfifo` command is not found - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2017-08-14 10:07:48 -0300
committerFlorrie <towerofnix@gmail.com>2017-08-14 10:10:02 -0300
commit7f70ad795385503f6632198b44a41f6bc4e93e6f (patch)
tree51c9580b9edb4184c9adb4373e2c1ea1f47a1a06
parent3f7bdfd702e47e7063c5fc31a1279c3cd3065fce (diff)
Use mpv-nofifo if `mkfifo` command is not found
-rwxr-xr-xsrc/play.js6
-rw-r--r--todo.txt10
2 files changed, 12 insertions, 4 deletions
diff --git a/src/play.js b/src/play.js
index 980a755..5d41bb9 100755
--- a/src/play.js
+++ b/src/play.js
@@ -43,7 +43,11 @@ function clearConsoleLine() {
 
 async function determineDefaultPlayer() {
   if (await commandExists('mpv')) {
-    return 'mpv'
+    if (await commandExists('mkfifo')) {
+      return 'mpv'
+    } else {
+      return 'mpv-nofifo'
+    }
   } else if (await commandExists('play')) {
     return 'play'
   } else {
diff --git a/todo.txt b/todo.txt
index 34cafab..bc0124d 100644
--- a/todo.txt
+++ b/todo.txt
@@ -272,9 +272,8 @@ TODO: Delete temporary files when done with them - seriously! http-music alone
 TODO: Players (MPV, SoX) should be separate (sub-)classes.
       (Done!)
 
-TODO: FIFO doesn't work on Windows.
-      (Done! - Use mpv-nofifo player. Would like to automatically check for
-      mkfifo command; then use nofifo if that doesn't exist.)
+TODO: FIFO doesn't work on Windows. Implement a no-fifo player.
+      (Done!)
 
 TODO: It looks like the SoX player is broken? - Fix this!
       (Done!)
@@ -310,3 +309,8 @@ TODO: A shuffle-groups picker would be fun! (That is, it would take a
       (Done!)
 
 TODO: cheerio and xmldoc are both NPM dependencies. This seems Bad!
+
+TODO: Check if the `mkfifo` shell command exists when determining the
+      player to use; if it doesn't, use mpv-nofifo. For better support on
+      Windows!
+      (Done!)