1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-03-11 06:22:52 +00:00

Created Custom Post Processing Scripts (markdown)

Qstick 2017-10-30 20:44:06 -04:00
parent 1138deaa7c
commit 2078884b2f

@ -0,0 +1,78 @@
If you're looking to trigger a custom script in your download client to tell Lidarr when to update, you can find more details here. Scripts are added to Lidarr via the *Connect* Settings page.
### Overview ###
Lidarr can execute a custom script when new albums are imported or a artist is renamed, depending on the which action occurred the parameters will be different. Parameters are passed to the script through environment variables (allowing for more flexibility in what we send to the script and not having to worry about a particular order).
### Environment Variables ###
##### On Grab #####
| Environment Variable | Details |
|---|---|
| lidarr_eventtype | Grab |
| lidarr_artist_id | Internal ID of the artist |
| lidarr_artist_name | Name of the artist |
| lidarr_artist_mbid | MusicBrainz ID for the artist |
| lidarr_artist_type | Type of the artist, Person, Group, etc |
| lidarr_release_albumcount | Number of albums in the release |
| lidarr_release_albumreleasedates | Release Date from original label |
| lidarr_release_albumtitles | Pipe (`\|`) separated list of album titles |
| lidarr_release_title | NZB/Torrent title |
| lidarr_release_indexer | Indexer where the release was grabbed |
| lidarr_release_size | Size of the release reported by the indexer |
| lidarr_release_quality | Quality name from Lidarr |
| lidarr_release_qualityversion | 1 is the default, 2 for proper |
| lidarr_release_releasegroup | Release Group, will not be set if it is unknown |
| lidarr_download_client | The client the torrent/NZB was passed to |
| lidarr_download_id | The hash of the torrent/NZB file downloaded (used to uniquely identify the download in the download client) |
##### On Download/On Upgrade #####
| Environment Variable | Details |
|---|---|
| lidarr_eventtype | Download |
| lidarr_isupgrade | `True` when an an existing file is upgraded, otherwise `False` |
| lidarr_artist_id | Internal ID of the artist |
| lidarr_artist_name | Name of the artist |
| lidarr_artist_path | Full path to the artist |
| lidarr_artist_mbid | MusicBrainz ID for the artist |
| lidarr_artist_type | Type of the artist, Person, Group, etc. |
| lidarr_trackfile_id | Internal ID of the track file |
| lidarr_trackfile_relativepath | Path to the track file relative to the artist' path |
| lidarr_trackfile_path | Full path to the track file |
| lidarr_trackfile_trackcount | Number of tracks in the track file |
| lidarr_trackfile_tracknumbers | Comma separated list of track numbers |
| lidarr_trackfile_trackreleasedates | Release date from original Album |
| lidarr_trackfile_tracktitles | Pipe (`\|`) separated list of track titles |
| lidarr_trackfile_quality | Quality name from Lidarr |
| lidarr_trackfile_qualityversion | 1 is the default, 2 for proper |
| lidarr_trackfile_releasegroup | Release group, will not be set if it is unknown |
| lidarr_trackfile_scenename | Original release name |
| lidarr_trackfile_sourcepath | Full path to the track file that was imported |
| lidarr_trackfile_sourcefolder | Full path to the folder the track file was imported from |
| lidarr_deletedrelativepaths | Pipe (`\|`) separated list of files that were deleted to import this file |
| lidarr_deletedpaths| Pipe (`\|`) separated list of full paths for files that were deleted to import this file |
| lidarr_download_client | The client the torrent/NZB was passed to |
| lidarr_download_id | The hash of the torrent/NZB file downloaded (used to uniquely identify the download in the download client) |
##### On Rename #####
| Environment Variable | Details |
|---|---|
| lidarr_eventtype | Rename |
| lidarr_artist_id | Internal ID of the artist |
| lidarr_artist_name | Name of the artist |
| lidarr_artist_path | Full path to the artist |
| lidarr_artist_mbid | MusicBrainz ID for the artist |
| lidarr_artist_type | Type of Artist (Person, Group, etc.) |
### Arguments ###
Additional command line line arguments that are passed to your script, such as running your script through cmd.exe you would set the path to `cmd.exe` and the arguments to `/c C:\Path\to\script.bat`.
### Specific usage tips ###
#### PHP ####
The information from Lidarr will not be added to $_ENV as one might expect but should be included in the [$_SERVER variable](https://secure.php.net/manual/en/reserved.variables.server.php). A sample script to use this information to convert a file can be found [here](https://gist.github.com/karbowiak/7fb38d346e368edc9d1a).
#### PowerShell ####
Sample script using the Lidarr environment variables to create EDL files for all albumss is [here](https://gist.github.com/RedsGT/e1b5f28e7b5b81e1e45378151e73ba5c).