nihilarr/parse-torrent-name
Composer 安装命令:
composer require nihilarr/parse-torrent-name
包简介
Extract media information from torrent-like filename
README 文档
README
Extract media information from torrent-like filename
A PHP port of Divij Bindlish's Python port of Jānis' awesome library written in JavaScript.
Extract all possible media information present in filenames. Multiple regex rules are applied on filename string each of which extracts corresponding information from the filename. If a regex rule matches, the corresponding part is removed from the filename. In the end, the remaining part is taken as the title of the content.
Why?
Online APIs by providers like TMDb, TVDb and OMDb don't react to well to search queries which include any kind of extra information. To get proper results from these APIs, only the title of the content should be provided as the search query where this library comes into play. The accuracy of the results can be improved by passing in the year which can also be extracted using this library.
Requirements
- PHP >= 5.3.29
Install
Composer
composer require nihilarr/parse-torrent-name
Non-Composer
require('PTN.php'); // Require PTN/PTN.php file
Usage
$ptn = new PTN();
$results = $ptn->parse('A freakishly cool movie or TV episode');
var_dump($results); // All details that were parsed
PTN works well for both movies and TV episodes. All meaningful information is extracted and returned together in a dictionary. The text which could not be parsed is returned in the excess field.
Movies
$ptn->parse('San Andreas 2015 720p WEB-DL x264 AAC-JYK');
# array(
# 'group' => 'JYK',
# 'title' => 'San Andreas',
# 'resolution' => '720p',
# 'codec' => 'x264',
# 'year' => '2015',
# 'audio' => 'AAC',
# 'quality' => 'WEB-DL'
# );
$ptn->parse('The Martian 2015 540p HDRip KORSUB x264 AAC2 0-FGT');
# array(
# 'group' => '0-FGT',
# 'title' => 'The Martian',
# 'resolution' => '540p',
# 'excess' => ['KORSUB', '2'],
# 'codec' => 'x264',
# 'year' => 2015,
# 'audio' => 'AAC',
# 'quality' => 'HDRip'
# );
TV Episodes
$ptn->parse('Mr Robot S01E05 HDTV x264-KILLERS[ettv]');
# array(
# 'episode' => 5,
# 'season' => 1,
# 'title' => 'Mr Robot',
# 'codec' => 'x264',
# 'group' => 'KILLERS[ettv]'
# 'quality' => 'HDTV'
# );
$ptn->parse('friends.s02e01.720p.bluray-sujaidr');
# array(
# 'episode' => 1,
# 'season' => 2,
# 'title' => 'friends',
# 'resolution' => '720p',
# 'group' => 'sujaidr',
# 'quality' => 'bluray'
# );
Note
PTN does not gaurantee the fields group, excess and episodeName as these fields might be interchanged with each other. This shouldn't affect most applications since episode name can be fetched from an online database after getting the season and episode number correctly.
Parts extracted
- audio
- codec
- container
- episode
- episodeName
- excess
- extended
- garbage
- group
- hardcoded
- language
- proper
- quality
- region
- repack
- resolution
- season
- title
- website
- widescreen
- year
Contributing
Take a look at the open issues on the original JavaScript project and submit a PR!
Take a look at the open issues on the Python port and submit a PR!
License
MIT © Drew Smith
nihilarr/parse-torrent-name 适用场景与选型建议
nihilarr/parse-torrent-name 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.28k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 04 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「library」 「parser」 「parse」 「torrent」 「ptn」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nihilarr/parse-torrent-name 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nihilarr/parse-torrent-name 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nihilarr/parse-torrent-name 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
yii2 xml request parser
Parse promotion arrays from the Wayne State University API
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
Parse use statements for a reflection object
An MT940 bank statement parser for PHP
Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
统计信息
- 总下载量: 2.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-23