From 94ea2e8f1ee116d4b1c016d520b31b025e75b6ae Mon Sep 17 00:00:00 2001 From: PHO Date: Thu, 22 Jan 2009 15:36:06 +0900 Subject: [PATCH 1/1] Initial revision --- .gitignore | 4 ++++ Setup.lhs | 3 +++ fixparanoia.cabal | 14 ++++++++++++++ fixparanoia.hs | 15 +++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 .gitignore create mode 100644 Setup.lhs create mode 100644 fixparanoia.cabal create mode 100644 fixparanoia.hs 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 () -- 2.40.0