1
0
Fork 0
mirror of https://github.com/Lidarr/Lidarr.git synced 2026-03-03 00:26:58 -05:00

Add event for when a track is deleted #3346

Open
opened 2026-02-20 13:08:32 -05:00 by deekerman · 1 comment
Owner

Originally created by @mfreeborn on GitHub (Jan 18, 2024).

Is there an existing issue for this?

  • I have searched the existing open and closed issues

I maintain a mirrored version of my music library in which any high-res tracks are downsampled to CD quality. I use this downsampled folder on my phone where hard drive space is an issue, whilst still having the highest quality version on my PC for when I'm listening at home.

I run a simple webhook server which listens for Lidarr events - principally "Download" events for when a release is imported to my music library and "AlbumDelete"/"ArtistDelete" for those self-explanatory events.

However, if I delete files in a particular release within the Lidarr UI (Manage Tracks > Delete), then the files are deleted from my primary music music library but no event is fired from Lidarr. As a result, my downsampled music library will fall out of sync because it doesn't know that the tracks have been deleted.

Is it possible to add an event for each track that is deleted from the Lidarr UI?

Describe the solution you'd like

A new "TrackDelete" event to be available.

Describe alternatives you've considered

Anything else?

Originally created by @mfreeborn on GitHub (Jan 18, 2024). ### Is there an existing issue for this? - [x] I have searched the existing open and closed issues ### Is your feature request related to a problem? Please describe I maintain a mirrored version of my music library in which any high-res tracks are downsampled to CD quality. I use this downsampled folder on my phone where hard drive space is an issue, whilst still having the highest quality version on my PC for when I'm listening at home. I run a simple webhook server which listens for Lidarr events - principally "Download" events for when a release is imported to my music library and "AlbumDelete"/"ArtistDelete" for those self-explanatory events. However, if I delete files in a particular release within the Lidarr UI (Manage Tracks > Delete), then the files are deleted from my primary music music library but no event is fired from Lidarr. As a result, my downsampled music library will fall out of sync because it doesn't know that the tracks have been deleted. Is it possible to add an event for each track that is deleted from the Lidarr UI? ### Describe the solution you'd like A new "TrackDelete" event to be available. ### Describe alternatives you've considered - ### Anything else? -
Author
Owner

@sirjmann92 commented on GitHub (Nov 5, 2024):

EDIT: I had some errors in my script that was causing part of my issue, so I've updated this post and removed some things. The rest is still valid.

Yes, please. TrackDeleted event should be added for custom scripting. Better yet, the scope of this "Issue" should be expanded to include other oddities and missing elements from the Custom Script API.

There are missing environment variables for other events that make custom scripts impossible. Such as an album path for the AlbumDeleted event. I used printenv to a log file for debugging and found several environment variables and/or event types are not available or incorrect.

