diff --git a/exe/Main.hs b/exe/Main.hs index f620c2d..3b8aafc 100644 --- a/exe/Main.hs +++ b/exe/Main.hs @@ -1,19 +1,24 @@ +{-# LANGUAGE OverloadedStrings #-} + module Main where import System.Posix.Directory ( getWorkingDirectory ) -import System.Directory.Extra ( listContents ) +import System.Directory.Extra ( listFiles ) import Control.Monad ( (<=<), filterM ) -import System.Process ( ProcessHandle, spawnCommand ) +import Turtle ( Alternative(empty), shell, ExitCode ) +import Turtle.Format +import Data.Text ( Text, pack ) fetchLocalAudio :: FilePath -> IO [FilePath] -fetchLocalAudio = filterM isAudioVideo <=< listContents +fetchLocalAudio = filterM isAudioVideo <=< listFiles isAudioVideo :: FilePath -> IO Bool isAudioVideo = undefined --- Paths need to be escaped if containing certain characters -playHeadless :: FilePath -> IO ProcessHandle -playHeadless = spawnCommand . (++) "mpv --vid=no " +-- TODO: Make run in background and without stdout +-- TODO: Find alternative due to comment on https://hackage.haskell.org/package/turtle-1.6.2/docs/Turtle-Prelude.html#g:6 +playHeadless :: FilePath -> IO ExitCode +playHeadless = flip shell empty . format ("mpv --vid=auto \""%s%"\"") . pack main :: IO () main = diff --git a/flake.nix b/flake.nix index f9fab2a..465344d 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,7 @@ packages = p: [ self.packages.${system}.snaus ]; withHoogle = true; buildInputs = + (with pkgs; [ zlib ]) ++ (with haskellPackages; [ haskell-language-server cabal-install diff --git a/snaus.cabal b/snaus.cabal index 7a67f81..9dfdfcb 100644 --- a/snaus.cabal +++ b/snaus.cabal @@ -75,10 +75,14 @@ executable snaus , directory , vty , hashmap-io - , process + , turtle + , filepath + , text -- Directories containing source files. hs-source-dirs: exe + default-extensions: OverloadedStrings + -- Base language which the package is written in. default-language: GHC2021