Giter Club home page Giter Club logo

aegisub-discordrpc's Introduction

Aegisub DiscordRPC

A Lua plugin (macro) for Aegisub to output currently editing subtitle information to Discord Rich Presence

Installation

Windows

  • Place the binary file discord-rpc.dll in your Aegisub installation folder.
    • If you use the discouraged 64-bit Aegisub then please take the provided discord-rpc-64.dll and rename it as discord-rpc.dll before placing it in your Aegisub installation folder.
      • I don't guarantee if it would work in 64-bit Aegisub because I don't use them and I can't test it. Plus, the official website also discouraged the use of 64-bit release due to lack of support for most of its video tools and renderer)
  • Place the script discord-rpc.lua into the automation\autoload folder.

Example

If you installed Aegisub in C:\Program Files (x86)\Aegisub then:

  • Place discord-rpc.dll in C:\Program Files (x86)\Aegisub.
  • Place discord-rpc.lua in C:\Program Files (x86)\Aegisub\automation\autoload.

Mac

Thanks to @NeSubs and @ilovedaehwi for assisting this in issue #1

  • Place the binary file libdiscord-rpc.dylib in /usr/local/lib.
    • If the directory /usr/local/lib does not exist, create it.
  • Place the script discord-rpc.lua into the automation/autoload directory where you had installed Aegisub in.

Linux (not tested)

While I use Linux alongside Windows, I don't have Aegisub compiled/installed natively where this would apply, so I can't test it. When running Aegisub on Linux using WINE, the instruction for Windows should be used instead of this. If anyone can test it, please open an issue.

  • Place the binary file libdiscord-rpc.so in /usr/local/lib.
    • If the directory /usr/local/lib does not exist, create it.
  • Place the script discord-rpc.lua into the automation/autoload directory where you had installed Aegisub in.

Usage

When installed correctly, it will first start the rich presense with Idle as the detail and No video file loaded yet as the state whenever you launched Aegisub.

First launch

Then, load your subtitle and video, and click on Update Discord RPC from the Automation menu to let Aegisub update the Rich Presence as Editing subtitle as the detail and the video file name as the state.

Click on the menu Details are updated

Warning

Please make sure that you have done either any of below before clicking Update Discord RPC menu:

  • You have already loaded the video for the subtitle you're editing.
  • You have already loaded subtitle file containing video path.

This is because of limitation in Aegisub, it doesn't expose the subtitle file name nor the window title to its Lua environment. It does, however, expose the subtitle property metadata to the Lua environment, and video path is one of the metadata in it.

I'm accessing that video path from the subtitle metadata for display in Rich Presence, and it would not work if you did not load any video for the subtitle file ever as the video path will not be there in the subtitle metadata.

I initially planned to automatically load the video path when Aegisub is launched, but it seems that the Lua script is loaded before the subtitle metadata itself, which is why I had to implement the "click on menu to update Discord RPC" method.

References

Script

This script uses some code from pfirsich's lua-discordRPC. Visit their repository to learn more, especially if you want to use Discord Rich Presence in Lua.

Their script is licensed under MIT.

Binary libraries

The binaries included in this repository came from Discord RPC official releases. You can also download the binaries directly from their official repository.

Make sure to take the dynamic version of binary:

  • Take discord-rpc/win32-dynamic/bin/discord-rpc.dll from discord-rpc-win.zip for 32-bit Aegisub on Windows
  • Take discord-rpc/win64-dynamic/bin/discord-rpc.dll from discord-rpc-win.zip for 64-bit Aegisub on Windows
  • Take discord-rpc/linux-dynamic/lib/libdiscord-rpc.so from discord-rpc-linux.zip for Linux
  • Take discord-rpc/osx-dynamic/lib/libdiscord-rpc.dylib from discord-rpc-osx.zip for Mac OS X

Their binaries and source code are licensed under MIT.

License

aegisub-discordrpc's People

Contributors

mnh48 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aegisub-discordrpc's Issues

Works on Linux and a small bug

I just tested this on linux, and it works as intended, while debugging a strange issue (that the update RPC button didn't work) I found a bug, in line 275 if (videoname ~= " ") then it is checked against a empty string, but for that it has to be if (videoname ~= "") then.

A Note to to the linux shared library, if you're putting the library in /usr/local/lib you also have to have that in you're ldconfig As far as I know it isn't standard in some distributions to have that in there, and additionally this directory was owned by root (it was present on my machine). So I preferred to put it in ~/.local/lib, since that is user owned, but not default in the ldconfig, to add it, you can either change /etc/ld.so.conf or add a new file into /etc/ld.so.conf.d/<whatever>.conf with the line ~/.local/lib

No video file loaded yet

it displays "No video file loaded yet" despite the video being opened with AegisubDC version
IMG_20220517_145055_897

what i tried:

  1. opening subtitles directly > no rpc at all
  2. opening video directly > no rpc at all

Adapt to Mac OS

I'm under the impression this plugin was developed on Windows but I'd like to use it on my Mac and I'm not exactly tech-savvy enough to figure it out myself, try as I might. I believe the core issue may be with the different installation folders, this is how it's organized on Mac:

Screen Shot 2021-01-20 at 2 49 44 PM

so a few more layers than Windows installation. I rotated the .dll file in every layer between the automation file and the app itself to no avail. When I open Aegisub with the files in place, I get this error message:

14:55:22: A script in the Automation autoload directory failed to load.
Please review the errors, fix them and use the Rescan Autoload Dir button in Automation Manager to load the scripts again.
14:55:22: Failed to load Automation script '/Applications/Aegisub.app/Contents/SharedSupport/automation/autoload/discord-rpc.lua':
Error initialising Lua script "discord-rpc.lua":

[string "/Applications/Aegisub.app/Contents/SharedSupp..."]:13: dlopen(libdiscord-rpc.dylib, 5): image not found

As I said, I'm quite new to this and took quite some time to research things but I'm still stuck. I understand if Mac is too different from Windows to adapt your existing plugin, thank you already for taking the time to read this. If you need any more information, please reach out and we can discuss it further.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.