pgdl 6.8 → 6.9
raw patch · 3 files changed
+49/−2 lines, 3 files
Files
- pgdl.cabal +2/−2
- src/GenStat.hs +29/−0
- src/TestExist.hs +18/−0
pgdl.cabal view
@@ -1,6 +1,6 @@ name: pgdl-version: 6.8+version: 6.9 license: PublicDomain license-file: LICENSE author: sifmelcara@@ -24,7 +24,7 @@ executable pgdl hs-source-dirs: src main-is: Main.hs- other-modules: Beaut, Chkcfg, FetchHtml, Getconfig, Log, PlayVid, PrsVid, Search, Video + other-modules: Beaut, Chkcfg, FetchHtml, Getconfig, Log, PlayVid, PrsVid, Search, Video, GenStat, TestExist build-depends: base == 4.* , split, process, directory, http-conduit >= 2.0.0, bytestring, transformers, resourcet, tagsoup,
+ src/GenStat.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE LambdaCase #-}++module GenStat (genStat) where++import Video+import TestExist++import qualified Data.Text as T++genStat :: Video -> IO T.Text+genStat vid = do+ st <- toStr $ downloaded name+ return $ (spc 3) `app` date `app`+ (spc 3) `app` size `app`+ (spc 20) `app` st `app`+ (spc 30)+ where date = vidDate vid+ size = vidSize vid+ name = vidName vid+ app = T.append+ spc :: Int -> T.Text+ spc i = T.replicate i " "++toStr :: IO Bool -> IO T.Text+toStr b = b >>= \case+ True -> return "Downloaded"+ _ -> return "Not Downloaded"+
+ src/TestExist.hs view
@@ -0,0 +1,18 @@+{-# LANGUAGE OverloadedStrings #-}++module TestExist where++import Getconfig++import Data.Function+import System.Directory+import System.FilePath++import qualified Data.Text as T++downloaded :: T.Text -> IO Bool+downloaded t = do+ lcd <- getLocaldir+ doesFileExist $ (combine `on` T.unpack) lcd t++