定制 codebuglab/laravel-srt-parser 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

codebuglab/laravel-srt-parser

最新稳定版本:v0.0.3-beta

Composer 安装命令:

composer require codebuglab/laravel-srt-parser

包简介

Simple package to parse SubRip or srt file in Laravel

README 文档

README

Simple package to parse SubRip or srt file in Laravel

Laravel Srt Parser

Table of contents

Setup

Installation

To install this package through composer run the following command in the terminal

composer require codebuglab/laravel-srt-parser

Instructions

  • To use Srt Parser you have to include next facade file
use CodeBugLab\SrtParser\Facades\SrtParser;

Convert to Array

  • This is how you can convert srt to array and read every subtitle details.
$path = storage_path('app/Cars (2006).srt'); // file path

$srt = SrtParser::load($path)->toArray();
  • Next is a simple array response you can get from this parser containing subtitle number, start time, stop time, duration of the words appearing in seconds and finally an array of text.
Array
(
    [0] => Array
        (
            [number] => 1
            [startTime] => 00:00:38,365
            [stopTime] => 00:00:41,495
            [duration] => 3.1299998760223
            [text] => Array
                (
                    [0] => OK... Here we go. Focus.
                )

        )

    [1] => Array
        (
            [number] => 2
            [startTime] => 00:00:41,575
            [stopTime] => 00:00:44,935
            [duration] => 3.3599998950958
            [text] => Array
                (
                    [0] => Speed. I am speed.
                )

        )
    .
    .   
    .
)

License

This package is a free software distributed under the terms of the MIT license.

统计信息

  • 总下载量: 152
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-10