PHPackages                             odango/atama - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. odango/atama

ActiveLibrary

odango/atama
============

The brain behind Odango.moe

v3.1.1(2y ago)5841MITPHPCI passing

Since Nov 14Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/odangomoe/Atama)[ Packagist](https://packagist.org/packages/odango/atama)[ RSS](/packages/odango-atama/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (3)Versions (17)Used By (0)

頭 (Atama)
=========

[](#頭-atama)

[![Build Status](https://camo.githubusercontent.com/ed50d70a91bc2efe2fec0ebcd51b72b55316d31546207d8018001e09db90585a/68747470733a2f2f7472617669732d63692e6f72672f6f64616e676f6d6f652f4174616d612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/odangomoe/Atama) [![Coverage Status](https://camo.githubusercontent.com/d19f184df021440a43b87d74948b309d6a1b80ce3a4206c4509fe93b454b9abf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f64616e676f6d6f652f4174616d612f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/odangomoe/Atama?branch=master)

Anime torrent title parsing and archiving

This package's only use is to parse anime torrent titles and archive them into TorrentSets

### Install

[](#install)

```
composer require odango/atama

```

Metadata
--------

[](#metadata)

The actual parsing of titles done with black magic, battle tested on the whole nyaa site. of course there may be some cases where it fails to parse correctly, please create an issue for those.

```
$md = Metadata::createFromTitle("[HorribleSubs] Show By Rock!! S2 - 07 [720p].mkv");

echo $md["name"]; // Show By Rock!! S2
echo $md["group"]; // HorribleSubs
echo $md["type"]; // ep
echo $md["ep"]; // [7.0]
echo $md["resolution"]; // 720p
```

See [metadate-title.json](test/data/metadata-title.json) for more info.

EP's are represented by an array with floats and/or letters (thank Re:Zero for that):

```
$md = Metadata::createFromTitle("[HorribleSubs] Re Zero kara Hajimeru Isekai Seikatsu - 01A [1080p].mkv");
$md["ep"]; // [1.0, "A"]
$md = Metadata::createFromTitle("[m.3.3.w] Hanasakeru Seishounen 12.5 (XviD) [89BACFB9].avi");
$md["ep"]; // [12.5]
```

The `Metadata` object is an `ArrayObject` and doesn't define any functions except it's constructors

### `Metadata::createFromTitle($title): Metadata`

[](#metadatacreatefromtitletitle-metadata)

Create an `Metadata` object from a title by parsing all the info from the title

### `Metadata::createFromArray($array): Metadata`

[](#metadatacreatefromarrayarray-metadata)

Create an `Metadata` object with the given array as properties

Archiver
--------

[](#archiver)

Archives the torrents into the correct `TorrentSet`'s can be done stateless (by using `Archiver::archive`) or with state, by creating the `Archiver` object

### `Archiver::archive(Torrent[] $torrents): TorrentSet[]`

[](#archiverarchivetorrent-torrents-torrentset)

This function will archive given torrents in separate `TorrentSet`'s and return those, as you would expect it.

All HorribleSubs, Show By Rock!! S2, 720p will be in it's own set, while the 1080p torrents of those will be in a different set.

### `Archiver->addTorrent(Torrent $torrent): bool`

[](#archiver-addtorrenttorrent-torrent-bool)

This will archive this torrent in the `TorrentSet`'s currently in the archive.

This will return `true` if it's added to a TorrentSet, `false` if a newer version or the same version already exists

### `Archiver->getSets(): TorrentSet[]`

[](#archiver-getsets-torrentset)

Get the `TorrentSet`'s currently in the archive

TorrentSet
----------

[](#torrentset)

### `TorrentSet->addTorrent(Torrent $torrent): bool`

[](#torrentset-addtorrenttorrent-torrent-bool)

This will try to add this torrent to this `TorrentSet`

This will return `true` if it's added to this `TorrentSet`, `false` if a newer version or the same version already exists

### `TorrentSet->getTorrents(): Torrent[]`

[](#torrentset-gettorrents-torrent)

Returns all the torrents in the `TorrentSet`

### `TorrentSet->getMetadata(): Metadata`

[](#torrentset-getmetadata-metadata)

Gets a `Metadata` object with the `Metadata` all torrents in the set have in common

Torrent
-------

[](#torrent)

The `Torrent` object is pretty much made only to be extended and add more info about it, the current implementation just provides enough information to be used

### `Torrent->setTitle(string $title): void`

[](#torrent-settitlestring-title-void)

Set the title of this torrent and update metadata accordingly

### `Torrent->getTitle(): string`

[](#torrent-gettitle-string)

Gets the title of this torrent

### `Torrent->getId(): string|int`

[](#torrent-getid-stringint)

Gets the id of this torrent, used as unique identifier in the hash for series

### `Torrent->getMetadata(): Metadata`

[](#torrent-getmetadata-metadata)

Gets the metadata of this torrent parsed from the title

### `Torrent->getSeriesIdentifier(): string`

[](#torrent-getseriesidentifier-string)

Gets a unique string for in this series, e.g. for an series of EP's this would be the ep number. The id or a random number is used for specials

### `Torrent->getHash(): string`

[](#torrent-gethash-string)

Gets a unique string for this torrent e.g. `[HorribleSubs] Show By Rock!! S2 - 07 [720p].mkv` would produce the hash `Show By Rock!! S2/HorribleSubs/720p#7` be aware that different versions of torrents still produce the same hash e.g. `[HorribleSubs] Show By Rock!! S2 - 07v2 [720p].mkv` will also produce the hash `Show By Rock!! S2/HorribleSubs/720p#7`

### `Torrent->getSeriesHash(): string`

[](#torrent-getserieshash-string)

Gets a unique string this torrent series e.g. `[HorribleSubs] Show By Rock!! S2 - 07 [720p].mkv` would produce the hash `Show By Rock!! S2/HorribleSubs/720p`

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance54

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 96.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~163 days

Recently: every ~259 days

Total

16

Last Release

1023d ago

Major Versions

v1.2.1 → v2.0.02020-05-28

v2.1.1 → v3.0.02023-07-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/877f8b03f356ee05623fbcce6506c34a3772eaf88561adfdd508744e87d0de02?d=identicon)[eater](/maintainers/eater)

---

Top Contributors

[![the-eater](https://avatars.githubusercontent.com/u/1922630?v=4)](https://github.com/the-eater "the-eater (29 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

animeanime-title

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/odango-atama/health.svg)

```
[![Health](https://phpackages.com/badges/odango-atama/health.svg)](https://phpackages.com/packages/odango-atama)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