These should all be reviewed and corrected/implemented:

  • AlbumDeleted (needs album path at least)
  • ArtistDeleted
  • TrackDeleted (doesn't exist?)

When you delete an album, there is no album path for the AlbumDeleted event:

=== Debug Log Start ===
2024-11-05 12:10:45
Event Type: AlbumDeleted
All Environment Variables:
"Boom Boom Pow" topped the Billboard Hot 100 for 12 weeks, making it the group's first number-one single on the chart. It is the second longest-running single to stay atop the chart in 2009, beaten only by their own "I Gotta Feeling", which held the top spot for 14 consecutive weeks. The song also topped the charts in Australia, Canada and the United Kingdom, as well as reaching the top ten in more than 20 countries. It was ranked atop the Billboard Hot 100 year-end chart for 2009, at number seven on the decade-end chart for the 2000s, and at number 51 on the all-time chart. As of 2015, it has sold over six million units in the US.
COMPlus_EnableDiagnostics=0
Critically acclaimed, "Boom Boom Pow" was nominated for Best Dance Recording and won Best Short Form Music Video at the 52nd Annual Grammy Awards (2010). Rolling Stone ranked the song at number 14 on their list "Best 25 Songs of 2009". As of October 2023, the music video has over 487 million views on YouTube.
DOCKER_MODS=ghcr.io/themepark-dev/theme.park:lidarr
HOME=/root
HOSTNAME=lidarr
LSIO_FIRST_PARTY=true
No_Expand=true
No_PreLoadSQLite=true
No_SQLiteFunctions=true
No_SQLiteXmlConfigFile=true
PATH=/command:/lsiopy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PGID=1000
PUID=1000
PWD=/app/lidarr/bin
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
S6_STAGE2_HOOK=/docker-mods
S6_VERBOSITY=1
SHLVL=3
TERM=xterm
TMPDIR=/run/lidarr-temp
TP_THEME=overseerr
TZ=America/Chicago
VIRTUAL_ENV=/lsiopy
XDG_CONFIG_HOME=/config/.config
XDG_DATA_HOME=/config/.config/share
_=/bin/printenv
lidarr_album_id=10767
lidarr_album_mbid=39e68c14-7e31-33e7-9caf-e60058732adf
lidarr_album_overview="Boom Boom Pow" is a song recorded by American group the Black Eyed Peas for their fifth studio album The E.N.D. (2009). It was written by group members will.i.am, apl.de.ap, Taboo and Fergie, being produced by will.i.am. The song features a vocal sample from the 1990 song "Reach Out" by British house duo Sweet Mercy featuring singer Rowetta. It was released as the lead single from The E.N.D. on February 22, 2009, by Interscope Records.
lidarr_album_releasedate=05/05/2009 00:00:00
lidarr_album_title=Boom Boom Pow
lidarr_applicationurl=
lidarr_artist_deletedfiles=True
lidarr_artist_genres=Dance-Pop|Electronic|Hip Hop|Pop|Pop Rap|West Coast Hip Hop
lidarr_artist_id=486
lidarr_artist_mbid=d5be5333-4171-427e-8e12-732087c6b78e
lidarr_artist_name=Black Eyed Peas
lidarr_artist_path=/share/Music/Black Eyed Peas
lidarr_artist_tags=
lidarr_artist_type=Group
lidarr_eventtype=AlbumDeleted
lidarr_instancename=Lidarr
=== Debug Log End ===
@sirjmann92 commented on GitHub (Nov 5, 2024): EDIT: I had some errors in my script that was causing part of my issue, so I've updated this post and removed some things. The rest is still valid. Yes, please. TrackDeleted event should be added for custom scripting. Better yet, the scope of this "Issue" should be expanded to include other oddities and missing elements from the Custom Script API. There are missing environment variables for other events that make custom scripts impossible. Such as an album path for the AlbumDeleted event. I used printenv to a log file for debugging and found several environment variables and/or event types are not available or incorrect. These should all be reviewed and corrected/implemented: - AlbumDeleted (needs album path at least) - ArtistDeleted - TrackDeleted (doesn't exist?) When you delete an album, there is no album path for the AlbumDeleted event: ``` === Debug Log Start === 2024-11-05 12:10:45 Event Type: AlbumDeleted All Environment Variables: "Boom Boom Pow" topped the Billboard Hot 100 for 12 weeks, making it the group's first number-one single on the chart. It is the second longest-running single to stay atop the chart in 2009, beaten only by their own "I Gotta Feeling", which held the top spot for 14 consecutive weeks. The song also topped the charts in Australia, Canada and the United Kingdom, as well as reaching the top ten in more than 20 countries. It was ranked atop the Billboard Hot 100 year-end chart for 2009, at number seven on the decade-end chart for the 2000s, and at number 51 on the all-time chart. As of 2015, it has sold over six million units in the US. COMPlus_EnableDiagnostics=0 Critically acclaimed, "Boom Boom Pow" was nominated for Best Dance Recording and won Best Short Form Music Video at the 52nd Annual Grammy Awards (2010). Rolling Stone ranked the song at number 14 on their list "Best 25 Songs of 2009". As of October 2023, the music video has over 487 million views on YouTube. DOCKER_MODS=ghcr.io/themepark-dev/theme.park:lidarr HOME=/root HOSTNAME=lidarr LSIO_FIRST_PARTY=true No_Expand=true No_PreLoadSQLite=true No_SQLiteFunctions=true No_SQLiteXmlConfigFile=true PATH=/command:/lsiopy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PGID=1000 PUID=1000 PWD=/app/lidarr/bin S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 S6_STAGE2_HOOK=/docker-mods S6_VERBOSITY=1 SHLVL=3 TERM=xterm TMPDIR=/run/lidarr-temp TP_THEME=overseerr TZ=America/Chicago VIRTUAL_ENV=/lsiopy XDG_CONFIG_HOME=/config/.config XDG_DATA_HOME=/config/.config/share _=/bin/printenv lidarr_album_id=10767 lidarr_album_mbid=39e68c14-7e31-33e7-9caf-e60058732adf lidarr_album_overview="Boom Boom Pow" is a song recorded by American group the Black Eyed Peas for their fifth studio album The E.N.D. (2009). It was written by group members will.i.am, apl.de.ap, Taboo and Fergie, being produced by will.i.am. The song features a vocal sample from the 1990 song "Reach Out" by British house duo Sweet Mercy featuring singer Rowetta. It was released as the lead single from The E.N.D. on February 22, 2009, by Interscope Records. lidarr_album_releasedate=05/05/2009 00:00:00 lidarr_album_title=Boom Boom Pow lidarr_applicationurl= lidarr_artist_deletedfiles=True lidarr_artist_genres=Dance-Pop|Electronic|Hip Hop|Pop|Pop Rap|West Coast Hip Hop lidarr_artist_id=486 lidarr_artist_mbid=d5be5333-4171-427e-8e12-732087c6b78e lidarr_artist_name=Black Eyed Peas lidarr_artist_path=/share/Music/Black Eyed Peas lidarr_artist_tags= lidarr_artist_type=Group lidarr_eventtype=AlbumDeleted lidarr_instancename=Lidarr === Debug Log End === ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Lidarr-Lidarr#3346
No description provided.