Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Config = Config {}
- defaultConfig :: IO Config
- data MediaInfo = MediaInfo {}
- defaultMediaInfo :: MediaInfo
- data MPlayer = MPlayer {
- mplayerStdin :: ConduitT ByteString Void IO ()
- mplayerStdout :: ConduitT () ByteString IO ()
- mplayerStderr :: ConduitT () ByteString IO ()
- mplayerProcHandle :: StreamingProcessHandle
- createMPlayerProcess :: [String] -> IO MPlayer
- genericParser :: forall a. ByteString -> Parser a -> ByteString -> Maybe a
- getLength :: ByteString -> Maybe Float
- getFilename :: ByteString -> Maybe ByteString
- getCurPos :: ByteString -> Maybe Float
- updateLength :: MVar MediaInfo -> ByteString -> IO ()
- updateFilename :: MVar MediaInfo -> ByteString -> IO ()
- updateCurPos :: MVar MediaInfo -> ByteString -> IO ()
- processMPlayerStdout :: MVar MediaInfo -> ByteString -> IO ()
- sendMPlayerCommands :: ConduitT ByteString ByteString IO ()
- calculateFullSpotsPath :: Config -> ByteString -> FilePath
- setOldLocation :: Config -> MVar MediaInfo -> ConduitT i ByteString IO ()
- runMPlayerUpdateMediaInfo :: Config -> MPlayer -> MVar MediaInfo -> IO ()
- createMPlayerSpotsDir :: Config -> IO ()
- writeSpotFile :: Config -> MVar MediaInfo -> IO ()
- defaultMain :: IO ()
Documentation
A config for our program.
Config | |
|
Info about our media.
MediaInfo | |
|
Datatype to hold mplayer's stdin, stdout, etc conduits.
MPlayer | |
|
createMPlayerProcess :: [String] -> IO MPlayer Source #
Take in a bunch of arguments and use them to create the mplayer process.
genericParser :: forall a. ByteString -> Parser a -> ByteString -> Maybe a Source #
Parser for a value prefixed by a bytestring. Uses skipWhile to make it faster.
getFilename :: ByteString -> Maybe ByteString Source #
Parser for the filename of the of the media.
updateLength :: MVar MediaInfo -> ByteString -> IO () Source #
updateFilename :: MVar MediaInfo -> ByteString -> IO () Source #
updateCurPos :: MVar MediaInfo -> ByteString -> IO () Source #
processMPlayerStdout :: MVar MediaInfo -> ByteString -> IO () Source #
Try to read 3 different things from the mplayer stdout:
- length of the media
- media filename
- current position in the media
sendMPlayerCommands :: ConduitT ByteString ByteString IO () Source #
Conduit
that reads in key presses (from stdin), and yields mplayer
commands.
In order for this to work right when hooked up to stdin, stdin should be set
to NoBuffering
.
calculateFullSpotsPath :: Config -> ByteString -> FilePath Source #
setOldLocation :: Config -> MVar MediaInfo -> ConduitT i ByteString IO () Source #
runMPlayerUpdateMediaInfo :: Config -> MPlayer -> MVar MediaInfo -> IO () Source #
Run the mplayer process while doing 3 things:
- Read mplayer's stdout, looking for the length, filename, and current position of the media.
- Once the filename has been found, look for a spot file, and if it exists, make mplayer seek to the location.
- Take keys from stdin and translate them to mplayer commands. Since mplayer is in slave mode, it can't take in commands like normal.
createMPlayerSpotsDir :: Config -> IO () Source #
Create the .mplayer-spots and spots directories from the config file.
writeSpotFile :: Config -> MVar MediaInfo -> IO () Source #
Write out a spot file to the spots directory if all the required fields have been filled in the MediaInfo, and if our current position in the media file is not too early or not too late.
defaultMain :: IO () Source #