AviUtlのエクスポートファイル版ルパン三世風タイトルパーツメーカー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# coding: utf-8 | |
# AviUtlのエクスポートファイル版ルパン三世風タイトルパーツメーカー | |
# Copyright 2017,2018 pandanote.info (https://pandanote.info/) | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
# | |
# 音源については別途ご用意いただき、コマンドラインの引数で指定してください。 | |
# 画面サイズは1920x1200、オーディオレートは44100Hz、 | |
# サンプリング周波数は30fpsで決め打ちです。 | |
# その他、いろいろと決め打ちなところがあります。 | |
# | |
# 使用法: 1. 第2引数(-gオプションを指定した場合は第3引数)を省略すると画像のみの | |
# 出力となります。 | |
# 2. 第1引数として"-g"を指定すると、すべてのオブジェクトがグループ化された | |
# 状態で出力されます。 | |
# python3 lupin3rdtwexo.py [-g] <表示したい文字列> [<音声ファイルのフルパス>] | |
# | |
import io | |
import sys | |
import re | |
import codecs | |
from struct import * | |
from binascii import hexlify | |
# 標準出力の文字コードを変更する。 | |
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='cp932') | |
if len(sys.argv) <= 1: | |
print("Usage: lupin3rdtwexo.py [-g] <string to type> <sound file (in full path)>") | |
sys.exit(1) | |
is_grouping = 0 | |
if sys.argv[1] == '-g': | |
is_grouping = 1 | |
args = sys.argv[1:] | |
else: | |
args = sys.argv | |
if len(args) <= 1: | |
print("Usage: lupin3rdtwexo.py [-g] <string to type> <sound file (in full path)>") | |
sys.exit(1) | |
tmpstr = args[1] | |
if len(args) == 3: | |
soundfile = args[2] | |
else: | |
soundfile = "" | |
# ヘッダの文字列を出力する。 | |
print("[exedit]\r") | |
print("width=1920\r") | |
print("height=1200\r") | |
print("rate=30\r") | |
print("scale=1\r") | |
print("length=612\r") | |
print("audio_rate=44100\r") | |
print("audio_ch=2\r") | |
# 入力された文字列のうち、文字列のスペースは削除します。 | |
inputstr = re.sub(r'\s+',"",tmpstr) | |
pos = 0 | |
start = 1 | |
end = 8 | |
for i in list(inputstr): | |
print("[{0:d}]\r".format(pos)) | |
print("start={0:d}\r".format(start)) | |
print("end={0:d}\r".format(end)) | |
print("layer=1\r") | |
print("overlay=1\r") | |
print("camera=0\r") | |
if is_grouping == 1: | |
print("group=1\r") | |
print("[{0:d}.0]\r".format(pos)) | |
print("_name=テキスト\r") | |
print("サイズ=295\r") | |
print("表示速度=0.0\r") | |
print("文字毎に個別オブジェクト=0\r") | |
print("移動座標上に表示する=0\r") | |
print("自動スクロール=0\r") | |
print("B=0\r") | |
print("I=0\r") | |
print("type=0\r") | |
print("autoadjust=0\r") | |
print("soft=1\r") | |
print("monospace=0\r") | |
print("align=4\r") | |
print("spacing_x=0\r") | |
print("spacing_y=0\r") | |
print("precision=1\r") | |
print("color=ffffff\r") | |
print("color2=000000\r") | |
print("font=游明朝 Demibold\r") | |
ii = hexlify(i.encode('utf-16')) | |
hex_str = ii.decode("ascii") | |
print("text={0:s}{1:s}".format(hex_str[4:6],hex_str[6:8]), end="") | |
for x in range(4,4096,4): | |
print("0000", end="") | |
print("\r") | |
print("[{0:d}.1]\r".format(pos)) | |
print("_name=標準描画\r") | |
print("X=0.0\r") | |
print("Y=0.0\r") | |
print("Z=0.0\r") | |
print("拡大率=100.00\r") | |
print("透明度=0.0\r") | |
print("回転=0.00\r") | |
print("blend=0\r") | |
start+=8 | |
end+=8 | |
pos+=1 | |
if soundfile == "": | |
sys.exit(0) | |
sl = len(inputstr) | |
start = 1 | |
end = 8 | |
for i in range(0,sl): | |
print("[{0:d}]\r".format(pos)) | |
print("start={0:d}\r".format(start)) | |
print("end={0:d}\r".format(end)) | |
print("layer=2\r") | |
print("overlay=1\r") | |
print("audio=1\r") | |
if is_grouping == 1: | |
print("group=1\r") | |
print("[{0:d}.0]\r".format(pos)) | |
print("_name=音声ファイル\r") | |
print("再生位置=0.00\r") | |
print("再生速度=100.0\r") | |
print("ループ再生=0\r") | |
print("動画ファイルと連携=0\r") | |
print("file="+soundfile+"\r") | |
print("[{0:d}.1]\r".format(pos)) | |
print("_name=標準再生\r") | |
print("音量=100.0\r") | |
print("左右=0.0\r") | |
start+=8 | |
end+=8 | |
pos+=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment