kesar/php-open-subtitles
Composer 安装命令:
composer require kesar/php-open-subtitles
包简介
phpOpenSubtitles is a PHP library for opensubtitles.org
README 文档
README
Library to connect with opensubtitles.org
Example
-
Update your config/configuration.yml.dist with login from Open Subtitles
-
run in console ``php console.php ```
<?php /** * Example that use SubtitleManager in console * * @author César Rodríguez <kesarr@gmail.com> * @example php console.php <filepath> */ use Symfony\Component\Yaml\Yaml; use OpenSubtitlesApi\SubtitlesManager; use OpenSubtitlesApi\FileGenerator; require_once 'vendor/autoload.php'; $file = $argv[1]; if (empty($file)) { echo 'error! you must supply a file'; return 1; } if (!is_file($file)) { echo 'error! file ' . $file . ' does not exist'; return 1; } $config = Yaml::parse(file_get_contents(__DIR__ . '/config/configuration.yml.dist')); if (empty($config)) { echo 'error! config file does not exist'; return 1; } $manager = new SubtitlesManager($config['username'], $config['password'], $config['language']); $subtitles = $manager->get($file); if (!empty($subtitles) && !empty($subtitles[0])) { $fileGenerator = new FileGenerator(); $fileGenerator->downloadSubtitle($subtitles[0], $file); } else { echo 'error! impossible to find the subtitle'; }
统计信息
- 总下载量: 127
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 25
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-10