Anthony Musgrove 195 Posted April 26, 2022 Author Share Posted April 26, 2022 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 5 Posted May 1, 2022 Share Posted May 1, 2022 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 9 Posted May 1, 2022 Share Posted May 1, 2022 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 5 Posted May 1, 2022 Share Posted May 1, 2022 (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, 2022 by Awkwardphoton Link to comment Share on other sites More sharing options...
kirkj 9 Posted May 2, 2022 Share Posted May 2, 2022 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 5 Posted May 2, 2022 Share Posted May 2, 2022 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 9 Posted May 2, 2022 Share Posted May 2, 2022 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 10 Posted May 8, 2022 Share Posted May 8, 2022 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 195 Posted May 24, 2022 Author Share Posted May 24, 2022 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 3 Posted May 29, 2022 Share Posted May 29, 2022 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 7 Posted June 1, 2022 Share Posted June 1, 2022 (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, 2022 by benris Link to comment Share on other sites More sharing options...
fillidill 153 Posted June 4, 2022 Share Posted June 4, 2022 (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, 2022 by fillidill Link to comment Share on other sites More sharing options...
ginjaninja 533 Posted June 6, 2022 Share Posted June 6, 2022 @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 0 Posted June 17, 2022 Share Posted June 17, 2022 (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, 2022 by mabogdan1981 Link to comment Share on other sites More sharing options...
GavinCampbell 15 Posted June 21, 2022 Share Posted June 21, 2022 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...
ginjaninja 533 Posted June 27, 2022 Share Posted June 27, 2022 On 21/06/2022 at 02:55, GavinCampbell said: 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? ScripterX 4.0.0.8 on server 4.8.0.3 onplaybackstopped firing for me tested on windows with pwsh script 2022-06-27 09:18:51.366 Info Emby ScripterX: onPlaybackStopped: -EventType "onPlaybackStopped" -Type "Episode" -Id "359191" -Name "Nina Conti, Nick Helm, Athena Kugblenu and Toby Tarrant (2/5)" only time ive had events not fire is when i have unticked the event Link to comment Share on other sites More sharing options...
GavinCampbell 15 Posted June 27, 2022 Share Posted June 27, 2022 5 hours ago, ginjaninja said: only time ive had events not fire is when i have unticked the event Thank you. I got it working eventually. When setting them up if they don't fire I delete them and recreate and it seems to start working again. Not sure why, but I have a route where I would create it and save it and then click away from the screen and back and they seem to work. Link to comment Share on other sites More sharing options...
GavinCampbell 15 Posted June 29, 2022 Share Posted June 29, 2022 Not sure if here is the place for feature requests, but..... Could I get an event trigger for "onMediaItemWatched" or something like that? Or even trigger "onMediaItemUpdated" when the watched status is changed as well? I'm mainly looking to utilize this to reset certain media items watched status for specific libraries/users using a shell script. I do this utilizing webhooks but having it in scripterx will simplify my solution quite a bit. Link to comment Share on other sites More sharing options...
ginjaninja 533 Posted June 29, 2022 Share Posted June 29, 2022 7 minutes ago, GavinCampbell said: Not sure if here is the place for feature requests, but..... Could I get an event trigger for "onMediaItemWatched" or something like that? Or even trigger "onMediaItemUpdated" when the watched status is changed as well? I'm mainly looking to utilize this to reset certain media items watched status for specific libraries/users using a shell script. I do this utilizing webhooks but having it in scripterx will simplify my solution quite a bit. i think onMediaitemwatched could be achieved through event onplaybackstopped...then firing a script which checks if the item is watched Link to comment Share on other sites More sharing options...
GavinCampbell 15 Posted June 29, 2022 Share Posted June 29, 2022 1 minute ago, ginjaninja said: i think onMediaitemwatched could be achieved through event onplaybackstopped...then firing a script which checks if the item is watched Thanks. I did look into that. The problem is that only triggers when the playback is stopped. If I right click on an item and mark it as watched there is no event that I see that would trigger. So it kind of gets me there, but not all the way. Link to comment Share on other sites More sharing options...
roaku 795 Posted June 29, 2022 Share Posted June 29, 2022 (edited) 2 hours ago, GavinCampbell said: Thanks. I did look into that. The problem is that only triggers when the playback is stopped. If I right click on an item and mark it as watched there is no event that I see that would trigger. So it kind of gets me there, but not all the way. Emby provides a UserSaved event in UserDataManager that fires when a user modifies data like this. There's details in the event that describe what, exactly, they uupdated. I'm not sure if this is exposed through this plugin though. Edited June 29, 2022 by roaku Link to comment Share on other sites More sharing options...
GavinCampbell 15 Posted June 29, 2022 Share Posted June 29, 2022 1 hour ago, roaku said: Emby provides a UserSaved event in UserDataManager that fires when a user modifies data like this. There's details in the event that describe what, exactly, they uupdated. I'm not sure if this is exposed through this plugin though. That was it! Didn't realize that the onUserDataSaved exposed that stuff. Works perfectly. Thank you. 2 Link to comment Share on other sites More sharing options...
horstepipe 356 Posted July 6, 2022 Share Posted July 6, 2022 (edited) Hey folks, Based on the file name I want to add tags to a video so coverart can treat them differently (these are strm files so this doesn't work based on metadata here). So if a filename contains "bluray", add "CA-BD" tag if a filename contains "dvd", add "CA-DVD" tag Is this possible with this plugin or will I need to write a bash script that edits the nfo to add the tag (which is being triggered by the plugin if new media arrives)? Edited July 6, 2022 by horstepipe Link to comment Share on other sites More sharing options...
asdffdsa1 1 Posted July 20, 2022 Share Posted July 20, 2022 hello, thanks, first time poster. thanks for scripter-x, very easy to use. how can i add a new action, for `user`, `add to favorites` thanks, Link to comment Share on other sites More sharing options...
Oracle 74 Posted July 23, 2022 Share Posted July 23, 2022 New user for this plugin. Am I able to use this to run a batch script off of a task in Emby? 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