node.anitomy.js:node.anitomy.js是Anitomy的Node.js绑定,C ++库用于解析动漫视频文

  • N9_435742
    了解作者
  • 44.7KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-06 11:41
    上传日期
node.anitomy.js node.anitomy.js是Anitomy的Node.js绑定, 是用于解析动漫视频文件名的C ++库。 正在安装 您可以使用NPM这样将node.anitomy.js安装为项目的依赖项,前提是您已满足下面列出的依赖项。 > npm install --save anitomyjs 依存关系 Node.JS> = 4.0.0 也可与使用和通过设置所需的运行时在应用程序中package.json作为解释。 CMake的> = 3.2 与C ++ 14兼容的编译器 GCC> = 5 Clang> = 3.4(根据) 或 用法示例 const an
node_anitomy_js-master.zip
  • node.anitomy.js-master
  • src
  • elements_object.h
    1.8KB
  • parse_worker.cpp
    1.3KB
  • element_categories.h
    3.3KB
  • anitomy_lib.cpp
    4.6KB
  • parse_worker.h
    1.3KB
  • elements_object.cpp
    4KB
  • utils.h
    3.7KB
  • utils.cpp
    4.3KB
  • lib
  • anitomy
  • test
  • test.js
    7.4KB
  • .gitmodules
    86B
  • .clang-format
    114B
  • CMakeLists.txt
    2.3KB
  • .travis.yml
    1.5KB
  • LICENSE
    16.3KB
  • README.md
    12.1KB
  • appveyor.yml
    449B
  • .gitignore
    121B
  • anitomy.js
    305B
  • package-lock.json
    77.5KB
  • package.json
    1KB
