@@ -7,6 +7,15 @@ part of themoviedb package, including this file, may be copied, | |||
modified, propagated, or distributed except according to the terms | |||
contained in the LICENSE file. | |||
-} | |||
{- | | |||
This module provides some helper functions for loading an API 'Key' or | |||
complete 'Context' from the user's environment or from the file | |||
system. Currently only POSIX systems are supported but patches are | |||
welcome! | |||
-} | |||
module Network.API.TheMovieDB.Util (loadKey, loadContext) where | |||
import Control.Monad (liftM, msum) | |||
@@ -56,7 +65,7 @@ readFileMaybe n = do realName <- expandFile n | |||
-- * @~/.tmdbkey@ file | |||
-- | |||
-- If the key can't be loaded from any of those places the result will | |||
-- be 'Nothing'. | |||
loadKey :: IO (Maybe Key) | |||
loadKey = liftM msum . sequence $ [env, xdgConfig, config, home] | |||
where env = getEnvMaybe "TMDB_KEY" |
@@ -0,0 +1,28 @@ | |||
# TheMovieDB API for Haskell | |||
This is a simple library that provides functions for retrieving movie | |||
metadata from [TheMovieDB][] API. To use this library you need to | |||
request an API key from TheMovieDB. Follow the directions on the | |||
[API][] page. | |||
[TheMovieDB]: http://themoviedb.com | |||
[API]: http://docs.themoviedb.apiary.io | |||
# Documentation | |||
See the [Network.API.TheMovieDB][] module for complete documentation. | |||
[Network.API.TheMovieDB]: ./Network/API/TheMovieDB.hs | |||
# Example | |||
There's an [example][] application in the `example` directory. | |||
Surprising, I know. | |||
[example]: ./example/Main.hs | |||
# Warning | |||
This library currently uses HTTP and not *HTTPS* while sending your | |||
API key to TheMovieDB. In order to fix this we'll need to use | |||
something other than `Network.HTTP`. Patches welcome! |
@@ -0,0 +1,5 @@ | |||
#+title: TheMovieDB To-do List | |||
* Features | |||
** TODO Switch to HTTPS/SSL/TLS | |||
- This requires using something other than Network.HTTP. |
@@ -3,7 +3,7 @@ name: themoviedb | |||
version: 0.1.0.0 | |||
synopsis: Haskell API bindings for http://themoviedb.org | |||
homepage: http://github.com/pjones/themoviedb | |||
bug-reports: http://github.com/pjones/themoviedb/issues | |||
license: MIT | |||
license-file: LICENSE | |||
author: Peter Jones <pjones@pmade.com> | |||
@@ -11,12 +11,23 @@ maintainer: Peter Jones <pjones@pmade.com> | |||
copyright: Copyright: (c) 2012 Peter Jones <pjones@pmade.com> | |||
category: Network, API | |||
stability: experimental | |||
tested-with: GHC == 7.0.4 | |||
build-type: Simple | |||
cabal-version: >=1.8 | |||
description: This library provides functions for retrieving metadata | |||
from the <http://TheMovieDB.org> API. Documentation | |||
can be found in the "Network.API.TheMovieDB" module. | |||
extra-source-files: | |||
README.md | |||
LICENSE | |||
TODO.org | |||
Test/config-good.json | |||
Test/movie-bad.json | |||
Test/movie-good.json | |||
Test/search-good.json | |||
Test/TheMovieDB.hs | |||
library | |||
exposed-modules: Network.API.TheMovieDB, | |||
Network.API.TheMovieDB.Util |