diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-10-13 17:53:20 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-10-13 17:53:20 -0500 |
| commit | c4450c8592e646de0185fd58710277a2dd0b3ebc (patch) | |
| tree | 879c443ce8def6d7c5f3df4ce2f01bb95c9507f6 | |
| parent | 8400410fbbc81cea8140da79b3bb991c3bacd87c (diff) | |
| download | slskd-c4450c8592e646de0185fd58710277a2dd0b3ebc.tar.gz | |
move script config under integration
| -rw-r--r-- | config/slskd.example.yml | 22 | ||||
| -rw-r--r-- | src/slskd/Core/Options.cs | 26 |
2 files changed, 37 insertions, 11 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 6b7750d5..7dd6450b 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -213,6 +213,16 @@ # username: ~ # password: ~ # integration: +# scripts: +# my_post_download_script: +# on: +# - DownloadFileComplete +# - DownloadDirectoryComplete +# run: data/my_script.sh --json-to-process $EVENT +# my_logging_script: +# on: +# - All +# run: data/log_slskd_events.sh $EVENT # ftp: # enabled: false # address: ~ @@ -232,14 +242,4 @@ # notify_on_private_message: true # notify_on_room_mention: true # retry_attempts: 3 -# cooldown_time: 900000 -# scripts: -# my_post_download_script: -# on: -# - DownloadFileComplete -# - DownloadDirectoryComplete -# run: data/my_script.sh --json-to-process $EVENT -# my_logging_script: -# on: -# - All -# run: data/log_slskd_events.sh $EVENT
\ No newline at end of file +# cooldown_time: 900000
\ No newline at end of file diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 0f86ff62..306f9b87 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -32,6 +32,7 @@ namespace slskd using NetTools; using slskd.Authentication; using slskd.Configuration; + using slskd.Events; using slskd.Relay; using slskd.Shares; using slskd.Validation; @@ -2005,6 +2006,12 @@ namespace slskd public class IntegrationOptions { /// <summary> + /// Gets script configuration. + /// </summary> + [Validate] + public Dictionary<string, ScriptOptions> Scripts { get; init; } = []; + + /// <summary> /// Gets FTP options. /// </summary> [Validate] @@ -2017,6 +2024,25 @@ namespace slskd public PushbulletOptions Pushbullet { get; init; } = new PushbulletOptions(); /// <summary> + /// Script configuration. + /// </summary> + public class ScriptOptions + { + /// <summary> + /// Gets the list of Event types that trigger the script. + /// </summary> + [Enum(typeof(EventType))] + public string[] On { get; init; } = Array.Empty<string>(); + + /// <summary> + /// Gets the shell script to invoke. + /// </summary> + [StringLength(int.MaxValue, MinimumLength = 1)] + [NotNullOrWhiteSpace] + public string Run { get; init; } + } + + /// <summary> /// FTP options. /// </summary> public class FtpOptions : IValidatableObject |
