Anitomy

May 5, 2025 ยท View on GitHub

Anitomy is a C++ library and a command-line tool for parsing anime video filenames.

Important

The library is currently being rewritten in the develop branch.

Example

[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1080p_H.264_FLAC][BAD7A16A].mkv
ElementValue
Release groupTaigaSubs
TitleToradora!
Year2008
Episode01
Release version2
Episode titleTiger and Dragon
Video resolution1080p
Video termH.264
Audio termFLAC
File checksumBAD7A16A
File extensionmkv

Usage

Library

Header-only, has no dependencies other than the standard library. Requires a compiler that supports C++23 (currently only tested with MSVC). See the docs for details.

#include <print>
#include <anitomy.hpp>

int main() {
  auto elements = anitomy::parse("[Ouroboros] Fullmetal Alchemist Brotherhood - 01");

  for (auto [kind, value, _] : elements) {
    std::println("{:<16}{}", kind, value);
  }

  return 0;
}
release_group   Ouroboros
title           Fullmetal Alchemist Brotherhood
episode         01

CLI

Use --help or visit the docs for available options.

anitomy --format=json --pretty "[Ouroboros] Fullmetal Alchemist Brotherhood - 01"
{
  "release_group": "Ouroboros",
  "title": "Fullmetal Alchemist Brotherhood",
  "episode": "01"
}

FAQ

How does it work?

Anitomy makes some educated guesses on how filenames are formed. In more technical terms, the input is split into a sequence of tokens, and the tokens are inspected for various keywords and patterns to extract the elements.

What should I do if a filename is not being parsed correctly?

Please report the issue, though it may not be possible to resolve a terribly ambiguous naming scheme.

Can I use it for other media such as movies or TV series?

It should work to some extent, but the library is mostly optimized for anime.

Can I use it on Unicode filenames?

Yes, just make sure your input is UTF-8 encoded and preferably in composed form.

Can I use it in another programming language?

Try the CLI, or see other repositories for related projects.

Migration

v2.0 (WIP)

  • Building the library now requires a compiler with C++23 support.
  • The library is now located inside the include directory and used with #include <anitomy.hpp>.
  • Library internals (anything not mentioned below) are moved to anitomy::detail namespace.
  • The library now uses UTF-8 encoded std::string. You no longer need to convert from/to std::wstring.
  • Removed anitomy::Anitomy class. You can use the free anitomy::parse function instead.
  • Removed allowed_delimiters and ignored_strings options.
  • Removed anitomy::Elements class. Parser now returns std::vector<Element> instead.
  • ElementCategory enum is replaced with ElementKind enum class.
  • Parsed elements are now ordered according to their position in the input.

License

Anitomy is licensed under Mozilla Public License 2.0.