https://github.com/sosie-js/peagisub-vs
Lua Helper to set path vars on python aegisub-vs.py from paths detected on lua side by aegisub
https://github.com/sosie-js/peagisub-vs
aegisub-script bridge configuration lua python sos subtitles tools vapoursynth video
Last synced: 3 months ago
JSON representation
Lua Helper to set path vars on python aegisub-vs.py from paths detected on lua side by aegisub
- Host: GitHub
- URL: https://github.com/sosie-js/peagisub-vs
- Owner: sosie-js
- Created: 2024-07-08T21:21:15.000Z (almost 2 years ago)
- Default Branch: 1.7.0
- Last Pushed: 2024-08-17T21:24:30.000Z (almost 2 years ago)
- Last Synced: 2024-08-18T18:28:31.664Z (almost 2 years ago)
- Topics: aegisub-script, bridge, configuration, lua, python, sos, subtitles, tools, vapoursynth, video
- Language: Lua
- Homepage: http://sosie.sos-productions.com
- Size: 848 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

## 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](https://github.com/gvvaughan/luke/pull/6) and [luarocks](https://github.com/luarocks/luarocks/discussions/1698) authors - big thanks to them - and tenacity, I finally converged to the pattern of a command [peagisub](src/peagisub) calling a builtin [peagisub.lua](src/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](https://github.com/arch1t3cht/Aegisub/blob/feature/automation/vapoursynth/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](https://github.com/luarocks/luarocks/issues/1694) for python. A wrapper is in the [doc](doc/Usage.md).
## 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](https://github.com/arch1t3cht/Aegisub/releases) 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](https://github.com/luarocks/luarocks/wiki/)
Note : you may not need to compile it from sources as suggested in the wiki on Ubuntu/Debian just do
```shell
sudo apt install lua luarocks
```
if you have already a working luarock environment you need just do
```shell
luarocks install peagisub
```
it will install the [published package can be found on Luarocks](https://luarocks.org/modules/sosie-js/peagisub)
**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](http://www.vapoursynth.com/doc/installation.html#linux)
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](https://github.com/arch1t3cht/Aegisub/discussions/147#discussioncomment-10073837) :
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](https://github.com/sosie-js/peagisub-vs/blob/1.6.0/doc/Usage.md) showing communication between the command and the builtin module.
### Scite
Open test/aegisub-vs.py in [scite](https://scintilla.org/SciTE.html) 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

-test/peagisub_dev.lua: is a symlik from src/peagiusb so [scite](https://scintilla.org/SciTE.html) 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
```shell
eval "$(luarocks path --bin)" && lua -l peagisub -e 'print(peagisub.version); os.exit()'
```
see autogenerated [ldoc for the API](doc/index.html)
## Requirements
- [Lua](http://www.lua.org), version 5.1 or up
- [LuaRocks](https://luarocks.org), 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](https://martin-fieber.de/blog/lua-project-setup-with-luarocks/).