This commit is contained in:
senstella
2025-11-03 21:56:33 +09:00
parent b23a69df75
commit de13e895c8

View File

@@ -16,16 +16,24 @@ data ContentType
| Tv
deriving (Show, Eq, Generic, FromJSON, ToJSON)
newtype ID = ID String deriving (Show, Eq, Generic, FromJSON, ToJSON)
newtype ContentID = ContentID String deriving (Show, Eq, Generic, FromJSON, ToJSON)
newtype IDPrefix = IDPrefix String deriving (Show, Eq, Generic, FromJSON, ToJSON)
newtype SubtitleID = SubtitleID String deriving (Show, Eq, Generic, FromJSON, ToJSON)
newtype ContentIDPrefix = ContentIDPrefix String deriving (Show, Eq, Generic, FromJSON, ToJSON)
newtype Url = Url String deriving (Show, Eq, Generic, FromJSON, ToJSON)
newtype BingeGroup = BingeGroup String deriving (Show, Eq, Generic, FromJSON, ToJSON)
newtype OpensubtitleHash = OpensubtitleHash String deriving (Show, Eq, Generic, FromJSON, ToJSON)
data ImageShape = Square | Poster | Landscape deriving (Show, Eq, Generic, FromJSON, ToJSON)
data YearInfo = Single Int | Range Int Int deriving (Show, Eq, Generic, FromJSON, ToJSON)
data Language = Language String deriving (Show, Eq, Generic, FromJSON, ToJSON)
data Trailer = Trailer String | Clip String deriving (Show, Eq, Generic, FromJSON, ToJSON)
data MetaLink
@@ -36,10 +44,34 @@ data MetaLink
}
deriving (Show, Generic, FromJSON, ToJSON)
data Stream = UrlStream Url | YoutubeStream Url | TorrentStream | ExternalStream MetaLink deriving (Show, Generic, FromJSON, ToJSON)
data StreamDetails = StreamDetails
{ name :: Maybe String,
title :: Maybe String,
description :: Maybe String,
subtitles :: Maybe [Subtitle],
-- we arent doing soruces cuz no torrent for now
bingeGroup :: Maybe BingeGroup,
vContentIDeoHash :: Maybe OpensubtitleHash,
vContentIDeoSize :: Maybe Int,
filename :: Maybe String
}
deriving (Show, Generic, FromJSON, ToJSON)
data Video = Video
{ id :: ID,
data StreamSource
= UrlSource Url
| YoutubeSource String
| TorrentSource
| ExternalSource MetaLink
deriving (Show, Generic, FromJSON, ToJSON)
data Stream = Stream
{ details :: StreamDetails,
source :: StreamSource
}
deriving (Show, Generic, FromJSON, ToJSON)
data Video = VContentIDeo
{ id :: ContentID,
title :: String,
released :: UTCTime,
thumbnail :: Maybe Url,
@@ -55,12 +87,12 @@ data Video = Video
data Feature
= Search
{ required :: Bool,
options :: Maybe [IDPrefix],
options :: Maybe [ContentIDPrefix],
optionsLimit :: Maybe Int
}
| Genre
{ required :: Bool,
options :: Maybe [IDPrefix],
options :: Maybe [ContentIDPrefix],
optionsLimit :: Maybe Int
}
| Skip
@@ -69,28 +101,28 @@ data Feature
data Resource a where
MetaResource ::
{ metaTypes :: [ContentType],
metaIdPrefix :: [IDPrefix]
metaContentIDPrefix :: [ContentIDPrefix]
} ->
Resource MetaData
CatalogResource ::
{ catalogTypes :: [ContentType],
catalogIdPrefix :: [IDPrefix],
catalogContentIDPrefix :: [ContentIDPrefix],
catalogExtra :: [Feature]
} ->
Resource Catalog
StreamResource ::
{ streamTypes :: [ContentType],
streamIdPrefix :: [IDPrefix]
streamContentIDPrefix :: [ContentIDPrefix]
} ->
Resource Stream
SubtitleResource ::
{ subtitleTypes :: [ContentType],
subtitleIdPrefix :: [IDPrefix]
subtitleContentIDPrefix :: [ContentIDPrefix]
} ->
Resource Subtitle
data MetaData = Meta
{ id :: ID,
{ id :: ContentID,
contentType :: ContentType,
name :: String,
genres :: Maybe [String],
@@ -115,9 +147,14 @@ data MetaData = Meta
}
deriving (Show, Generic, FromJSON, ToJSON)
data Catalog = Catalog {}
data Catalog = Catalog {} deriving (Show, Generic, FromJSON, ToJSON)
data Subtitle = Subtitle {}
data Subtitle = Subtitle
{ id :: SubtitleID,
url :: Url,
language :: Language
}
deriving (Show, Generic, FromJSON, ToJSON)
main :: IO ()
main = putStrLn "Hello, Haskell!"