{"id":25902671,"url":"https://github.com/jonathanhecl/subtitle-processor","last_synced_at":"2025-10-13T21:11:25.828Z","repository":{"id":96032079,"uuid":"330821022","full_name":"jonathanhecl/subtitle-processor","owner":"jonathanhecl","description":"A Go library for loading, processing, and saving subtitle files in different formats. ","archived":false,"fork":false,"pushed_at":"2025-03-31T03:58:21.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-13T21:11:25.355Z","etag":null,"topics":["golang","package","srt","srt-subtitles","ssa","ssa-subtitles","subtitles"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanhecl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-01-19T00:33:42.000Z","updated_at":"2025-03-31T03:58:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2bdff84-627c-47b5-808a-e13d9b6b3368","html_url":"https://github.com/jonathanhecl/subtitle-processor","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jonathanhecl/subtitle-processor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fsubtitle-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fsubtitle-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fsubtitle-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fsubtitle-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanhecl","download_url":"https://codeload.github.com/jonathanhecl/subtitle-processor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fsubtitle-processor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017054,"owners_count":26085949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","package","srt","srt-subtitles","ssa","ssa-subtitles","subtitles"],"created_at":"2025-03-03T03:17:06.943Z","updated_at":"2025-10-13T21:11:25.823Z","avatar_url":"https://github.com/jonathanhecl.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Subtitle Processor\n\nA Go library for loading, processing, and saving subtitle files in different formats. Currently supports SRT and SSA subtitle formats.\n\n## Features\n\n- Load and parse subtitle files (SRT, SSA)\n- Convert between different subtitle formats\n- Modify subtitle content programmatically\n- Save subtitles in different formats\n- Clean handling of text encoding and special characters\n\n## Supported Formats\n\n### SRT (SubRip Text)\nThe SubRip format is one of the most common subtitle formats. It consists of:\n- Sequence number\n- Timestamp range (start --\u003e end)\n- Text content\n- Blank line separator\n\n### SSA (Sub Station Alpha)\nThe Sub Station Alpha format is more complex and includes styling information:\n- Script Info section\n- Styles section\n- Events section with dialogue entries\n\n## Installation\n\n```bash\ngo get github.com/jonathanhecl/subtitle-processor\n```\n\n## Usage\n\n### Basic Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/jonathanhecl/subtitle-processor/subtitles\"\n)\n\nfunc main() {\n    // Load a subtitle file\n    sub := subtitles.Subtitle{}\n    sub.Verbose = true  // Enable verbose output\n    err := sub.LoadFile(\"input.srt\")\n    if err != nil {\n        fmt.Println(\"Error loading file:\", err)\n        return\n    }\n    \n    fmt.Println(\"Loaded subtitle file:\", sub.Filename)\n    fmt.Println(\"Format:\", sub.Format)\n    fmt.Println(\"Number of subtitle entries:\", len(sub.Lines))\n    \n    // Access subtitle content\n    for i, line := range sub.Lines {\n        fmt.Printf(\"Entry %d: %v --\u003e %v\\n\", i+1, line.Start, line.End)\n        fmt.Printf(\"Text: %v\\n\", line.Text)\n    }\n    \n    // Save to a different format\n    sub.Format = \"SSA\"  // Change format to SSA\n    err = sub.SaveFile(\"output.ssa\")\n    if err != nil {\n        fmt.Println(\"Error saving file:\", err)\n    }\n}\n```\n\n### Format Conversion\n\n```go\npackage main\n\nimport (\n    \"github.com/jonathanhecl/subtitle-processor/subtitles\"\n)\n\nfunc main() {\n    // Convert from SRT to SSA\n    sub := subtitles.Subtitle{}\n    sub.LoadFile(\"input.srt\")\n    sub.Format = \"SSA\"\n    sub.SaveFile(\"output.ssa\")\n    \n    // Convert from SSA to SRT\n    sub2 := subtitles.Subtitle{}\n    sub2.LoadFile(\"input.ssa\")\n    sub2.Format = \"SRT\"\n    sub2.SaveFile(\"output.srt\")\n}\n```\n\n### Modifying Subtitles\n\n```go\npackage main\n\nimport (\n    \"time\"\n    \"github.com/jonathanhecl/subtitle-processor/subtitles\"\n)\n\nfunc main() {\n    sub := subtitles.Subtitle{}\n    sub.LoadFile(\"input.srt\")\n    \n    // Delay all subtitles by 2 seconds\n    delay := 2 * time.Second\n    for i := range sub.Lines {\n        sub.Lines[i].Start += delay\n        sub.Lines[i].End += delay\n    }\n    \n    sub.SaveFile(\"delayed.srt\")\n}\n```\n\n## Project Structure\n\n- `subtitles/`: Main package\n  - `models/`: Data structures for subtitle processing\n  - `format/`: Format-specific parsers and writers\n    - `srt.go`: SRT format handler\n    - `ssa.go`: SSA format handler\n    - `helper.go`: Common utility functions\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanhecl%2Fsubtitle-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanhecl%2Fsubtitle-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanhecl%2Fsubtitle-processor/lists"}