<commit_before># osxnotifysounds

I thought it'd be nice to have custom notification sounds for any application.

Currently the program expects to find the config.json file inside `~/.config/osxnotifysounds/config.json`

Inside the config, your primary concerns are:

- app_id value
- look_for values
- sound value

the **app_id** needs to match the app_id for the application you'd like to monitor in the notification center

the **look_for** values are what trigger a custom sound if they're found in the particular alert

the **sound** value should point to a playable .aiff file or any other filetype afplay supports

In order to find the app_id for an application you're interested in monitoring, use the '-a' cli argument, e.g.,

```
./osxnotifysounds -a slack
Matched application: com.tinyspeck.slackmacgap -- app_id: 25
```

Now you can create a new config entry for this app_id and have custom sounds for it.<commit_msg>add unit test for string app_id.  improved error handling with added combinators<commit_after># osxnotifysounds
I thought it'd be nice to have custom notification sounds for any application.

## Building
Below steps can be used to build the Rust osxnotifysounds binary.

```
git clone https://github.com/asyncsrc/osxnotifysounds
cd osxnotifysounds
cargo build --release
```

## Running
Currently the program expects to find the config.json file inside `~/.config/osxnotifysounds/config.json`

Inside the config, your primary concerns are:

- app_id value
- look_for values
- sound value

### App ID

In order to find the app_id for an application you're interested in monitoring, use the '-a' cli argument, e.g.,

```
./osxnotifysounds -a slack
Matched application: com.tinyspeck.slackmacgap -- app_id: 25
```

You can now add a new entry to the config.json file for this app and then define the look_for and sound values as desired.

### Look For
The program will do substring matches to confirm whether a value within the look_for list is found in the notification/alert text.  

```
Slack alert: (app_id: 25)

Example alert:  "New message from <NAME>"

Example look_for value:

"look_for": [
  "<NAME>"
]
```

In this case, <NAME> would be found in the alert, so the sound value is triggered.

### Sound
Once a sound is triggered, we'll use `afplay` to attempt to play the sound file.  I've only tested `*.aiff` files, but I'm sure we could make any type of audio file/player work.



{'fraction_non_alphanumeric': 0.07491721854304635, 'fraction_numerical': 0.0024834437086092716, 'mean_word_length': 4.231601731601732, 'pattern_counts': {'":': 1, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5842119', 'n_tokens_mistral': 733, 'n_tokens_neox': 699, 'n_words': 343}