-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A parser for .srt and .sub files
--
-- A basic .srt and .sub parser based on attoparsec and text
@package subtitleParser
@version 0.4
-- | ADT for .sub files. Also serves as a place to provide instance
-- declarations for the ADTs.
module Text.Subtitles.SUB.Datatypes
type Frame = Int
type Subtitles = [Line]
type Color = Text
-- | Optional property of text, the constructor should be clear.
data TextProperty
Italic :: TextProperty
Bold :: TextProperty
UnderLine :: TextProperty
Stroked :: TextProperty
-- | This is just text because is non-standard RGB
C :: Color -> TextProperty
data Line
Line :: Frame -> Frame -> Maybe TextProperty -> Text -> Line
startFrame :: Line -> Frame
finalFrame :: Line -> Frame
property :: Line -> Maybe TextProperty
dialog :: Line -> Text
instance Show TextProperty
instance Eq TextProperty
instance Show Line
instance Eq Line
-- | A basic parser for .sub files (microDVD) based on Attoparsec
-- and Text
module Text.Subtitles.SUB
-- | Given the example return the corresponding Line representation. At the
-- moment this not handles modifiers as underlines or bold text
parseSingleLine :: Parser Line
-- | Main parser of .sub files, given a .sub file it return a list of the
-- dialog lines
parseSUB :: Parser Subtitles
-- | ADT for .srt files. Also serves as a place to provide instance
-- declarations for the ADTs.
module Text.Subtitles.SRT.Datatypes
type Subtitles = [Line]
-- | This represent the position on screen of the Line. Is usually optional
-- in the file.
data Rectangle
R :: Int -> Int -> Int -> Int -> Rectangle
x1 :: Rectangle -> Int
x2 :: Rectangle -> Int
y1 :: Rectangle -> Int
y2 :: Rectangle -> Int
-- | The core of the parser. each one of the constructor representing one
-- part of the Line
data Line
Line :: Int -> Range -> Maybe Rectangle -> Text -> Line
index :: Line -> Int
range :: Line -> Range
geometry :: Line -> Maybe Rectangle
dialog :: Line -> Text
data Range
Range :: Time -> Time -> Range
from :: Range -> Time
to :: Range -> Time
data Time
Time :: Int -> Int -> Int -> Int -> Time
hour :: Time -> Int
minutes :: Time -> Int
seconds :: Time -> Int
frame :: Time -> Int
instance Eq Rectangle
instance Ord Rectangle
instance Show Rectangle
instance Eq Time
instance Ord Time
instance Show Time
instance Eq Range
instance Ord Range
instance Show Range
instance Eq Line
instance Ord Line
instance Show Line
-- | A basic parser for .srt files (subtitles) based on Attoparsec
-- and Text
module Text.Subtitles.SRT
-- | Main Parser, gives you a list of all the Lines of the subtitle. It
-- fails if the subtitle doesn't have any Lines.
parseSRT :: Parser Subtitles
-- | The individual Line parser. Given the upper example return the
-- corresponding Line representation
parseSingleLine :: Parser Line
-- | This version avoid the problems associated with peekChar and thus is
-- safe to use in this module. Subject to removal once parseOnly is
-- fixed.
parseOnly' :: Parser a -> Text -> Either String a