mikenye / docker-youtube-dl

Youtube-DL container with all prerequisites (libav-tools, ffmpeg, rtmpdump, mplayer, mpv)
222 stars 42 forks source link

Feature: Email notification via SMTP #17

Open ghost opened 3 years ago

ghost commented 3 years ago

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.

mikenye commented 3 years ago

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?

ghost commented 3 years ago

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

mikenye commented 3 years ago

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 commented 3 years ago

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.

ghost commented 3 years ago

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.

mikenye commented 3 years ago

@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.

ghost commented 3 years ago

@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 commented 3 years ago

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

jamesmstone commented 6 months ago

you can send email with curl

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