From: Greg Burri Date: Wed, 30 Sep 2009 12:32:58 +0000 (+0200) Subject: Merge branch 'master' of git@dev.euphorik.ch:pompage X-Git-Url: http://git.euphorik.ch/?p=pompage.git;a=commitdiff_plain;h=94fb6110cfb60b67ce97f4e5290f1cd53dd52809;hp=04a3eeba4f7c754e2ca3b7f56feb0793fbbf91a6 Merge branch 'master' of git@dev.euphorik.ch:pompage --- diff --git a/src/Pompage.hs b/src/Pompage.hs index 6cf4349..e3066f2 100644 --- a/src/Pompage.hs +++ b/src/Pompage.hs @@ -13,21 +13,21 @@ import Control.Monad (foldM) 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 + movieFiles :: [FilePath] + , movieId :: Int + , movieTitle :: String + , movieYear :: Maybe Int + , movieDirectors :: [String] + , movieActors :: [String] + , movieCountries :: [String] + , movieLength :: Maybe Int + , movieUserRating :: Maybe Int + , moviePressRating :: Maybe Int + , movieGenres :: [String] + , movieSynopsis :: String + , movieBudget :: Int + , movieBudgetUnit :: String + , movieUrl :: String } deriving (Show) data Arg = XML | MovieDir deriving (Show, Eq) @@ -46,6 +46,7 @@ main = do print movies print paths +coversDir = "../img/covers" movieExtenstions = ["avi", "mkv", "rmvb", "ogm", "divx"] usage = "Usage : %s -d -x \n" @@ -98,12 +99,26 @@ filePaths predicat baseDir = do readXMLFile :: FilePath -> IO Movies -readXMLFile file = undefined +readXMLFile file = do + content <- readFile file + let Just root = parseXMLDoc content + return $ + foldl (\acc elem -> + case elementXMLToMovie elem of + Nothing -> acc + Just movie -> movie : acc) + [] + (elChildren root) + +elementXMLToMovie :: Element -> Maybe Movie +elementXMLToMovie elem = undefined {- - file <- readFile "../xml/test.xml" - --print $ parseXMLDoc file +findAttr (QName "id" Nothing Nothing) elem of + Nothing -> acc + Just id -> -} + writeXMLFile :: Movies -> FilePath -> IO () writeXMLFile movies file = undefined diff --git a/start.sh b/start.sh index 716e300..a501312 100755 --- a/start.sh +++ b/start.sh @@ -1,3 +1,7 @@ #!/bin/bash + +# Usage : +# -d -x +# cd src -ruby yopyop.rb -x ../xml/divx.xml -d /home/gburri/mininux/fat/Films #plop/BIG/Films #/media/BIG/Films \ No newline at end of file +runhaskell Pompage.hs -d /home/gburri/mininux/fat/Films -x ../xml/test.xml \ No newline at end of file