GithubHelp home page GithubHelp logo

soruly / aniep Goto Github PK

View Code? Open in Web Editor NEW
32.0 5.0 3.0 67.42 MB

Extract episode number from anime file name

Home Page: https://repl.it/@soruly/aniep

License: MIT License

JavaScript 100.00%
anime episode

aniep's Introduction

aniep

License GitHub Workflow Status pipeline status coverage report npm

Extract episode number from anime file name (In progress, see % accuracy above)

Install

npm install aniep --save

Usage

JavaScript

const aniep = require("aniep");

// leading zero is removed, returning a Number type
aniep("[Leopard-Raws] Yakusoku no Neverland - 04 RAW (THK 1280x720 x264 AAC).mp4"); // return 4

// floating point is supported
aniep("[Leopard-Raws] Youjo Senki - 06.5 RAW (ATX 1280x720 x264 AAC).mp4"); // return 6.5

// when it cannot find any episode number, it returns null
aniep("[Leopard-Raws] Sora to Umi no Aida Special (SUN 1280x720 x264 AAC).mp4"); // return null

// similarily, OVA also returns null
aniep(
  "[Ohys-Raws] Boku no Kanojo ga Majime Sugiru Shobitch na Ken (2018) - OVA (BD 1280x720 x264 AAC).mp4"
); // return null

// however, OVA with episode number would still return a Number
aniep("[Ohys-Raws] Amanchu! - 13 OVA (AT-X 1280x720 x264 AAC).mp4"); // return 13

// episode preview return episode Number
aniep("[Ohys-Raws] Tate no Yuusha no Nariagari - 01 Preview (AT-X 1280x720 x264 AAC).mp4"); // return 1

// for joined episode, it returns an array of Number: the first and the last episode
aniep("[Ohys-Raws] Idolish Seven - 01-02 (MX 1280x720 x264 AAC).mp4"); // return [1, 2]

// in case there are multiple possible episode number, it returns a string of episodes, using | as separator
aniep("[Ohys-Raws] High School DxD Hero - 11(10) (AT-X 1280x720 x264 AAC).mp4"); // return "10|11"

TypeScript

import aniep from "aniep";

// leading zero is removed, returning a Number type
aniep("[Leopard-Raws] Yakusoku no Neverland - 04 RAW (THK 1280x720 x264 AAC).mp4"); // return 4

// ...

special cases to be confirmed

2	B Gata H Kei - Vol.06 CM_02 (BD 1280x720 AVC AAC).mp4
null	B Gata H Kei - Vol.02 Menu (BD 1280x720 AVC AAC).mp4
1	[CASO][Tentai_Senshi_Sunred][BIG5][Vol05-SP1][DVDRIP][x264_AAC].mp4
2	[CASO][Tentai_Senshi_Sunred][BIG5][Vol05-SP2][DVDRIP][x264_AAC].mp4
9.5|21.5	[Dymy][Berserk 2][09.5(21.5)][BIG5][1280X720].mp4
12	[FLsnow][AIR][Ep12_Creditless_ED][DVDrip][x264_AAC].mp4
1|25	[HKACG][Lupin Sansei 2015][25_OVA1][BIG5_JP][x264_AAC][720p].mp4
06,07|226,227	[SOSG&52wy][Naruto_Shippuuden][226-227(06-07)][BIG5][x264_AAC].mp4
3|3.75	[諸神字幕組][進擊的巨人][Shingeki no Kyojin][OAD3][#3.75][720P][中日雙語字幕][MP4].mp4
4|0.5	[諸神字幕組][進擊的巨人][Shingeki no Kyojin][OAD4][#0.5A][720P][中日雙語字幕][MP4].mp4
5|0.5	[諸神字幕組][進擊的巨人][Shingeki no Kyojin][OAD5][#0.5B][576P][中日雙語字幕][MP4].mp4

Development

To test the program's accuracy:

npm test

Dataset is defined in test/answer.txt, with over 100,000 file names found from Chinese anime websites. The text file is a tab-separated list of testcases. First column is expected answer, second column is input file name.

You can test your implementation (defined in src/index.js) against the dataset to see how well your episode number extraction function performs.

aniep's People

Contributors

darthif avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar leslie-wong-h avatar respectable-citizen avatar shincurry avatar soruly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aniep's Issues

Don't match 10bit as episode 10

From answer.txt:

10	(110729) 夢喰い-つるみく式ゲーム製作- 樟葉瑠美 調教編 (DVD 1280x720 x264 10bit AAC).mp4

There are at least a few entries like this. I'd expect the best solution would be to just remove "10bit", as with "x264" and "x265" here:

filename = filename.replace(/x26(4|5)/i, ""); // remove x264 and x265

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.