Home

Awesome

TravisCI Maven Central Javadocs License: MPL 2.0

AnitomyForJava

AnitomyForJava is a Java port of Anitomy, a library for parsing anime video filenames. It's accurate, fast, and simple to use. All credit goes to @erengy. I simply ported it.

Examples

The following filename...

[BM&T] Toradora! - 07v2 - Pool Opening  (2008) [720p Hi10p FLAC] [BD] [8F59F2BA].mkv

...would be resolved into these elements:

Here's an example code snippet...

import com.dgtlrepublic.anitomyj.AnitomyJ;
import com.dgtlrepublic.anitomyj.Element;

public class Main {
  public static void main(String args[]) {
    String file = "[BM&T] Toradora! - 07v2 - Pool Opening  (2008) [720p Hi10p FLAC] [BD] [8F59F2BA].mkv";
    List<Element> elements = AnitomyJ.parse(file);
    System.out.println(elements.stream()
                               .map(e -> e.getCategory().name() + "=" + e.getValue())
                               .collect(Collectors.joining("\n")));
  }
}

...which will output:

kElementFileExtension=mkv
kElementFileName=[BM&T] Toradora! - 07v2 - Pool Opening  (2008) [720p Hi10p FLAC] [BD] [8F59F2BA]
kElementVideoResolution=720p
kElementVideoTerm=Hi10p
kElementAudioTerm=FLAC
kElementSource=BD
kElementFileChecksum=8F59F2BA
kElementAnimeYear=2008
kElementEpisodeNumber=07
kElementReleaseVersion=2
kElementAnimeTitle=Toradora!
kElementReleaseGroup=BM&T
kElementEpisodeTitle=Pool Opening

Installation

Requirements

Java 8+

Maven Release

Add the following to your pom.xml:

<dependency>
    <groupId>com.dgtlrepublic</groupId>
    <artifactId>anitomyJ</artifactId>
</dependency>

Binary Release

Binary releases can be found here. Apache Commons(v3.4+) and Apache Commons Collections(v3.2+) are required. For convenience anitomyJ-<version>-with-dependencies.jar is provided, but installing the dependencies manually is recommended.

Issues & Pull Requests

For the most part, AnitomyJ aims to be an exact Java replica of the original Anitomy. To make porting upstream changes easier most of the logic + file structure remain similar to their c++ counterparts. So, for the time being, I won't be accepting pull requests/issues that change the core parsing logic. I suggest opening an issue with the original Anitomy project and when it's fixed I'll merge it downstream.

That being said if the output of AnitomyJ and Anitomy differ in any way please open an issue.

FAQ

License

AnitomyForJava is licensed under Mozilla Public License 2.0.