Initial revision
authorPHO <pho@cielonegro.org>
Thu, 22 Jan 2009 06:36:06 +0000 (15:36 +0900)
committerPHO <pho@cielonegro.org>
Thu, 22 Jan 2009 06:36:06 +0000 (15:36 +0900)
.gitignore [new file with mode: 0644]
Setup.lhs [new file with mode: 0644]
fixparanoia.cabal [new file with mode: 0644]
fixparanoia.hs [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..1cf4112
--- /dev/null
@@ -0,0 +1,4 @@
+Setup
+*.hi
+*.o
+dist
diff --git a/Setup.lhs b/Setup.lhs
new file mode 100644 (file)
index 0000000..5bde0de
--- /dev/null
+++ b/Setup.lhs
@@ -0,0 +1,3 @@
+#!/usr/bin/env runhaskell
+> import Distribution.Simple
+> main = defaultMain
diff --git a/fixparanoia.cabal b/fixparanoia.cabal
new file mode 100644 (file)
index 0000000..6dc68dd
--- /dev/null
@@ -0,0 +1,14 @@
+name:                fixparanoia
+version:             1.0
+synopsis:            <Project description>
+description:         <Project description>
+category:            Sound
+license:             PublicDomain
+author:              PHO
+maintainer:          pho at cielonegro dot org
+build-type:          Simple
+build-Depends:       base, directory, pcre-light
+
+executable:          fixparanoia
+main-is:             Fixparanoia.hs
+ghc-options:         -Wall
diff --git a/fixparanoia.hs b/fixparanoia.hs
new file mode 100644 (file)
index 0000000..1ad548f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/local/bin/runhaskell
+import System.Directory
+import Text.Regex.PCRE.Light.Char8
+
+main :: IO ()
+main = do files <- getDirectoryContents "."
+          mapM_ fixIfNeedBe files
+
+fixIfNeedBe :: FilePath -> IO ()
+fixIfNeedBe fName
+    = case match (compile "^track([0-9]+)\\.cdda\\.wav$" []) fName [] of
+        Just [_, num]
+            -> do putStrLn (fName ++ " -> " ++ num ++ ".wav")
+                  renameFile fName (num ++ ".wav")
+        _   -> return ()