Skip to main content

Mirror a directory tree of media files, converting the files to a new format if newer or missing

Project description

Media Archon

PyPI - Version PyPI - Python Version


Table of Contents

Installation

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.

Theory

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:

  1. Look for and read the /directory/of/media/files/media-archon.toml.
  2. Attempt to discover how many threads can execute in parallel on the host (THREADS).
  3. Create two threadpools, one light with 10*THREADS threads for exploring directories and copying, and one heavy of 1*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:

  1. 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.
  2. Loop through the objects again and depending on whether it is a directory or a file with a particular extension (e.g. .mp3):
    1. If a directory, schedule a new walker light thread to search the subdirectory in parallel.
    2. If a file on the ignore list (.*) ignore.
    3. 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:
      1. The media-archon.toml mtime is newer than the target mtime
      2. Any media-archon-override.toml mtime in the current or parent directory is newer than the target
      3. The source file mtime is newer than the target mtime
    4. 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.
      1. The media-archon.toml mtime is newer than the target mtime
      2. Any media-archon-override.toml mtime in the current or parent directory is newer than the target
      3. The source file mtime is newer than the target mtime
  3. Schedule light threads to delete files and directories in the target that are not in the source.

License

media-archon is distributed under the terms of the AGPL-3.0-or-later license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

media-archon-0.1.4.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

media_archon-0.1.4-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file media-archon-0.1.4.tar.gz.

File metadata

  • Download URL: media-archon-0.1.4.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.13.2 CPython/3.11.2 Linux/6.6.13+bpo-amd64

File hashes

Hashes for media-archon-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8bddd30786c6151be610163fc8a807089fa3f359c1d8818a40e7ab01bd848f9a
MD5 060a23b1059672258de2397d985e8a6d
BLAKE2b-256 197056a3ef59e5e0f973b187e2d6ddab2b48021e7b49b4752960611b003b8bb3

See more details on using hashes here.

File details

Details for the file media_archon-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: media_archon-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.13.2 CPython/3.11.2 Linux/6.6.13+bpo-amd64

File hashes

Hashes for media_archon-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6646e1e298467ad72c9b0573ceedd8238383987c19760b971d115bbe01ce1538
MD5 d6863521cc54914b7aba051f64e46110
BLAKE2b-256 4488cdb11dd8667f43e0c1d58f5dde7fc802af3358560404d09206c5ed2d1a87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page