Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ m4bify [--help] [-d | --chapters-from-dirs] [-b <bitrate> | --bitrate <bitrate>]
| `<author_name> - <book_title>` | Agatha Christie - Murder on the Orient Express |
| `<book_title> (<year>)` | To Kill a Mockingbird (1960) |

Both hyphen (`-`), underscore (`_`), and colon (`:`) are supported as separators. Additionally, square brackets (`[]`) can be used as an alternative to parentheses (`()`) for enclosing year information.
Both hyphen (`-`) and underscore (`_`) are supported as separators. Additionally, square brackets (`[]`) can be used as an alternative to parentheses (`()`) for enclosing year information.

## m4bulk

Expand Down
13 changes: 6 additions & 7 deletions m4bify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ function print_usage {
echo -e " - ${COLORS[PATTERN]}<book_title> (<year>)${NC} 'Harry Potter (1997)'"
echo -e " - ${COLORS[PATTERN]}<book_title> [<year>]${NC} 'Harry Potter [1997]'"
echo -e " - ${COLORS[PATTERN]}<author_name> - <book_title>${NC} 'J.K. Rowling - Harry Potter'"
echo -e " In addition to the hyphen (-), the underscore (_) and colon (:) are supported as"
echo -e " separators in these patterns."
echo -e " Both hyphen (-) and underscore (_) are supported as separators in these patterns."
echo -e " If there is an image file in the directory or embedded art within the audio files,"
echo -e " it will be used as the book cover for the M4B audiobook."
echo -e ""
Expand Down Expand Up @@ -316,11 +315,11 @@ function add_metadata {
local m4b_file=$1 source_dir=$2 temp_dir=$3
local dir_name author title date

local regex_1='^(.+) [-:_] (.+) \(([0-9]{4})\)$' # "Author Name - Book Title (1939)"
local regex_2='^(.+) [-:_] (.+) \[([0-9]{4})\]$' # "Author Name _ Book Title [1939]"
local regex_3='^(.+) \(([0-9]{4})\)$' # "Book Title (1939)"
local regex_4='^(.+) \[([0-9]{4})\]$' # "Book Title [1939]"
local regex_5='^(.+) [-:_] (.+)$' # "Author Name : Book Title"
local regex_1='^(.+) [-_] (.+) \(([0-9]{4})\)$' # "Author Name - Book Title (1939)"
local regex_2='^(.+) [-_] (.+) \[([0-9]{4})\]$' # "Author Name _ Book Title [1939]"
local regex_3='^(.+) \(([0-9]{4})\)$' # "Book Title (1939)"
local regex_4='^(.+) \[([0-9]{4})\]$' # "Book Title [1939]"
local regex_5='^(.+) [-_] (.+)$' # "Author Name - Book Title"

echo -e "${COLORS[ACTION]}Extracting audiobook metadata...${NC}"
dir_name=$(basename "${source_dir%/}")
Expand Down
Loading