内容介绍
# node.anitomy.js [![License](https://img.shields.io/badge/license-MPL--2.0-blue.svg?style=flat-square&maxAge=2592000)](https://github.com/Xtansia/node.anitomy.js/raw/master/LICENSE) [![Linux & OSX Build Status](https://img.shields.io/travis/Xtansia/node.anitomy.js/master.svg?label=linux+%26+osx&style=flat-square&maxAge=2592000)](https://travis-ci.org/Xtansia/node.anitomy.js) [![Windows Build Status](https://img.shields.io/appveyor/ci/Xtansia/node-anitomy-js/master.svg?label=windows&style=flat-square&maxAge=2592000)](https://ci.appveyor.com/project/Xtansia/node-anitomy-js) [![NPM](https://nodei.co/npm/anitomyjs.png)](https://nodei.co/npm/anitomyjs/) *node.anitomy.js* is a Node.js binding for [Anitomy](https://github.com/erengy/anitomy) a C++ library for parsing anime video filenames. ## Installing You can install *node.anitomy.js* as a dependency of your project using NPM like so, provided you have met the dependencies listed below. ``` > npm install --save anitomyjs ``` ### Dependencies * Node.JS >= 4.0.0 - Can also be used with [NW.js](https://github.com/nwjs/nw.js) and [Electron](https://github.com/atom/electron) by setting the desired runtime in your applications `package.json` as explained [here](https://github.com/cmake-js/cmake-js#runtimes). * CMake >= 3.2 * A C++14 compatible compiler - GCC >= 5 - Clang >= 3.4 (According to the [Clang CXX status page](https://clang.llvm.org/cxx_status.html)) - [Visual Studio 2017](https://www.visualstudio.com/downloads/) OR [Build Tools for Visual Studio 2017](https://aka.ms/BuildTools) ## Example Usage ```javascript const anitomy = require('anitomyjs'); const filename = '[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv'; const elems = anitomy.parseSync(filename); console.log(elems.AnimeTitle + ' #' + elems.EpisodeNumber + ' by ' + elems.ReleaseGroup); ``` Would output: ``` Toradora! #01 by TaigaSubs ``` ## API ### parse(filenames[, options], callback) Parses the filenames asynchronously. * `filenames` must be either a string, or an array of strings. * `options` is optional, if provided it must be an object, as set out [here](#parse-options). * `callback` must be a function, will be called passing the resulting elements as the first parameter. - If `filenames` was an array, then the passed value will be an array of [AnitomyElements](#anitomyelements), with the same ordering as `filenames`. - If `filenames` was a string, then the passed value will be an [AnitomyElements](#anitomyelements). ```javascript const filename = '[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv'; anitomy.parse(filename, function (elems) { console.log(elems.AnimeTitle + ' #' + elems.EpisodeNumber + ' by ' + elems.ReleaseGroup); }); ``` Would output: ``` Toradora! #01 by TaigaSubs ``` ### parseSync(filenames[, options]) Parses the filenames synchronously. * `filenames` must be either a string, or an array of strings. * `options` is optional, if provided it must be an object, as set out [here](#parse-options). * Returns: - If `filenames` was an array, then the returned value will be an array of [AnitomyElements](#anitomyelements), with the same ordering as `filenames`. - If `filenames` was a string, then the returned value will be an [AnitomyElements](#anitomyelements). ```javascript const filename = '[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv'; const elems = anitomy.parseSync(filename); console.log(elems.AnimeTitle + ' #' + elems.EpisodeNumber + ' by ' + elems.ReleaseGroup); ``` Would output: ``` Toradora! #01 by TaigaSubs ``` ### parseEach(filenames[, options], callback) Parses each of the individual filenames asynchronously, as opposed to [parse](#parsefilenames-options-callback) which parses them all in bulk. As it is asynchronous there is no ordering ensured. * `filenames` must be either a string, or an array of strings. * `options` is optional, if provided it must be an object, as set out [here](#parse-options). * `callback` must be a function, will be called when each filename is parsed, passing the filename and the resulting [AnitomyElements](#anitomyelements) as the first and second parameters respectively. ```javascript const filenames = [ '[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv', '[ANBU]_Princess_Lover!_-_01_[2048A39A].mkv', '[ANBU-Menclave]_Canaan_-_01_[1024x576_H.264_AAC][12F00E89].mkv', '[ANBU-umai]_Haiyoru!_Nyaru-Ani_[596DD8E6].mkv' ]; anitomy.parseEach(filenames, function (filename, elems) { console.log(filename + '\n\t=> ' + elems.AnimeTitle + ' #' + elems.EpisodeNumber + ' by ' + elems.ReleaseGroup); }); ``` Would output (though not necessarily in this order): ``` [ANBU]_Princess_Lover!_-_01_[2048A39A].mkv => Princess Lover! #01 by ANBU [ANBU-Menclave]_Canaan_-_01_[1024x576_H.264_AAC][12F00E89].mkv => Canaan #01 by ANBU-Menclave [ANBU-umai]_Haiyoru!_Nyaru-Ani_[596DD8E6].mkv => Haiyoru! Nyaru-Ani #undefined by ANBU-umai [TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv => Toradora! #01 by TaigaSubs ``` ### parseEachSync(filenames[, options], callback) Same as [parseEach](#parseeachfilenames-options-callback) but synchronous, i.e. calls callback for each parsed filename, then returns. `callback` is ensured to be called in the same order as `filenames`. * `filenames` must be either a string, or an array of strings. * `options` is optional, if provided it must be an object, as set out [here](#parse-options). * `callback` must be a function, will be called when each filename is parsed, passing the filename and the resulting [AnitomyElements](#anitomyelements) as the first and second parameters respectively. ```javascript const filenames = [ '[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv', '[ANBU]_Princess_Lover!_-_01_[2048A39A].mkv', '[ANBU-Menclave]_Canaan_-_01_[1024x576_H.264_AAC][12F00E89].mkv', '[ANBU-umai]_Haiyoru!_Nyaru-Ani_[596DD8E6].mkv' ]; anitomy.parseEachSync(filenames, function (filename, elems) { console.log(filename + '\n\t=> ' + elems.AnimeTitle + ' #' + elems.EpisodeNumber + ' by ' + elems.ReleaseGroup); }); console.log('parseEachSync completed'); ``` Would output: ``` [TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv => Toradora! #01 by TaigaSubs [ANBU]_Princess_Lover!_-_01_[2048A39A].mkv => Princess Lover! #01 by ANBU [ANBU-Menclave]_Canaan_-_01_[1024x576_H.264_AAC][12F00E89].mkv => Canaan #01 by ANBU-Menclave [ANBU-umai]_Haiyoru!_Nyaru-Ani_[596DD8E6].mkv => Haiyoru! Nyaru-Ani #undefined by ANBU-umai parseEachSync completed ``` ### Parse Options Options are given in the form of an object, with any or all of the following properties set, if unset they default to these values (Anitomy's defaults): ```javascript { allowedDelimiters: ' _.&+,|', ignoredStrings: [], parseEpisodeNumber: true, parseEpisodeTitle: true, parseFileExtension: true, parseReleaseGroup: true } ``` ### AnitomyElements This object represents the parsed elements of the filename. With a property for each [ElementCategory](#element-categories) that it has a value for, the properties are immutable. In cases where there are multiple elements in a category the property's value will be an array. ```javascript AnitomyElements { AnimeTitle: 'Toradora!', AnimeYear: '2008', AudioTerm: 'FLAC', EpisodeNumber: '01', EpisodeTitle: 'Tiger and Dragon', FileChecksum: '1234ABCD', FileExtension: 'mkv', FileName: '[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD]', ReleaseGroup: 'TaigaSubs', ReleaseVersion: '2', VideoResolution: '1280x720', VideoTerm: 'H.264' } ``` #### AnitomyElements#emp
评论
    相关推荐