add more details (and the image‼) to rss
This commit is contained in:
parent
969cdc938d
commit
fa0b826c26
5 changed files with 69 additions and 45 deletions
|
@ -13,6 +13,7 @@ module Info
|
|||
CompareKey (..), compareKeyFor, compareFor, sortFor,
|
||||
|
||||
Artist (..), Images' (..), Images, Image (..), Desc (..), DescField (..),
|
||||
PreviewImage (..), previewImage,
|
||||
|
||||
Link (..), Update (..), Bg (..),
|
||||
|
||||
|
@ -117,6 +118,13 @@ data Images' a =
|
|||
|
||||
type Images = Images' Image
|
||||
|
||||
data PreviewImage = PFull Image | PThumb FilePath
|
||||
|
||||
previewImage :: Info -> Maybe PreviewImage
|
||||
previewImage info
|
||||
| Just img <- find (.sfw) $ allImages info.images = Just $ PFull img
|
||||
| otherwise = PThumb <$> info.thumb'
|
||||
|
||||
|
||||
data Link =
|
||||
Link {
|
||||
|
@ -261,8 +269,7 @@ newtype NoThumb = NoThumb FilePath
|
|||
instance Show NoThumb where show (NoThumb dir) = "no thumbnail for " ++ dir
|
||||
|
||||
getThumb :: FilePath -> Info -> FilePath
|
||||
getThumb dir =
|
||||
maybe (throw $ NoThumb dir) (\t -> dir </> thumbFile t) . thumb
|
||||
getThumb dir = maybe (throw $ NoThumb dir) (\t -> dir </> thumbFile t) . thumb
|
||||
|
||||
thumbFile :: FilePath -> FilePath
|
||||
thumbFile = addSuffix "_small"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue