From: PHO Date: Thu, 22 Jan 2009 06:36:06 +0000 (+0900) Subject: Initial revision X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=94ea2e8f1ee116d4b1c016d520b31b025e75b6ae;p=fixparanoia.git Initial revision --- 94ea2e8f1ee116d4b1c016d520b31b025e75b6ae diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cf4112 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +Setup +*.hi +*.o +dist diff --git a/Setup.lhs b/Setup.lhs new file mode 100644 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 index 0000000..6dc68dd --- /dev/null +++ b/fixparanoia.cabal @@ -0,0 +1,14 @@ +name: fixparanoia +version: 1.0 +synopsis: +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 index 0000000..1ad548f --- /dev/null +++ b/fixparanoia.hs @@ -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 ()