mplayer-spot- Save your spot when watching movies with @mplayer@.

Safe HaskellNone




data Config Source #

A config for our program.




Show Config Source # 
Instance details

Defined in MPlayer.Spot

defaultConfig :: IO Config Source #

Create a default Config.

data MediaInfo Source #

Info about our media.




Show MediaInfo Source # 
Instance details

Defined in MPlayer.Spot

data MPlayer Source #

Datatype to hold mplayer's stdin, stdout, etc conduits.

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.

getLength :: ByteString -> Maybe Float Source #

Parser for the length of the of the media.

getFilename :: ByteString -> Maybe ByteString Source #

Parser for the filename of the of the media.

getCurPos :: ByteString -> Maybe Float Source #

Parser for the current location in the media.

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.

setOldLocation :: Config -> MVar MediaInfo -> ConduitT i ByteString IO () Source #

Producer that tries to read the filename from the MVar MediaInfo, and if it succeeds, tries to open the spot file and read in the saved position. Produce it as a value.

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.