Getting somewhere

This commit is contained in:
pingu 2024-03-04 23:00:45 +01:00
parent 2b15e28a68
commit 0bcd10b35a
3 changed files with 17 additions and 7 deletions

View File

@ -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 =

View File

@ -52,6 +52,7 @@
packages = p: [ self.packages.${system}.snaus ];
withHoogle = true;
buildInputs =
(with pkgs; [ zlib ]) ++
(with haskellPackages; [
haskell-language-server
cabal-install

View File

@ -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