summaryrefslogtreecommitdiff
path: root/src/PhotoStore.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/PhotoStore.hs')
-rw-r--r--src/PhotoStore.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/PhotoStore.hs b/src/PhotoStore.hs
new file mode 100644
index 0000000..57b2ccc
--- /dev/null
+++ b/src/PhotoStore.hs
@@ -0,0 +1,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])