Skip to content

Download completion notifications

Downloading a Blu-ray, converting video in ffmpeg, uploading a dump — tasks that take hours. You don’t want to sit at the terminal. Hook notifly-send to completion.

The simplest approach:

Окно терминала
yt-dlp 'https://...' && \
notifly-send "✅ Скачивание готово" "$(basename "$PWD")" 5 || \
notifly-send "❌ Скачивание провалилось" "См. терминал" 8

Or use the single wrapper notifly-run — it catches success and failure with duration and the tail of the log.

Окно терминала
notifly-run ffmpeg -i input.mkv -c:v libx264 -crf 20 -c:a aac out.mp4

The notification will include the duration and the last lines of the ffmpeg log (usually frame=… and the final bitrate).

Окно терминала
yt-dlp --download-archive done.txt -i \
'https://www.youtube.com/playlist?list=...' \
&& notifly-send "✅ Плейлист готов" "$(wc -l < done.txt) файлов" 4

In ~/.config/yt-dlp/config:

--exec "echo {} | xargs -I{} ~/bin/notifly-send '🎬 Скачано' '{}' 4"

Each downloaded file is a separate push.

wget doesn’t have a built-in hook, but we run it inside a wrapper:

Окно терминала
notifly-run wget -c 'https://example.com/huge.iso'
Окно терминала
notifly-run rsync -aHAX --info=progress2 /home/me/photos /mnt/nas/photos
Окно терминала
for f in *.mkv; do
out="${f%.mkv}.mp4"
if ffmpeg -nostdin -i "$f" -c:v libx264 -crf 22 -c:a aac "$out" </dev/null; then
notifly-send "$out" "Готов." 3
else
notifly-send "$f" "Ошибка ffmpeg." 7
fi
done
notifly-send "🏁 Партия готова" "Сконвертировано: $(ls *.mp4 | wc -l)" 5

An equivalent of &&/|| and notifly-run for Windows. Assumes a configured function Send-Notifly.

C:\scripts\Notifly-Run.ps1
param([Parameter(Mandatory, ValueFromRemainingArguments)] [string[]]$Cmd)
. $env:USERPROFILE\Documents\WindowsPowerShell\Notifly.ps1
$start = Get-Date
$log = New-TemporaryFile
$label = ($Cmd -join ' ').Substring(0, [Math]::Min(60, ($Cmd -join ' ').Length))
& $Cmd[0] $Cmd[1..($Cmd.Count-1)] *> $log
$rc = $LASTEXITCODE
$dur = ((Get-Date) - $start)
$tail = (Get-Content $log -Tail 12) -join "`n"
if ($rc -eq 0) {
Send-Notifly -Title "$label" `
-Message "Длительность: $($dur.ToString('hh\:mm\:ss'))`n`n$tail" `
-Priority 4
} else {
Send-Notifly -Title "$label (rc=$rc)" `
-Message "Длительность: $($dur.ToString('hh\:mm\:ss'))`n`n$tail" `
-Priority 8
}
Remove-Item $log -Force
exit $rc

Usage:

Окно терминала
.\Notifly-Run.ps1 yt-dlp 'https://www.youtube.com/playlist?list=...'
.\Notifly-Run.ps1 ffmpeg -i input.mkv -c:v libx264 -crf 20 -c:a aac out.mp4
.\Notifly-Run.ps1 robocopy C:\Photos D:\Backup\Photos /MIR

Shortcut via alias in your PowerShell profile:

Окно терминала
Set-Alias nrun C:\scripts\Notifly-Run.ps1
nrun yt-dlp 'https://...'

Batch convert .mkv.mp4:

Окно терминала
Get-ChildItem *.mkv | ForEach-Object {
$out = $_.BaseName + ".mp4"
nrun ffmpeg -nostdin -i $_.Name -c:v libx264 -crf 22 -c:a aac $out
}
Send-Notifly -Title "🏁 Партия готова" `
-Message "MP4-файлов: $((Get-ChildItem *.mp4).Count)" -Priority 5
  • Freedom from keeping a terminal tab open. You can close SSH/laptop and come back when the push arrives.
  • Metrics at hand. Duration, file size, status.
  • Task chains. One file downloaded → the next starts, and a push after each.
  • Send a link to the preview (video thumbnail or screenshot) in extras["client::display"].
  • Use priorities — fail = 8, success = 3.