2017 © Pedro Peláez
 

library atama

The brain behind Odango.moe

image

odango/atama

The brain behind Odango.moe

  • Sunday, January 28, 2018
  • by eater
  • Repository
  • 3 Watchers
  • 4 Stars
  • 48 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

頭 (Atama)

Build Status Coverage Status, (*1)

Anime torrent title parsing and archiving, (*2)

This package's only use is to parse anime torrent titles and archive them into TorrentSets, (*3)

Install

composer require odango/atama

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., (*4)

$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 for more info., (*5)

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

$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, (*7)

Metadata::createFromTitle($title): Metadata

Create an Metadata object from a title by parsing all the info from the title, (*8)

Metadata::createFromArray($array): Metadata

Create an Metadata object with the given array as properties, (*9)

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, (*10)

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

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

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., (*12)

Archiver->addTorrent(Torrent $torrent): bool

This will archive this torrent in the TorrentSet's currently in the archive., (*13)

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

Archiver->getSets(): TorrentSet[]

Get the TorrentSet's currently in the archive, (*15)

TorrentSet

TorrentSet->addTorrent(Torrent $torrent): bool

This will try to add this torrent to this TorrentSet, (*16)

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

TorrentSet->getTorrents(): Torrent[]

Returns all the torrents in the TorrentSet, (*18)

TorrentSet->getMetadata(): Metadata

Gets a Metadata object with the Metadata all torrents in the set have in common, (*19)

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, (*20)

Torrent->setTitle(string $title): void

Set the title of this torrent and update metadata accordingly, (*21)

Torrent->getTitle(): string

Gets the title of this torrent, (*22)

Torrent->getId(): string|int

Gets the id of this torrent, used as unique identifier in the hash for series, (*23)

Torrent->getMetadata(): Metadata

Gets the metadata of this torrent parsed from the title, (*24)

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, (*25)

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, (*26)

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, (*27)

The Versions

28/01 2018

dev-master

9999999-dev

The brain behind Odango.moe

  Sources   Download

MIT

The Development Requires

by Avatar eater

28/01 2018

v1.2.1

1.2.1.0

The brain behind Odango.moe

  Sources   Download

MIT

The Development Requires

by Avatar eater

27/01 2018

v1.2.0

1.2.0.0

The brain behind Odango.moe

  Sources   Download

MIT

The Development Requires

by Avatar eater

17/01 2017

v1.1.1

1.1.1.0

The brain behind Odango.moe

  Sources   Download

MIT

The Development Requires

by Avatar eater

12/01 2017

v1.1.0

1.1.0.0

The brain behind Odango.moe

  Sources   Download

MIT

The Development Requires

by Avatar eater

14/11 2016

v1.0.0

1.0.0.0

The brain behind Odango.moe

  Sources   Download

MIT

The Development Requires

by Avatar eater