Table of Contents
pip install media-archon
Copy the config file media-archon.toml
from the repository into the top level of the directory tree of media you wish to convert and edit to meet your needs.
Media archon is an aggressively multithreaded Linux/Unix/MacOSX tool designed to mirror a tree of source media files to a destination tree, converting matching media using any command line tool selected by the user. It has been designed and tested around using the excellent fre:ac opensource audio software to convert existing MP3 audiobooks etc. into Opus files for unbeatable size vs. quality.
When executed with media-archon /directory/of/media/files/
, it will:
- Look for and read the
/directory/of/media/files/media-archon.toml
. - Attempt to discover how many threads can execute in parallel on the host (
THREADS
). - Create two threadpools, one
light
with10*THREADS
threads for exploring directories and copying, and oneheavy
of1*THREADS
threads for conversions or other CPU heavy tasks. (The numbers of threads can be overridden in the configuration file.)
After configuring itself a light
walker thread will be scheduled on the light
threadpool to walk /directory/of/media/files/
. The thread will:
- Iterate through the objects in the directory looking for a configuration override file (default
media-archon-override.toml
). If found it will update its converter parameters for this directory and all its subdirectories. - Loop through the objects again and depending on whether it is a directory or a file with a particular extension (e.g.
.mp3
):- If a directory, schedule a new walker
light
thread to search the subdirectory in parallel. - If a file on the ignore list (
.*
) ignore. - If a file with an extension in the copy list, and one or more of the following conditions are met schedule a
light
thread to copy it to the target:- The
media-archon.toml
mtime is newer than the target mtime - Any
media-archon-override.toml
mtime in the current or parent directory is newer than the target - The source file mtime is newer than the target mtime
- The
- If a file with an extension in the convert list, and one or more of the following conditions are met schedule a
heavy
thread to convert it from the source to the target using the supplied command line in the config.- The
media-archon.toml
mtime is newer than the target mtime - Any
media-archon-override.toml
mtime in the current or parent directory is newer than the target - The source file mtime is newer than the target mtime
- The
- If a directory, schedule a new walker
- Schedule
light
threads to delete files and directories in the target that are not in the source.
media-archon
is distributed under the terms of the AGPL-3.0-or-later license.