track number was eg "Chapter 03", and is now eg 3 . This fits better in most mp3 players.
track title was the book title for all tracks, now it is eg "Book Title - 01 Chapter 1" (same as filename)
- Use shorthand flags for `rm`: `-r` instead of `--recursive`, `-f` instead of `--force`
- Add fallbacks for `mktemp`. See http://unix.stackexchange.com/a/84980
- Use shorthand flags for `cut`: `-d` instead of `--delimiter`, `-f` instead of `--fields`
Tested on OSX 10.11.6 El Capitan
* Use lower case variable names
* Extract debug print method
* Split lines
* Simplify looping over parameters
* Use a temporary working directory for safety
* Extract metadata fetching into functions
* Don't replace colon in title
It's in the directory structure anyway.
* Use long ffmpeg options where possible
And use the same options everywhere.
* Don't print debug information during normal script run
* Always read into a dummy variable rather than REPLY
* Use `ffprobe` instead of `ffmpeg` to avoid non-zero exit code
* Handle special characters like single quotes in metadata values
* Stop the program if any errors occur
* Use FD 9 for `while` loop input
* Pass AAX file path to metadata extract command
* Avoid skipping every second file
* Don't check for `ffmpeg`
The script will exit if it's not available.
* Declare function variables local
* Fix whitespace handling
Works with filenames containing single quotes.
* Use variables for reused paths
* Put files in output directory immediately
* Clarify debug output
* Extract codec and extension for simple change
* Encode audiobooks as FLAC
* Put output files with input files
* Remove metadata file between files
* Default codec to MP3; enable FLAC using `--flac`
This patch fixes#11 and prevents the following error, which happens when a title contains a single quote (e.g. this `tmp.txt` file: https://gist.github.com/pbowyer/7b7d2181da42c4de1d4f947247a47178):
```
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
```