playscript
概要
台本を構造化データとして扱うためのパッケージです。
インストール
PyPI からインストールする場合は、追加で fountain をインストールします。
> pip install playscript
> pip install git+https://github.com/Tagirijus/fountain.git@7da5447abae640f34448dd36fee83f47a7415fcf
GitHub からインストールする場合は、以下のコマンドでインストールされます。
> pip install git+https://github.com/satamame/playscript.git
クラス
PSc
台本データのクラスです。
PScLine
PSc オブジェクトに含まれる各行を表すクラスです。
"type" 属性により、セリフやト書きといった「行の種類」が決まります。
PScLineType
PScLine の "type" を定義する enum 型です。
例
行を定義して台本を作る
from playscript import PScLineType, PScLine, PSc
title = PScLine.from_text(PScLineType.TITLE, 'ろくでなしの冒険')
h1 = PScLine.from_text(PScLineType.H1, 'シーン1')
direction = PScLine.from_text(PScLineType.DIRECTION, '六郎と七郎、登場。')
dialogue1 = PScLine.from_text(PScLineType.DIALOGUE, '六郎「どうする?」')
dialogue2 = PScLine.from_text(PScLineType.DIALOGUE, '七郎「帰って寝る」')
endmark = PScLine.from_text(PScLineType.ENDMARK, 'おわり')
script = PSc(
lines=[
title,
h1,
direction,
dialogue1,
dialogue2,
endmark,
]
)
Fountain (日本式) から台本を作る
import textwrap
from playscript.conv.fountain import psc_from_fountain
fountain_str = textwrap.dedent('''\
Title: ろくでなしの冒険
Author: アラン・スミシ
# 登場人物
六郎
七郎
# シーン1
六郎と七郎、登場。
@六郎
どうする?
@七郎
帰って寝る
> おわり
''')
script = psc_from_fountain(fountain_str)
Fountain (日本式) を読み込んで PDF にする
from playscript.conv import fountain, pdf
with open('example.fountain', encoding='utf-8-sig') as f:
script = fountain.psc_from_fountain(f.read())
pdf_stream = pdf.psc_to_pdf(script)
with open('out.pdf', 'wb') as f:
f.write(pdf_stream.read())
Fountain (日本式) を読み込んで HTML にする
from playscript.conv import fountain, html
with open('example.fountain', encoding='utf-8-sig') as f:
script = fountain.psc_from_fountain(f.read())
html_str = html.psc_to_html(script)
with open('out.html', 'w', encoding='utf-8') as f:
f.write(html_str)
Metadata
Release files for playscript 0.2.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| playscript-0.2.8.tar.gz | 22.3 kB | Without provenance | Details for playscript-0.2.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| playscript-0.2.8-py3-none-any.whl | Python 3 | none | any | Details for playscript-0.2.8-py3-none-any.whl |
Total release size: 45.4 kB
Release files / playscript-0.2.8.tar.gz
| Download URL | playscript-0.2.8.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b150e65204bd5fdb982bc6cbccba25c6f68c85009713e3c705f310b87a3caf3
|
|
BLAKE2b-256 checksum How to use checksums |
8a1247efde3d5ecfd2c866ef44eeb51b49f2e8779e74a7a714b6b88c7b44f996
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Release files / playscript-0.2.8-py3-none-any.whl
| Download URL | playscript-0.2.8-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b7cb2b73c64966ce754ef41de0ffab663aff2c7fb8b6e62d2008f94f5f7631a
|
|
BLAKE2b-256 checksum How to use checksums |
0bcfe8e0836aff3a2d6c62efa80615b0d28af3cbadc98346bb3119ee35ce669d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Security for playscript 0.2.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.