pyrex-fwi/sapar-id3
Composer 安装命令:
composer require pyrex-fwi/sapar-id3
包简介
The package lays the basis for the simple manipulation of ID3 tags.You can define readers and writers to manipulate the metadata in read or write.
README 文档
README
Phpunit code coverage Phpmetrics
Supported id3 bin
The package lays the basis for the simple ID3 tags manipulation.
You can define readers and writers to manipulate the metadata in read or write.
| Mediainfo (>= 17.0) | EyeD3 (>= 0.8) | metaflac (>= 1.3.0) | ffprobe (>= 2.8.14) | exiftool () | lltag () | id3info () | id3tool () | mp3info () | |
|---|---|---|---|---|---|---|---|---|---|
| Mp3 read | ✓ | ✓ | no | ✓ | |||||
| Mp3 read comments | ✓ | ✓ | - | no | |||||
| Mp3 write | no | ✓ | no | ✓ | |||||
| Mp4 read | ✓ | - | - | - | |||||
| Mp4 write | - | - | - | - | |||||
| Flac read | ✓ | - | - | - | |||||
| Flac write | no | no | - | - | |||||
| Output XML | ✓ | no | - | ✓ | |||||
| Output JSON | ✓ | no | - | ✓ |
- '✓', 'no', 'yes' = Tested
- '-' = not tested
Speed benchmark
| Bin readers | 100 iterations | 500 iterations |
|---|---|---|
| [metaflac] | 2.249s | 11.73s |
| [Mediainfo] | 5.362s | 27.19s |
| [ffprobe] | 9.716s | 48.43s |
| [EyeD3] | 13.052s | 65.423s |
Usages
Read Id3 Tags
<?php
class MyClass
{
public function readId3()
{
$mp3OrFlacFile = '/path/to/file';
/** @var Sapar\Id3\Metadata\Id3MetadataInterface */
$id3Metadata = new Sapar\Metadata\Id3Metadata($mp3OrFlacFile);
/** @var Sapar\Wrapper\BinWrapper\BinWrapperInterface */
$mediaInfoWrapper = new Sapar\Wrapper\BinWrapper\MediainfoWrapper();
$mediaInfoWrapper->setBin('/usr/local/bin/mediainfo');
if ($mediaInfoWrapper->read($metaDataFile)) {
$metaDataFile->getTitle();
$metaDataFile->getArtist();
$metaDataFile->getAlbum();
$metaDataFile->getGenre();
$metaDataFile->getYear();
$metaDataFile->getBpm();
$metaDataFile->getTimeDuration();
}
}
}
Write Id3 Tags
<?php
class MyClass
{
public function writeId3()
{
$mp3OrFlacFile = '/path/to/file';
/** @var Sapar\Id3\Metadata\Id3MetadataInterface */
$id3Metadata = new Sapar\Metadata\Id3Metadata($mp3OrFlacFile);
$id3Metadata->setAlbum('album');
$id3Metadata->setTitle('title');
$id3Metadata->setGenre('genre');
$id3Metadata->setYear(2016);
$id3Metadata->setComment('comment');
$id3Metadata->setBpm(120);
/** @var Sapar\Wrapper\BinWrapper\BinWrapperInterface */
$id3v2wrapper = new Sapar\Wrapper\BinWrapper\Id3v2Wrapper();
$id3v2wrapper->setBin('/usr/local/bin/id3v2');
if ($mediaInfoReader->write($metaDataFile)) {
//it's done!
}
}
Create custom Wrapper
<?php
class MyClass
{
}
Tests
pyrex-fwi/sapar-id3 适用场景与选型建议
pyrex-fwi/sapar-id3 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 274 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pyrex-fwi/sapar-id3 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pyrex-fwi/sapar-id3 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 274
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 13
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-18