--- /dev/null
+import System.IO (readFile, FilePath(..))
+import System.Environment (getArgs)
+import Data.List
+import Text.XML.Light
+
+type Movies = [Movie]
+
+data Movie = Movie {
+ files :: [FilePath]
+ , id :: Int
+ , title :: String
+ , year :: Maybe Int
+ , directors :: [String]
+ , actors :: [String]
+ , countries :: [String]
+ , length :: Maybe Int
+ , userRating :: Maybe Int
+ , pressRating :: Maybe Int
+ , genre :: [String]
+ , synopsis :: String
+ , budget :: Int
+ , budgetUnit :: String
+ , url :: String
+} deriving (Show)
+
+data Args = Args {
+ xml :: String
+ , moviesDir :: FilePath
+} deriving (Show)
+
+test = do
+ args <- getArgs
+ case readArgs args of
+ Left mess -> print mess
+ Right args -> do
+ paths <- moviePaths $ moviesDir args
+ file <- readFile "../xml/test.xml"
+ print $ parseXMLDoc file
+
+movieExtenstions = ["avi", "mkv", "rmvb", "ogm", "divx"]
+
+readArgs :: [String] -> Either String Args
+readArgs plop = undefined
+{--readArgs (name:value:rest) = case name of
+ "-x" -> { xml = value }
+ "-d" -> { moviesDir = value }--}
+
+moviePaths :: FilePath -> IO [FilePath]
+moviePaths dir = undefined
+
+readXMLFile :: FilePath -> IO Movies
+readXMLFile file = undefined
+
+
+
+writeXMLFile :: Movies -> FilePath -> IO ()
+writeXMLFile movies file = undefined
+
+filesPath :: FilePath -> IO [FilePath]
+filesPath basePath = undefined
+
+movieName :: FilePath -> String
+movieName = undefined
+
+-- Int is the module id.
+data SearchResult = OK (Int, Movie)
+ | Many [(Int, String)] -- String is the name of the movie.
+ | NotFound
+
+data Module = Module {
+ search :: String -> IO SearchResult
+ -- Int is the module id. FilePath is a path to the image like "../img/4353"
+ , downloadImage :: Int -> FilePath
+}
+
+{-
+ Gets a movie by asking the given module to find a movie.
+ A movie is seeked by its the filename.
+ If there is many possibilities then it will ask the user.
+-}
+searchAMovie :: String -> Module -> IO SearchResult
+searchAMovie filename mod = undefined
+
+