epub-tools 2.3 → 2.4
raw patch · 35 files changed
+564/−46 lines, 35 filessetup-changed
Files
- LICENSE +1/−1
- README.md +95/−0
- Setup.hs +0/−1
- TODO +45/−0
- changelog.md +119/−0
- doc/INSTALL +24/−0
- doc/dev/notes +13/−0
- doc/hcar/epubtoolsCommandlineepubU-De.tex +30/−0
- epub-tools.cabal +12/−4
- src/EpubTools/EpubMeta/Display.hs +0/−1
- src/EpubTools/EpubMeta/Edit.hs +0/−1
- src/EpubTools/EpubMeta/Export.hs +0/−1
- src/EpubTools/EpubMeta/Import.hs +0/−1
- src/EpubTools/EpubMeta/Opts.hs +1/−2
- src/EpubTools/EpubMeta/Util.hs +0/−1
- src/EpubTools/EpubName/Doc/Dsl.hs +0/−1
- src/EpubTools/EpubName/Doc/Rules.hs +4/−1
- src/EpubTools/EpubName/Format/Author.hs +9/−9
- src/EpubTools/EpubName/Format/Compile.hs +0/−1
- src/EpubTools/EpubName/Format/Format.hs +0/−1
- src/EpubTools/EpubName/Format/PubYear.hs +0/−1
- src/EpubTools/EpubName/Format/Util.hs +0/−1
- src/EpubTools/EpubName/Main.hs +0/−1
- src/EpubTools/EpubName/Opts.hs +15/−8
- src/EpubTools/EpubName/Util.hs +0/−1
- src/EpubTools/EpubZip/Opts.hs +1/−2
- src/EpubTools/epubmeta.hs +0/−1
- src/EpubTools/epubname.hs +0/−1
- src/EpubTools/epubzip.hs +0/−1
- testsuite/EpubTools/Test/EpubName/Format.hs +68/−1
- testsuite/EpubTools/Test/EpubName/PubYear.hs +0/−1
- testsuite/EpubTools/test-epubname.hs +0/−1
- util/all-books.hs +43/−0
- util/prefs/boring +69/−0
- util/win-dist.sh +15/−0
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2008-2013 Dino Morelli+Copyright (c) 2008-2014 Dino Morelli All rights reserved. Redistribution and use in source and binary forms, with or without
+ README.md view
@@ -0,0 +1,95 @@+# epub-tools+++## Synopsis++Command line utilities for working with epub files (Haskell)+++## Description++A suite of command-line utilities for creating and manipulating epub book files. Included are: epubmeta, epubname, epubzip. This software uses the epub-metadata library, also available on Hackage.++### epubmeta++epubmeta is a command-line utility for examining and editing epub book metadata. With it you can export, import and edit the raw OPF Package XML document for a given book. Or simply dump the metadata to stdout for viewing in a friendly format.++Here's an example of epubmeta output:++> $ epubmeta Kelly_Kessel_Lethem-NinetyPercentOfEverything.epub+>+> package+> version: 2.0+> unique-identifier: calibre_id+> identifier+> id: calibre_id+> scheme: calibre+> text: b1026732-69a5-4a05-a8d9-a1701685f6fa+> identifier+> scheme: ISBN+> text: 1-590620-00-3+> title: Ninety Percent of Everything+> language: en-us+> contributor+> text: calibre (0.5.1) [http://calibre.kovidgoyal.net]+> file-as: calibre+> role: bkp+> creator+> text: James Patrick Kelly+> file-as: Kelly, James Patrick+> role: aut+> creator+> text: John Kessel+> role: aut+> creator+> text: Jonathan Lethem+> role: aut+> date: 2001-03-25T00:00:00+> publisher: www.Fictionwise.com+> subject: Science Fiction/Fantasy++### epubname++epubname is a command-line utility for renaming epub ebook files based on their OPF Package metadata. It tries to use author names and title info to construct a sensible name.++Using it looks like this:++> $ epubname poorly-named-book.epub+>+> poorly-named-book.epub -> WattsPeter-Blindsight_2006.epub+>+> $ epubname another-poorly-named-book.epub+>+> another-poorly-named-book.epub -> Kelly_Kessel_Lethem-NinetyPercentOfEverything.epub++### epubzip++epubzip is a handy utility for zipping up the files that comprise an epub into an .epub zip file. Using the same technology as epubname, it can try to make a meaningful filename for the book.+++## Getting source++- Download the cabalized source package [from Hackage](http://hackage.haskell.org/package/epub-tools)+- Download the cabalized source tarball [from here](http://ui3.info/d/proj/epub-tools/epub-tools-2.4.tar.gz)+- epub-tools is available for Arch Linux [from the AUR](http://aur.archlinux.org/packages/epub-tools/)+- Download [binaries for Windows](http://ui3.info/d/proj/epub-tools/epub-tools-2.4-win.zip)+- Get the source with darcs: `$ darcs get http://ui3.info/darcs/epub-tools`+- If you're just looking, [browse the source](http://ui3.info/darcs/epub-tools)++And once you have it, building the usual way:++> $ cabal configure --enable-tests+> $ cabal build+> $ cabal test+> $ cabal install+++## Installing++Build and install with cabal-install:+ `$ cabal update ; cabal install epub-tools`+++## Contact++Dino Morelli <[dino@ui3.info](mailto:dino@ui3.info)>
Setup.hs view
@@ -1,6 +1,5 @@ #! /usr/bin/env runhaskell --- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
+ TODO view
@@ -0,0 +1,45 @@+-----+general++- Some notes in README about installing epubcheck if possible++- Add more (all?) of the darcs-tracked files to cabal so they're part of the sdist++- Would like to way to be able to insert a publishing year tag into the OPF data like these:+ <dc:date opf:event="publication">2011</dc:date>+ <dc:date opf:event="original-publication">2011</dc:date>+ <dc:subject>anthology</dc:subject>++ Perhaps as part of epubmeta?++- Perform util/win-dist.sh behavior in post-build step of Setup.hs? I think it makes sense.++-----+epubmeta++- When a backup is made during -e[SUF], make a note of it on stdout++- Maybe more options for modifying metadata from the command-line++- Ability to dump the actual Haskell Metadata structure out. Could be used to make unit tests for epubname.++-----+epubname++- Add info in the usage about submitting metadata to me using epubmeta when there are problems.++- Rethink that Publisher business, maybe get rid of it.++- I'd like to see the author name formatting be more flexible so you can opt to not have it call scrubString as is mandatory now.++- Try to make tests of formatters into a conf file thing as well. This is kind of important. Not part of HUnit or QC+ module hierarchy:+ EpubName/+ Test/+ Compile+ Test++- Can possibly parallelize book renaming, each book is an atomic operation. Look into it.++-----+epubzip
+ changelog.md view
@@ -0,0 +1,119 @@+2.4 (2014-03-19)++ * Fixed problem in Windows cmd shell with missing UNIX HOME+ env variable++ * Now gracefully handling last-name-first creators. For books+ with no file-as and the Creator text arranged last-name-first+ with a comma, do the right thing.++ * Added a new rule for generically-titled magazines with an issue++ * Incorporated project website info into README.md and+ changelog.md files. This information is now in source control+ where it belongs.++ * Added missing files to .cabal for sdist++ * Changed copyright date range to 2014+++2.3 (2013-09-20)++ * These tools now support both epub2 and epub3+ * Documentation changes and additions+++2.2 (2013-04-14)++ * Updated to build against recent changes and bug fixes in+ epub-metadata 3.0+ * All support data files have been brought into the binaries+ now. This makes these tools more tolerant to being moved to a+ different location than what they were configured for build with.+ * Some documentation additions and changes+++2.1.1 (2013-02-03)++ * Fixed a stack overflow problem with some epub documents+++2.1.0 (2013-02-01)++ * Added new subjectMatch command to the DSL, similar to+ authorMatch. This is being primarily used to detect anthology+ publications.+ * Removed some rules that are now handled by anthology detection,+ and fixed relevant unit tests+ * Clarified DSL documentation for authorMatch a little more+ * Modified rules for some magazines to reflect changes to+ recent editions+ * Fixed an error in the DSL documentation+ * Fixed a bug in epubzip where no epub file will be created if+ none already exists+++2.0.0 (2012-10-31)++ * Major redesign of the formatting rules system. Renaming+ machinery is now described in a domain-specific language,+ NOT in statically compiled code. Users are able to extend the+ functionality with custom naming rules in conf files.+ * Added interactive mode to ask about each file rename as they+ happen, this is like darcs now!+ * Added ability to specify target directory for books to be+ moved to as part of renaming. Includes code to check that target+ directory exists.+ * Removed --overwrite option. Turns out, renameFile has always+ been smart enough to not overwrite existing.+ * Added / character to filters, a big no-no character for file+ paths on most sane filesystems+ * Publication year was looking for publication before+ original-publication, causing problems in books that have+ both tags+ * Miscellaneous rules changes for various publications+++1.1.2 (2012-01-29)++ * Changed how this code provides epub zip file contents as a+ ByteString to the epub-metadata library. Need to read this data+ strictly to avoid dangling open files.+ * Corrected for breakage due to change in title format of Eclipse magazine+ * Some work done on the utility script for deploying Windows+ binaries of these tools+ * Added parsing support and test cases for more date formats+ * Minor usage info changes+++1.1.1 (2011-11-15)++ * Changed how publication date is found to more closely follow+ the OPF spec recommendations+ * Changed the switches related to publication date+ * Redesigned unit test code and added more tests for new date code+++1.1.0 (2011-11-04)++ * Huge redesign of how formatting works, dramatically shortening+ the code needed to handle any given book type. Code is much more+ monadic now and consolidated into one module.+ * Many changes/additions to magazine and compilation book name+ formatting+ * Fixed a group of bugs that occur when a creator has only a+ single word for their name+ * Extensive changes/additions to unit testing for above+++1.0.0.1 (2011-10-27)++ * Extensive changes to the cabal build of this project to bring+ it up to Cabal 1.10+ * Unit tests now use the test-suite cabal stanza+++1.0.0.0 (2011-04-23)++ * Initial release
+ doc/INSTALL view
@@ -0,0 +1,24 @@+Installation information for the Windows binary distribution+++First, understand that this is command-line software. You don't run+it with the mouse. There is no icon. It's not going in your Start+menu. It's to be run from within a command shell.+++These epub tools will run from the Windows cmd.exe shell.++Even better, what I would do is install the cygwin tools and run+them from a bash or similar shell. Having cygwin in place, I would+place the binaries in /usr/local/bin, which should be on your PATH+in cygwin shells. And you're good to go.+++For help, try this in your shell:++ > epubmeta.exe --help+ > epubname.exe --help+ > epubzip.exe --help+++And if you find bugs or problems, email: dino@ui3.info
+ doc/dev/notes view
@@ -0,0 +1,13 @@+-----+This project may benefit from the use of some other tools out here+such as epubcheck, zip and unzip++- Tools unzipping can try to fall back on unzip upon failure++- epubmeta needs write capability++- epub creation, think about this++- always release Windows binaries++- OSX too?
+ doc/hcar/epubtoolsCommandlineepubU-De.tex view
@@ -0,0 +1,30 @@+% epubtoolsCommandlineepubU-De.tex+\begin{hcarentry}{epub-tools (Command-line epub Utilities)}+\label{epubtools}+\report{Dino Morelli}%11/12+\status{stable, actively developed}+\makeheader++A suite of command-line utilities for creating and manipulating epub book files. Included are: epubmeta, epubname, epubzip.++epubmeta is a command-line utility for examining and editing epub book metadata. With it you can export, import and edit the raw OPF Package XML document for a given book. Or simply dump the metadata to stdout for viewing in a friendly format.++epubname is a command-line utility for renaming epub ebook files based on the metadata. It tries to use author names and title info to construct a sensible name.++epubzip is a handy utility for zipping up the files that comprise an epub into an .epub zip file. Using the same technology as epubname, it can try to make a meaningful filename for the book.++This project is built on the latest epub-metadata library and so supports epub3 for the first time.++See also epub-metadata.++epub-tools is available from Hackage and the Darcs repository below.++\FurtherReading+\begin{compactitem}+\item Project page:+\url{http://ui3.info/d/proj/epub-tools.html}++\item Source repository:+\texttt{darcs get} \url{http://ui3.info/darcs/epub-tools}+\end{compactitem}+\end{hcarentry}
epub-tools.cabal view
@@ -1,10 +1,10 @@ name: epub-tools cabal-version: >= 1.8-version: 2.3+version: 2.4 build-type: Simple license: BSD3 license-file: LICENSE-copyright: 2008-2013 Dino Morelli+copyright: 2008-2014 Dino Morelli author: Dino Morelli maintainer: Dino Morelli <dino@ui3.info> stability: stable@@ -14,8 +14,17 @@ category: Application, Console tested-with: GHC >= 7.6.2 -extra-source-files: testsuite/EpubTools/*.hs+extra-source-files: changelog.md+ doc/dev/notes+ doc/hcar/epubtoolsCommandlineepubU-De.tex+ doc/INSTALL+ README.md+ testsuite/EpubTools/*.hs testsuite/EpubTools/Test/EpubName/*.hs+ TODO+ util/all-books.hs+ util/prefs/boring+ util/win-dist.sh source-repository head type: darcs@@ -51,7 +60,6 @@ EpubTools.EpubName.Opts EpubTools.EpubName.Prompt EpubTools.EpubName.Util- ghc-options: -Wall -rtsopts -with-rtsopts=-K32m test-suite epubname-tests
src/EpubTools/EpubMeta/Display.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubMeta/Edit.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubMeta/Export.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubMeta/Import.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubMeta/Opts.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -106,5 +105,5 @@ , " epub3: http://www.idpf.org/epub/30/spec/epub30-publications.html" , "" , ""- , "Version 2.3 Dino Morelli <dino@ui3.info>"+ , "Version 2.4 Dino Morelli <dino@ui3.info>" ]
src/EpubTools/EpubMeta/Util.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubName/Doc/Dsl.hs view
@@ -1,4 +1,3 @@--- Copyright: 2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubName/Doc/Rules.hs view
@@ -1,4 +1,3 @@--- Copyright: 2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -103,6 +102,10 @@ , "magLocus" , " titlePat \"^(Locus), ([a-zA-Z]+) ([0-9]{4})$\"" , " name \"(scrub 1)Magazine(3)-(monthNum 2)\""+ , ""+ , "magGenericWithIssue"+ , " titlePat \"(.* Magazine):? Issue ([0-9]+).*\""+ , " name \"(scrub 1)(pad 2 2)\"" , "" , "anthology" , " subjectMatch \"anthology\""
src/EpubTools/EpubName/Format/Author.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -55,19 +54,20 @@ nameParts :: String -> [String] nameParts s = maybe [] id $ foldl mplus Nothing matches where- matches =- [ matchRegex (mkRegex "(.*) ([^ ]+)$") s- , matchRegex (mkRegex "(.*)") s+ matches = map ($ s)+ [ matchRegex (mkRegex "(.*), +([^ ]+)$") >=> return . reverse+ , matchRegex (mkRegex "(.*) +([^ ]+)$")+ , matchRegex (mkRegex "(.*)") ] lastName' :: String -> String lastName' s = maybe "" head $ foldl mplus Nothing matches where- matches =- [ matchRegex (mkRegex "(.*),.*") s- , matchRegex (mkRegex ".* (.*)") s- , matchRegex (mkRegex "(.*)") s+ matches = map ($ s)+ [ matchRegex (mkRegex "(.*),.*")+ , matchRegex (mkRegex ".* (.*)")+ , matchRegex (mkRegex "(.*)") ] lastName :: Creator -> String@@ -84,7 +84,7 @@ where isAut (Creator (Just "aut") _ _ _) = True isAut (Creator Nothing _ _ _) = True- isAut _ = False+ isAut _ = False {- A common simple formatter for many book authors
src/EpubTools/EpubName/Format/Compile.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubName/Format/Format.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubName/Format/PubYear.hs view
@@ -1,4 +1,3 @@--- Copyright: 2011-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubName/Format/Util.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubName/Main.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubName/Opts.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -46,12 +45,19 @@ defaultRulesFile :: FilePath defaultRulesFile = "default.rules" -userRulesPath :: IO FilePath-userRulesPath = do- homeDir <- getEnv"HOME"- return $ homeDir </> ".epubtools" </> defaultRulesFile +userRulesPath :: IO (Maybe FilePath)+userRulesPath = foldl (liftM2 mplus) (return Nothing) $ map mkdir+ [ ("HOME", ".epubtools") -- UNIX-like+ , ("APPDATA", "epubtools") -- Windows+ ] + where+ mkdir (var, subdir) = do+ homeDir <- lookupEnv var+ return $ (</> subdir </> defaultRulesFile) `fmap` homeDir++ defaultOptions :: IO Options defaultOptions = do urp <- userRulesPath@@ -63,7 +69,7 @@ , optInteractive = False , optNoAction = False , optPublisher = False- , optRulesPaths = [ urp ]+ , optRulesPaths = maybeToList urp , optTargetDir = "." , optVerbose = Nothing , optPubYear = Publication@@ -199,7 +205,8 @@ , "epubname will search the following locations for a rules file, in this order:" , "" , " Path specified in a --rules switch"- , " $HOME/.epubtools/default.rules"+ , " $HOME/.epubtools/default.rules -- or:"+ , " %APPDATA%\\epubtools\\default.rules -- in Windows" , " Built-in rules, a comprehensive stock set of naming rules" , "" , "Use the built-in rules as a model for a custom file. See --dump-rules above"@@ -212,5 +219,5 @@ , " epub3: http://www.idpf.org/epub/30/spec/epub30-publications.html" , "" , ""- , "Version 2.3 Dino Morelli <dino@ui3.info>"+ , "Version 2.4 Dino Morelli <dino@ui3.info>" ]
src/EpubTools/EpubName/Util.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/EpubZip/Opts.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -71,5 +70,5 @@ , " epub3: http://www.idpf.org/epub/30/spec/epub30-publications.html" , "" , ""- , "Version 2.3 Dino Morelli <dino@ui3.info>"+ , "Version 2.4 Dino Morelli <dino@ui3.info>" ]
src/EpubTools/epubmeta.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/epubname.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/EpubTools/epubzip.hs view
@@ -1,4 +1,3 @@--- Copyright: 2011-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
testsuite/EpubTools/Test/EpubName/Format.hs view
@@ -1,4 +1,3 @@--- Copyright: 2012-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -36,6 +35,7 @@ , testNoAuthor , testCreatorsNoAuthor , testCreatorsNoAuthorPubDate+ , testCreatorLastFirst , testCapsTitle , testColon , testBracketTitle@@ -90,6 +90,9 @@ , testLightspeedMagIssue , testLightspeedIssue , testMagWeirdTales+ , testMagGalaxysEdge+ , testMagPlasmaFreq+ , testMagPlasmaFreqMonth , testAnthology ] @@ -278,6 +281,25 @@ ) +testCreatorLastFirst :: (Globals, [Formatter]) -> Test+testCreatorLastFirst (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "creator text (not file-as) is last-name-first" expected+ where+ meta = emptyMetadata+ { metaCreators =+ [ Creator Nothing Nothing+ Nothing "Spindlewest, Graham"+ ]+ , metaTitles = [Title Nothing Nothing Nothing+ "A Midnight's Horror Story"]+ }+ expected =+ ( "ordinary_book"+ , "SpindlewestGraham-AMidnightsHorrorStory.epub"+ )++ testCapsTitle :: (Globals, [Formatter]) -> Test testCapsTitle (gs, fs) = TestCase $ assertNewName gs { gMetadata = meta } fs "title all caps" expected@@ -1218,6 +1240,51 @@ expected = ( "magWeirdTales" , "WeirdTales350.epub"+ )+++testMagGalaxysEdge :: (Globals, [Formatter]) -> Test+testMagGalaxysEdge (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Galaxy's Edge magazine" expected+ where+ meta = emptyMetadata+ { metaTitles = [Title Nothing Nothing Nothing+ "Galaxy's Edge Magazine: Issue 1 March 2013"]+ }+ expected =+ ( "magGenericWithIssue"+ , "GalaxysEdgeMagazine01.epub"+ )+++testMagPlasmaFreq :: (Globals, [Formatter]) -> Test+testMagPlasmaFreq (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Plasma Frequency magazine" expected+ where+ meta = emptyMetadata+ { metaTitles = [Title Nothing Nothing Nothing+ "Plasma Frequency Magazine Issue 1"]+ }+ expected =+ ( "magGenericWithIssue"+ , "PlasmaFrequencyMagazine01.epub"+ )+++testMagPlasmaFreqMonth :: (Globals, [Formatter]) -> Test+testMagPlasmaFreqMonth (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Plasma Frequency magazine, incl month/year in title" expected+ where+ meta = emptyMetadata+ { metaTitles = [Title Nothing Nothing Nothing+ "Plasma Frequency Magazine: Issue 8 October/November 2013"]+ }+ expected =+ ( "magGenericWithIssue"+ , "PlasmaFrequencyMagazine08.epub" )
testsuite/EpubTools/Test/EpubName/PubYear.hs view
@@ -1,4 +1,3 @@--- Copyright: 2012-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
testsuite/EpubTools/test-epubname.hs view
@@ -1,4 +1,3 @@--- Copyright: 2008-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
+ util/all-books.hs view
@@ -0,0 +1,43 @@+#! /usr/bin/env runhaskell++import Data.List ( isPrefixOf )+import System.Cmd+import System.Directory+import System.FilePath+import Text.Printf+import Text.Regex+++--epubnameBin = return "epubname"+epubnameBin = canonicalizePath "dist/build/epubname/epubname"++tempDir = "/home/dino/temp"+allFile = "epubname-all"+++renameRE = mkRegex "(.*) -> (.*)"++namesNotEqual oline = case matchRegex renameRE oline of+ Just [s, d] -> takeFileName s /= takeFileName d+ Nothing -> True+++main :: IO ()+main = do+ eb <- epubnameBin++ setCurrentDirectory "/var/local/archive/doc/books/fiction"++ system $ printf+ "find . -name '*.epub' | xargs -n 30 %s -n -t /tmp 2>&1 > %s/%s"+ eb tempDir allFile++ setCurrentDirectory tempDir++ allLines <- fmap (filter (not . isPrefixOf "No-action") . lines)+ $ readFile allFile++ let notEqual = filter namesNotEqual allLines+ writeFile "epubname-changed" $ unlines notEqual++ mapM_ putStrLn notEqual
+ util/prefs/boring view
@@ -0,0 +1,69 @@+# Boring file regexps:+\.hi$+\.hi-boot$+\.o-boot$+\.o$+\.o\.cmd$+\.p_hi$+\.p_o$+\.installed-pkg-config+\.setup-config+\.setup-config^dist(/|$)+# *.ko files aren't boring by default because they might+# be Korean translations rather than kernel modules.+# \.ko$+\.ko\.cmd$+\.mod\.c$+(^|/)\.tmp_versions($|/)+(^|/)CVS($|/)+\.cvsignore$+^\.#+(^|/)RCS($|/)+,v$+(^|/)\.svn($|/)+(^|/)\.hg($|/)+(^|/)\.git($|/)+\.bzr$+(^|/)SCCS($|/)+~$+(^|/)_darcs($|/)+(^|/)\.darcsrepo($|/)+\.bak$+\.BAK$+\.orig$+\.rej$+(^|/)vssver\.scc$+\.swp$+(^|/)MT($|/)+(^|/)\{arch\}($|/)+(^|/).arch-ids($|/)+(^|/),+\.prof$+(^|/)\.DS_Store$+(^|/)BitKeeper($|/)+(^|/)ChangeSet($|/)+\.py[co]$+\.elc$+\.class$+\.zwc$+\.revdep-rebuild.*+\..serverauth.*+\#+(^|/)Thumbs\.db$+(^|/)autom4te\.cache($|/)+(^|/)config\.(log|status)$+^\.depend$+(^|/)(tags|TAGS)$+#(^|/)\.[^/]+(^|/|\.)core$+\.(obj|a|exe|so|lo|la)$+^\.darcs-temp-mail$+-darcs-backup[[:digit:]]+$+\.(fas|fasl|sparcf|x86f)$+\.part$+(^|/)\.waf-[[:digit:].]+-[[:digit:]]+($|/)+(^|/)\.lock-wscript$+^\.darcs-temp-mail$+\_vti_cnf$+\_vti_pvt$+(^|/)dist($|/)
+ util/win-dist.sh view
@@ -0,0 +1,15 @@+#! /bin/bash++version=$(awk '/^[Vv]ersion/ { print $2 }' epub-tools.cabal)++buildDir="dist/build"++binaries="$buildDir/epubmeta/epubmeta.exe $buildDir/epubname/epubname.exe $buildDir/epubzip/epubzip.exe"++strip $binaries++zipFile="dist/epub-tools-$version-win.zip"++rm $zipFile++zip -j $zipFile doc/INSTALL $binaries