From 58feda71a24f516dc70d91d5638fbe4f41c137af Mon Sep 17 00:00:00 2001 From: John Yeates Date: Thu, 23 May 2024 17:44:49 +0100 Subject: [PATCH] Support custom sounds --- README.md | 2 ++ action.yml | 3 +++ pushover.py | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/README.md b/README.md index a3754e9..62e8dd3 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ You can pass the following flags into the action: | url_title | title for your supplementary URL | | device | Device name to send the message directly to | | priority | Notification priority (low-to-high: -2 to 1) | +| sound | The name of a supported sound (https://pushover.net/api#sounds; custom sounds are supported) | Example: ``` @@ -60,6 +61,7 @@ Example: url_title: 'example' device: 'iphone' # or 'iphone,galaxy10' priority: '1' # High priority + sound: 'cashregister' ``` ## Versioning diff --git a/action.yml b/action.yml index 835c666..a713a8d 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,8 @@ inputs: description: 'Device name to send the message directly to, rather than all devices (multiple devices may be separated by a comma)' priority: description: 'Notification priority (low-to-high: -2 to 1)' + sound: + description: 'The name of a supported sound (https://pushover.net/api#sounds; custom sounds are supported)' runs: using: 'docker' image: 'Dockerfile' @@ -30,3 +32,4 @@ runs: - --url_title=${{ inputs.url_title }} - --device=${{ inputs.device }} - --priority=${{ inputs.priority }} + - --sound=${{ inputs.sound }} diff --git a/pushover.py b/pushover.py index 0d3d11e..142ea51 100644 --- a/pushover.py +++ b/pushover.py @@ -26,6 +26,9 @@ def main(): parser.add_argument('--priority', type=str, help='Notification priority (low-to-high: -2 to 1)') + parser.add_argument('--sound', + type=str, + help='The name of a supported sound (https://pushover.net/api#sounds; custom sounds are supported)') args = parser.parse_args() try: token = os.environ['PUSHOVER_TOKEN'] @@ -46,6 +49,7 @@ def main(): 'url_title' : args.url_title, 'device' : args.device, 'priority' : args.priority, + 'sound' : args.sound, } response = requests.post('https://api.pushover.net/1/messages.json', headers=headers,