docker-youtube-dl icon indicating copy to clipboard operation
docker-youtube-dl copied to clipboard

Feature: Email notification via SMTP

Open ghost opened this issue 4 years ago • 9 comments

Hello @mikenye

I have idea if possible to add feature Email notification via SMTP whenever new videos are downloaded which can include list of videos newly downloaded.

Thanks. Have a good day.

ghost avatar Jan 01 '21 07:01 ghost

Hi @krswin,

This is somewhat outside the scope of this project, as this project simply aims to containerise youtube-dl. The functionality should come from youtube-dl, as I'd have to write something to determine what's been added...

Looking at youtube-dl's documentation, there is an --exec argument:

--exec CMD                       Execute a command on the file after
                                 downloading and post-processing, similar to
                                 find's -exec syntax. Example: --exec 'adb
                                 push {} /sdcard/Music/ && rm {}'

I could add a tool such as curl to the container, which would enable you to configure an --exec argument to trigger a webhook on a service such as Discord or Slack etc, so that you are alerted when a video is downloaded.

Would that be an acceptable compromise?

mikenye avatar Jan 01 '21 08:01 mikenye

ok thanks. it would be good to have simple smtp email notification. I will try to find out the solution. have a good day. :)

ghost avatar Jan 06 '21 19:01 ghost

I'll leave the issue open - if I have some free time I'll take a look into it. You have a good day too. :)

mikenye avatar Jan 07 '21 12:01 mikenye

I've started working on this. Would a webhook suffice? There seem to be a number of services that will do webhook to email, or you could use Discord/Slack/Teams/etc as they all support webhooks. Let me know. Thanks.

mikenye avatar Jan 08 '21 14:01 mikenye

Thanks for your help. If you want webhook yes its good but i don’t have this apps you mentioned. I am using just normal email server with SMTP. So if possible please also add possibility to send email using SMTP. Thanks.

I found easy guide for SMTP client for linux terminal.

https://linuxhandbook.com/linux-send-email-ssmtp/

its good to give configuration in Docker compose. Thanks.

ghost avatar Jan 08 '21 17:01 ghost

@krswin do you have an example log file where there are a mixture of videos that already exist, and some new videos have been downloaded? I'm looking for log output I can trigger alerts based on. Thanks.

mikenye avatar Jan 15 '21 03:01 mikenye

@mikenye Hi What do you think about just scanning download folder for downloaded files with created or modified date with todays date and then read file name put it in to the list and send as email. Thanks.

If you still want logs i need find a way to generate it and then i can send. Just let me know. Thanks.

ghost avatar Jan 15 '21 03:01 ghost

may be this can help you for getting list of todays videos in terminal find /path/to/downloads* -mtime +0

ghost avatar Feb 22 '21 03:02 ghost

you can send email with curl

https://everything.curl.dev/usingcurl/smtp

jamesmstone avatar Feb 28 '24 08:02 jamesmstone