Skip to main content

Tool/library to add ruby text to subtitles

Project description

Migaku rubysubs

Tool/library to add ruby text to Advanced SubStation Alpha (.ass) subtitles using the same syntax as in Anki or the Migaku Anki plugins.

rubysubs is licensed under LGPLv3. See LICENSE for further detail.

Installation

Run the following to install:

pip install rubysubs

For binary releases refer to the releases page.

Usage as tool

rubysubs <source subtitle> <output subtitle> [<tag parser> [arg0] [arg1] ...]
  • Source subtilte: Path to source subtitle file
  • Output subtilte: Path to output subtitle file
  • Tag parser (optional):
    • ruby (default): Ruby square bracket tags, no arguments
    • ja: Migaku Japanese tag parser
      • arg0: mode (furigana/kanji/kana, default: furigana)
      • arg1: pitch highlighting (yes/no, default: yes)
      • arg2: pitch shapes (yes/no, default: no)
      • arg3: unknown word underlining (yes/no, default: yes)
      • arg4: 1T word highlighting (yes/no, default: yes)

Examples:

rubysubs source.ass out.ass
rubysubs source_ja.ass out_ja_furigana_no_markings.ass ja furigana no no no no
rubysubs source_ja.ass out_ja_kana_all_markings.ass ja kana yes yes yes yes

Notes:

  • Style info is pulled from the style called Default
    • ScaleX and ScaleY are reset to 100
    • Spacing and Angle are reset to 0
    • Italic, Underline and Strikeout are reset. Bold is supported
    • Alignment is currently fixed to bottom-center with MarginV being considered
  • PlayResX and PlayResY script info tags should be set to allow screen postion calculations. Defaults to 1920x1080
  • No ASS tags are supported

Usage as library

import sys
import rubysubs
from PyQt5.QtGui import QGuiApplication

# Required for QFontMetrics
qapp = QGuiApplication(sys.argv)

rubysubs.convert_sub_file('source.ass', 'out.ass', rubysubs.tag_parse_ruby.parse)
rubysubs.convert_sub_file('source_jp.ass', 'out_ja.ass', rubysubs.tag_parse_migaku_ja.parse)

Used libraries

  • cChardet for subtitle file encoding detection
  • pysubs2 for subtitle file reading/writing
  • PyQt5 for text measurements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rubysubs-0.1.4.tar.gz (16.3 kB view hashes)

Uploaded Source

Built Distributions

rubysubs-0.1.4-py3.9.egg (49.1 kB view hashes)

Uploaded Source

rubysubs-0.1.4-py3-none-any.whl (25.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page