DoenaSoft.AdaptBookFileNames 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package DoenaSoft.AdaptBookFileNames --version 1.0.2
                    
NuGet\Install-Package DoenaSoft.AdaptBookFileNames -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DoenaSoft.AdaptBookFileNames" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DoenaSoft.AdaptBookFileNames" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="DoenaSoft.AdaptBookFileNames" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DoenaSoft.AdaptBookFileNames --version 1.0.2
                    
#r "nuget: DoenaSoft.AdaptBookFileNames, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DoenaSoft.AdaptBookFileNames@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DoenaSoft.AdaptBookFileNames&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=DoenaSoft.AdaptBookFileNames&version=1.0.2
                    
Install as a Cake Tool

DoenaSoft.AdaptBookFileNames

A .NET library for organizing and standardizing audiobook and e-book file names with consistent naming conventions.

Overview

DoenaSoft.AdaptBookFileNames is a reusable library that provides processors for batch renaming audiobook files (MP3, M4A, MP4) and e-book files (EPUB, MOBI). It handles sequential numbering, chapter information extraction, and associated file renaming (covers, PDFs, XMLs).

Features

  • Audiobook Processing: Renames MP3, M4A, and MP4 files with sequential numbering and chapter support
  • E-Book Processing: Renames EPUB and MOBI files to match book names
  • Chapter Management: Intelligently extracts and appends chapter information from file names
  • Sequential Numbering: Automatically numbers files with appropriate zero-padding
  • Cover Image Standardization: Renames cover images (JPG/JPEG) to cover.jpg
  • Associated Files: Renames related PDF, EPUB, MOBI, and XML files alongside audiobooks
  • Abstraction Layer: Built on DoenaSoft.AbstractionLayer.IO for testability and flexibility
  • Interactive Interface: Supports custom user interaction implementations

Installation

Install via NuGet Package Manager:

Install-Package DoenaSoft.AdaptBookFileNames

Or via .NET CLI:

dotnet add package DoenaSoft.AdaptBookFileNames

Requirements

  • .NET 10.0 or higher

Usage

Basic Audiobook Processing

using DoenaSoft.AdaptBookFileNames;
using DoenaSoft.AbstractionLayer.IOServices;

var ioServices = new IOServices();
var interaction = new YourInteractionImplementation();
var renameQueue = new RenameQueue(ioServices);

renameQueue.Initialize();

var processor = new AudioBookProcessor(
    renameQueue, 
    ioServices.Path, 
    interaction
);

var folder = ioServices.GetFolder(@"C:\Audiobooks\BookFolder");
processor.Process(folder);

var renamedCount = renameQueue.Commit();
Console.WriteLine($"{renamedCount} files renamed.");

Basic E-Book Processing

using DoenaSoft.AdaptBookFileNames;
using DoenaSoft.AbstractionLayer.IOServices;

var ioServices = new IOServices();
var interaction = new YourInteractionImplementation();
var renameQueue = new RenameQueue(ioServices);

renameQueue.Initialize();

var processor = new EBookProcessor(
    renameQueue, 
    ioServices.Path, 
    interaction
);

var folder = ioServices.GetFolder(@"C:\EBooks\BookFolder");
processor.Process(folder);

var renamedCount = renameQueue.Commit();

Implementing IInteraction

You need to provide an implementation of IInteraction for user input/output:

public class ConsoleInteraction : IInteraction
{
    public string ReadLine() => Console.ReadLine();
    
    public void WriteLine(string message = null) => Console.WriteLine(message);
}

API Reference

IBookProcessor

Interface for book file processors.

  • Process(IFolderInfo folder): Processes all book files in the specified folder.

AudioBookProcessor

Processes audiobook files with sequential numbering and chapter support.

Constructor Parameters:

  • IRenameQueue renameQueue: Queue for file rename operations
  • IPath path: Path service for file operations
  • IInteraction interaction: User interaction service

Behavior:

  • Finds all MP3, M4A, and MP4 files in the folder
  • Prompts user for book name (defaults to folder name)
  • Numbers multiple files sequentially (e.g., 01 Book Name.mp3, 02 Book Name.mp3)
  • Extracts chapter information from file names containing dashes
  • Renames associated cover images, e-books, and XML files

EBookProcessor

Processes e-book files (EPUB, MOBI).

Constructor Parameters:

  • IRenameQueue renameQueue: Queue for file rename operations
  • IPath path: Path service for file operations
  • IInteraction interaction: User interaction service

Behavior:

  • Finds all EPUB and MOBI files in the folder
  • Prompts user for book name (defaults to folder name)
  • Renames files to match the book name while preserving extensions
  • Alerts if unexpected number of files found (expects 0 or 2)
  • Renames associated cover images

IInteraction

Interface for user input/output operations.

  • string ReadLine(): Reads a line of text from the input stream
  • void WriteLine(string message): Writes a message to the output stream

Example Scenarios

Audiobook with Chapters

Input files:

01 - Introduction.mp3
02 - Chapter One - The Beginning.mp3
03 - Chapter Two - The Journey.mp3

After processing with book name "My Audiobook":

01 My Audiobook - Introduction.mp3
02 My Audiobook - Chapter One - The Beginning.mp3
03 My Audiobook - Chapter Two - The Journey.mp3

E-Book Files

Input files:

some_ebook_file.epub
some_ebook_file.mobi
cover_image.jpg

After processing with book name "The Great Novel":

The Great Novel.epub
The Great Novel.mobi
cover.jpg

Dependencies

  • DoenaSoft.AbstractionLayer.IO (>= 5.0.1): Provides file system abstraction layer

Contributing

Contributions are welcome! Please submit pull requests to the GitHub repository.

License

This project is licensed under the MIT License.

Author

DJ Doena - https://github.com/DJDoena

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.8 103 4/17/2026
1.0.7 96 4/12/2026
1.0.6 92 4/12/2026
1.0.5 95 4/11/2026
1.0.4 94 4/11/2026
1.0.3 93 4/11/2026
1.0.2 100 4/11/2026
1.0.1 92 4/11/2026

Initial release with audiobook and e-book file renaming capabilities.