To use Emby Scripter-X, you need to be running an Emby Media Server (version 4.8.10 or higher), on any Emby Media Server supported operating system or device, you can check this out here.
Installing Emby Scripter-X is easy as 1, 2, 3. Simply login to your Emby Media Server Administration Panel, select “Plugins” from your control panel's Navigation Sidebar, listed under “Advanced”:
Then at the top of the Plugins page, select the “Catalog” tab:
Then scroll down the Catalog until you find the “General” category, scroll to the left in this category using the side arrows, until you see “Emby Scripter-X":
Select Emby Scripter-X, then select Install, and install the latest version onto your Emby Media Server. You'll be prompted to restart your media server, which is required for your plugin to initialise.
After Emby Scripter-X has been installed, you should see “Emby Scripter-X → Actions” under the “Advanced” section of your Emby Media Server Control Panel Side Navigation Bar, simply click on this menu option to open the Emby Scripter-X Actions Configuration Panel:
Lets learn how to create your first script using a simple example.
On the Emby Scripter-X → Actions page, scroll down the Event list until you can find onAuthenticationFailed, this Event is triggered when a user fails to login to your emby media server, perhaps because of an invalid username or password. Click the Drop Down arrow/onAuthenticationFailed box, and then click the plus (+) button to create a new Action.
After clicking the plus (+) button, a new blank Action will appear underneath the token list. Click the Edit Button (‘pencil’ icon) to setup our new Action.
Your now editing your new Action. For our example, we're going to use a simple script interpreter that should be installed on your operating system, provided that you choose the correct interpreter for your environment; for example -
If you are using Linux, Unix, MacOsx, Raspberrian, or any other unix/linux based operating system, you should have access to the BASH script interpreter, typically located at /bin/bash or /bin/sh, so you can select this from the “Interpreter” dropdown box.
If you are using Windows or a Windows based operating system, you should have access to the Command Prompt Batch File interpreter, typically called “cmd”, so select “cmd” from the “Interpreter” dropdown box.
Now we need to create a script in your server storage, accessible to the Emby Media Server. For windows, you could simply create a new folder on your root drive, eg C:\MyScripts.
Batch File (Windows):
Open notepad, add the following lines, and save it in your scripts directory as “AuthFailed.bat”: ensure you change “C:\MyScripts\auth.log” to a folder that will be accessible by the script, it will create this log file when the script executes.
REM Parameters expected: %device.name% %username% %password%
@echo Auth Fail: %2 attempted to authenticate using password %2 on device %1 >> C:\MyScripts\auth.log
Bash Script (Linux, Unix, MacOsX, Raspberrian, etc): ensure you change “/home/myscripts/auth.log” to a folder that will be accessible by the script, it will create this log file when the script executes.
Open your text editor(vi, nano, pico, etc), paste the following lines, and save it in your scripts directory as “AuthFailed.sh":
#!/bin/bash
# Parameters expected: %device.name% %username% %password%
echo Auth Fail: $2 attempted to authenticate using password $2 on device $1 >> /home/myscripts/auth.log
Now that the script is created, you can see that the script needs the parameters %device.name%, %username% and %password% sent along with the Action, such that this information can be processed by the script. We simply do this by typing the mentioned tokens into the parameters box:
So this tells Scripter X to send %device.name%, %username% and %password% to the script AuthFailed.sh / AuthFailed.bat.
And lastly for this example, we need to point the “Script File” to the script that you created and saved to your storage. For example, if your script is located at C:\MyScripts\AuthFailed.bat, we simply enter that into the Run "Script File" box. Important note: If you're using Windows, and executing a batch script, you need to add /c to your Script File box before the Script path, for example “/c C:\MyScripts\AuthFailed.bat”, however this is only required if you're executing a Batch File Script (.bat).
Once you've entered the above information, click the ‘Tick’ button to save the action. You'll then see:
Another important note, if you're executing a Batch File, you need to right click the batch file on your windows computer, and ensure that ‘Execute Access’ is ticked for the user that is running the Emby Media Server software.
Once these conditions are met, simply try to login to your Emby Media Server using an invalid username or password, and check to see if your script created your log file! if not, ensure the directory where your logfile is to be created is writeable by the emby media server. You can also diagnose issues in your Emby Media Server log file.