Skip to content

Lua Helper to set path vars on python aegisub-vs.py from paths detected on lua side by aegisub

Notifications You must be signed in to change notification settings

sosie-js/peagisub-vs

Repository files navigation

peagisub banner

News

Version 1.7 removes aegisub mock that broke builtin aegisub.lua, crashing peagisub with an insufficient error message It warns the user to create the mandatory configfile if not yet exists using command peagisub --createconfigfile

With 1.6, dump logging is working and I have been able to track the bug that corrupt the final vsvars.conf giving nil when fetching vapoursynth conf vars. An advanced aegiub Mock has been provided in src/aegisub.lua, it emulates aegisub when script is launched outside aegisub and speeds devs.It uses get_fps.lua that rely on calc.lua and ffprobe need to be installed to make it work.

Prior version 1.5, code was still experimental due to a lack of knowledge in luarock integration. Thanks to advices and answers to my questions from luke and luarocks authors - big thanks to them - and tenacity, I finally converged to the pattern of a command peagisub calling a builtin peagisub.lua

This was without loosing in mind that this last one should be recognized as macro script in aegisub. Doing this allow to fix and trigger either from aegisub macro graphically or from script lua/python or shell. My need was to get aegisub env into vapoursynth script aegisub-vs.py from arch1t3cht aegisub fork to make it work outside too making video production easier.

This version put an end to the BIG lock issue I had when run_luarocks_cmd wrapper for python. A wrapper is in the doc.

Description

This is the lua companion for aegisub to retrieve path specifiers as well vapoursynth vars to be able to setup the aegisub-vs python bridge provided in the Aegisub forked version from Arch1t3cht BIG THANKS to @arch1t3cht. Initially I put the script in ?user/automation/autoload but I need to trigger it without aegisub installed as a module from python side.

Installation

First install LuaRocks for your OS Note : you may not need to compile it from sources as suggested in the wiki on Ubuntu/Debian just do

sudo apt install lua luarocks

if you have already a working luarock environment you need just do

luarocks install peagisub

it will install the published package can be found on Luarocks

however i recommend to install it in the user tree with luarocks install --local peagisub

There are scripts I provided for this are for linux only Ubuntu/debian based. The goal is to install all in the user tree including luarocks itself upgraded to the latest version.

-Launch in the order: 0-uninstall-previous-luarocks.sh 1-install-latest-luarocks.sh

-then 2-install-dev.sh

Usage

Aegisub

-Copy src/peagisub.lua as aegisub_vs.lua into your automation folder ?user/automation/autoload Reload aegisub , you will see an entry "Generate aegisub config file" . The script is triggered on start , clicking on the entry will show where the vsvars.json was saved.

-A autogenerated with a Dummy Vapoursynth failback
if vapoursynth.conf not found. In this case change tha UserPluginFir and SyStemPluginDir to match your vapoursynth configuration. I recommend this in linux discussing it here : the UserpluginDIr path standard be ?user/automation the SystemPluginDir $prefix/vapoursynth with $prefix=/usr/local on linux avoiding env gaz factories

NEW in 1.6: Fix the bug in aegisub that gives nil because vapoursynth was not read in certain cases IMPORTANT NOTE: by answering to yes to the first question in aegisub macro script or from shell with peagisub --fixconfigfile The script does not move your vapoursynth plugin files , you wil have to do it yourself.

Shell

You can have the available commands with peagisub --help I also draw graphs usage showing communication between the command and the builtin module.

Scite

Open test/aegisub-vs.py in scite and press [F5] you should have a vapoursynth.conf path content in your output pane meaning it works,

Dev / test

To understand and fix or add new features, I have made an overview

peagisub overview

-test/peagisub_dev.lua: is a symlik from src/peagiusb so scite recognizes it as lua script so easier to modify and fix -test/peagisub_testfail.lua: shows the limitation of luarocks loader

-in shell, you can bypass the peagisub command and access directly to the builtin API for tests using

eval "$(luarocks path --bin)" && lua -l peagisub -e 'print(peagisub.version); os.exit()'

see autogenerated ldoc for the API

Requirements

  • Lua, version 5.1 or up
  • LuaRocks, any recent version supporting Lua 5.1 and up, e.g. 3.9

How to get Lua and LuaRocks is in detail covered in the first article of the Lua series.