Anthony Musgrove Posted April 26 Author Share Posted April 26 27 minutes ago, kirkj said: To perform the grouping I record the notifications in a sqlite database. In this bank I save the item_id, the season_id and a field that informs if that item has already been notified. This is the script that your plugin runs in onMediaItemAddedComplete (save-notification.py). The other script runs on a cron schedule. It reads the database and handles notifications. I forward the attached scripts. save-notification.py 893 B · 1 download telegram-notifications.py 8.02 kB · 1 download Thank you so so much @kirkj, I'm going to take a look at this today. That is awesome thank you again! 1 Link to comment Share on other sites More sharing options...
Awkwardphoton Posted May 1 Share Posted May 1 I don't know if this is possible using this plugin, and i'm not technically minded at all so i'm really struggling to figure out how to use this plugin. What i'm trying to figure out is if this plugin would be able to pass a newly added Movie title and metadata as variables for a bash script, and if it is possible, how on earth would I do it? This plugin looks amazing and i'm so impressed with what people are able to achieve with it Link to comment Share on other sites More sharing options...
kirkj Posted May 1 Share Posted May 1 22 hours ago, Awkwardphoton said: I don't know if this is possible using this plugin, and i'm not technically minded at all so i'm really struggling to figure out how to use this plugin. What i'm trying to figure out is if this plugin would be able to pass a newly added Movie title and metadata as variables for a bash script, and if it is possible, how on earth would I do it? This plugin looks amazing and i'm so impressed with what people are able to achieve with it You pass the parameters in the command that runs your script. In the scripterx configuration it informs which parameters can be used. I'm using a Python script, and I do the command as in the image: The first parameter is mandatory in my script. The second one doesn't, so I use the - and the parameter name. I think for bash it works the same way. The title is %item.name%. Link to comment Share on other sites More sharing options...
Awkwardphoton Posted May 1 Share Posted May 1 (edited) 1 hour ago, kirkj said: You pass the parameters in the command that runs your script. In the scripterx configuration it informs which parameters can be used. I'm using a Python script, and I do the command as in the image: The first parameter is mandatory in my script. The second one doesn't, so I use the - and the parameter name. I think for bash it works the same way. The title is %item.name%. Thank you so much for your response! So then how do I reference the parameters in my script? And I have no idea if my script is even getting run at all. I have a test script that just echos some text to a file when run, it doesn't need any parameters, just to be executed on playback starting, but when I start playback, the script isn't executed. Edited May 1 by Awkwardphoton Link to comment Share on other sites More sharing options...
kirkj Posted May 2 Share Posted May 2 2 minutes ago, Awkwardphoton said: Thank you so much for your response! So then how to I reference the parameters in my script? You can use Positional Parameters: echo "Param 1: $1"; echo "Param 2: $2"; echo "Param 3: $3"; sh script.sh param1 40 'param num 2' Result: Param 1: param1 Param 2: 40 Param 3: param num 2 But not always the parameters passed by Emby will be filled, so you can use Flags: while getopts u:a:f: flag do case "${flag}" in u) param_u=${OPTARG};; a) param_a=${OPTARG};; f) param_f=${OPTARG};; esac done echo "Param u: $param_u"; echo "Param a: $param_a"; echo "Param f: $param_f"; sh script.sh -f 'param num 2' -a 40 -u 'Param 1' Result: Param u: Param 1 Param a: 40 Param f: param num 2 sh script.sh -a 40 -u 'param num 2' Result: Param u: param num 2 Param a: 40 Param f: Here more details: https://www.baeldung.com/linux/use-command-line-arguments-in-bash-script Link to comment Share on other sites More sharing options...
Awkwardphoton Posted May 2 Share Posted May 2 1 hour ago, kirkj said: You can use Positional Parameters: echo "Param 1: $1"; echo "Param 2: $2"; echo "Param 3: $3"; sh script.sh param1 40 'param num 2' Result: Param 1: param1 Param 2: 40 Param 3: param num 2 But not always the parameters passed by Emby will be filled, so you can use Flags: while getopts u:a:f: flag do case "${flag}" in u) param_u=${OPTARG};; a) param_a=${OPTARG};; f) param_f=${OPTARG};; esac done echo "Param u: $param_u"; echo "Param a: $param_a"; echo "Param f: $param_f"; sh script.sh -f 'param num 2' -a 40 -u 'Param 1' Result: Param u: Param 1 Param a: 40 Param f: param num 2 sh script.sh -a 40 -u 'param num 2' Result: Param u: param num 2 Param a: 40 Param f: Here more details: https://www.baeldung.com/linux/use-command-line-arguments-in-bash-script wow, thank you so much! this will be very useful! I'm still having trouble getting the script to execute, though. I don't know what I need to do. Hopefully I figure that out Link to comment Share on other sites More sharing options...
kirkj Posted May 2 Share Posted May 2 19 minutes ago, Awkwardphoton said: wow, thank you so much! this will be very useful! I'm still having trouble getting the script to execute, though. I don't know what I need to do. Hopefully I figure that out In my tests I used the onPlayBackStart event. It's easier to check what values are sent in variables by the plugin than to keep adding and removing media. Remember to leave the script with permission to execute by the same user that runs your Emby server. Link to comment Share on other sites More sharing options...
ZSZQ Posted May 8 Share Posted May 8 Hello Anthony Thank you for this very useful plugin. I have a special environment. You need to run the shell script in the WinServer environment. I can use CMD to execute the script normally. But it has no effect in the Emby ScripterX plugin. The Emby ScripterX plugin can spread the parameters normally, but it seems that there is no normal execution script. The same script can be used normally in the linux environment. Is there anything to help me? Link to comment Share on other sites More sharing options...
Anthony Musgrove Posted May 24 Author Share Posted May 24 On 09/05/2022 at 04:19, ZSZQ said: Hello Anthony Thank you for this very useful plugin. I have a special environment. You need to run the shell script in the WinServer environment. I can use CMD to execute the script normally. But it has no effect in the Emby ScripterX plugin. The Emby ScripterX plugin can spread the parameters normally, but it seems that there is no normal execution script. The same script can be used normally in the linux environment. Is there anything to help me? Good morning @ZSZQ, thank you so much for your feedback. I've not tested bash in Windows environment with ScripterX yet, I'll have to set up an environment and check out what the issue may be. Just need to make sure everything has access to execute, etc. Leave it with me! Link to comment Share on other sites More sharing options...
justmejustme Posted May 29 Share Posted May 29 How do I tell if the show/movie is Paused, rather than Stopped? Neither onPlaybackStart, onPlaybackStopped, or onPlaybackProgress seem to tell me. During a pause, I want to have certain lights come on very dim, enough to run to the kitchen/bathroom without spoiling the mood. When it's totally stopped, I want them to come on full brightness. Link to comment Share on other sites More sharing options...
benris Posted June 1 Share Posted June 1 (edited) Hey, first of all: Scripter X is a gorgeous addon!!! I´ve 2 questions... 1: Is there a way to set a duration for the message when using sendmessage (as interpreter from settings UI) 2: Is there a way to set a delay or a timer to before s.th. runs? f.e. sendmessage? (I want to display a message when a user starts a session, but i think the message has been sent before the app fully loads... -> no message to see) thanks in advance benris Edited June 1 by benris Link to comment Share on other sites More sharing options...
fillidill Posted June 4 Share Posted June 4 (edited) Hello! I am really struggling getting this to work. I run Emby in a docker on a Synology NAS and I'm trying to run a python script but I get the following error message. Anyone knows what I am doing wrong? 2022-06-04 21:22:04.993 Error SessionManager: Error in event handler *** Error Report *** Version: 4.8.0.0 Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3 Operating system: Linux version 4.4.180+ (root@build15) (gcc version 7.5.0 (GCC) ) #42218 SMP Mon Oct 18 19:17:56 CST 2021 Framework: .NET 6.0.2 OS/Process: x64/x64 Runtime: system/System.Private.CoreLib.dll Processor count: 4 Data path: /config Application path: /system System.ComponentModel.Win32Exception: System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'python3' with working directory '/run/s6/legacy-services/emby-server'. No such file or directory at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at EmbyScripterX.Plugin.execute_action(EmbyScripterXAction nAction, String parameters) at EmbyScripterX.Core.ScripterXEventContext.Process(EmbyScripterXAction withAction) at EmbyScripterX.EventManagers.ScripterXSessionManager._sessionManager_PlaybackStart(Object sender, PlaybackProgressEventArgs e) at MediaBrowser.Common.Events.EventHelper.<>c__DisplayClass1_0`1.<QueueEventIfNotNull>b__0() Source: System.Diagnostics.Process TargetSite: Boolean ForkAndExecProcess(System.Diagnostics.ProcessStartInfo, System.String, System.String[], System.String[], System.String, Boolean, UInt32, UInt32, UInt32[], Int32 ByRef, Int32 ByRef, Int32 ByRef, Boolean, Boolean) Edited June 4 by fillidill Link to comment Share on other sites More sharing options...
ginjaninja Posted June 6 Share Posted June 6 @Anthony Musgrove Hi Anthony, Does the Emby plug in interface allow you to add ScripterX to the context menu of media items like playlists? So that we might use Scripter X through user triggers not just event triggers....eg Users clicks "..." menu on a playlist and call 'ScripterX event' "UserEvent1". with the option to use the current media item, user and device tags in the normal ScripterX way. This way we could extend the functionality from Emby UI with our own functions. eg when someone wants Link to comment Share on other sites More sharing options...
mabogdan1981 Posted June 17 Share Posted June 17 (edited) Hello. Since Scripter-X was created i always used this script that send parameters to an .sh script wich run an php script and echo that info on a log file. This is the .sh script: ----------------------------------------- #!/bin/sh cd "/share/Web/scripts" sudo /mnt/ext/opt/apache/bin/php update_time.php "${2}" ${5} ${6} ${7} ${8} ${9} ${10} >> /share/Web/logs/shell_logs/emby/update_time_php.log 2>&1 ------------------------------------------- From couple a days this not working anymore. No error, no nothing. It simply not work anymore. This is the log when it runs on emby: ---------------------------------------------------------------- 2022-06-17 17:54:26.929 Info Emby ScripterX: onPlaybackProgress: PROGRESS "/share/CACHEDEV1_DATA/video/Tv Shows/Legacies/Season 04/Legacies.S04E20.SDTV-GOSSIP.mp4" 4 20 bogdan 6877170420 25419850000 "27.054" tvshows TV shows 2022-06-17 17:54:27.052 Info Server: http/1.1 POST http://host1:20181/emby/Sessions/Playing/Progress?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=375c1168-a3e7-4aab-9c01-62bf914e9b4a&X-Emby-Client-Version=4.8.0.1&reqformat=json. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36 2022-06-17 17:54:27.062 Info Server: http/1.1 Response 204 to host2. Time: 9ms. http://host1:20181/emby/Sessions/Playing/Progress?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=375c1168-a3e7-4aab-9c01-62bf914e9b4a&X-Emby-Client-Version=4.8.0.1&reqformat=json 2022-06-17 17:54:28.193 Info Server: http/1.1 POST http://host1:20181/emby/Sessions/Playing/Stopped?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=375c1168-a3e7-4aab-9c01-62bf914e9b4a&X-Emby-Client-Version=4.8.0.1&reqformat=json. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36 ------------------------------------------------------------------- All that information from emby use to update an personal website of mine where i keep track af my library of movies an tv shows. I am on emby 4.8.0.1 an Scripter-X 4.0.0.8. Any help would be much appreciated. Sorry for my english but it's not my native language. Edited June 17 by mabogdan1981 Link to comment Share on other sites More sharing options...
GavinCampbell Posted June 21 Share Posted June 21 Does anybody have onPlaybackStopped working? I can't get it to execute a sh script. I have emby running in a docker and onPlaybackStart works fine. Just can't execute events when stop is run. I also don't see anything in the logs. It just doesn't fire. Any ideas? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now