summaryrefslogtreecommitdiff
path: root/src/PhotoStore.hs
blob: 57b2cccf7a28e8094636ced47c58d67ed45d34fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module PhotoStore where

import Data
import System.Directory

data Config = Config
  { pendingPath :: String
  , photosPath :: String
  }

validAlbumName name =
     name /= "."
  && name /= ".."

getAlbums :: Config -> IO [Album]
getAlbums config = do
  pending <- getDirectoryContents (pendingPath config)
  permanent <- getDirectoryContents (photosPath config)
  return ([Album name True | name <- filter validAlbumName pending] ++
          [Album name False | name <- filter validAlbumName permanent])