Getting somewhere
This commit is contained in:
parent
2b15e28a68
commit
0bcd10b35a
17
exe/Main.hs
17
exe/Main.hs
@ -1,19 +1,24 @@
|
|||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import System.Posix.Directory ( getWorkingDirectory )
|
import System.Posix.Directory ( getWorkingDirectory )
|
||||||
import System.Directory.Extra ( listContents )
|
import System.Directory.Extra ( listFiles )
|
||||||
import Control.Monad ( (<=<), filterM )
|
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 :: FilePath -> IO [FilePath]
|
||||||
fetchLocalAudio = filterM isAudioVideo <=< listContents
|
fetchLocalAudio = filterM isAudioVideo <=< listFiles
|
||||||
|
|
||||||
isAudioVideo :: FilePath -> IO Bool
|
isAudioVideo :: FilePath -> IO Bool
|
||||||
isAudioVideo = undefined
|
isAudioVideo = undefined
|
||||||
|
|
||||||
-- Paths need to be escaped if containing certain characters
|
-- TODO: Make run in background and without stdout
|
||||||
playHeadless :: FilePath -> IO ProcessHandle
|
-- TODO: Find alternative due to comment on https://hackage.haskell.org/package/turtle-1.6.2/docs/Turtle-Prelude.html#g:6
|
||||||
playHeadless = spawnCommand . (++) "mpv --vid=no "
|
playHeadless :: FilePath -> IO ExitCode
|
||||||
|
playHeadless = flip shell empty . format ("mpv --vid=auto \""%s%"\"") . pack
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main =
|
main =
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
packages = p: [ self.packages.${system}.snaus ];
|
packages = p: [ self.packages.${system}.snaus ];
|
||||||
withHoogle = true;
|
withHoogle = true;
|
||||||
buildInputs =
|
buildInputs =
|
||||||
|
(with pkgs; [ zlib ]) ++
|
||||||
(with haskellPackages; [
|
(with haskellPackages; [
|
||||||
haskell-language-server
|
haskell-language-server
|
||||||
cabal-install
|
cabal-install
|
||||||
|
@ -75,10 +75,14 @@ executable snaus
|
|||||||
, directory
|
, directory
|
||||||
, vty
|
, vty
|
||||||
, hashmap-io
|
, hashmap-io
|
||||||
, process
|
, turtle
|
||||||
|
, filepath
|
||||||
|
, text
|
||||||
|
|
||||||
-- Directories containing source files.
|
-- Directories containing source files.
|
||||||
hs-source-dirs: exe
|
hs-source-dirs: exe
|
||||||
|
|
||||||
|
default-extensions: OverloadedStrings
|
||||||
|
|
||||||
-- Base language which the package is written in.
|
-- Base language which the package is written in.
|
||||||
default-language: GHC2021
|
default-language: GHC2021
|
||||||
|
Loading…
Reference in New Issue
Block a user