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.
Universal bash trick &&/||
Section titled “Universal bash trick &&/||”The simplest approach:
yt-dlp 'https://...' && \ notifly-send "✅ Скачивание готово" "$(basename "$PWD")" 5 || \ notifly-send "❌ Скачивание провалилось" "См. терминал" 8Or use the single wrapper notifly-run — it catches success and failure with duration and the tail of the log.
Long ffmpeg conversion
Section titled “Long ffmpeg conversion”notifly-run ffmpeg -i input.mkv -c:v libx264 -crf 20 -c:a aac out.mp4The notification will include the duration and the last lines of the ffmpeg log (usually frame=… and the final bitrate).
yt-dlp: batch downloading a playlist
Section titled “yt-dlp: batch downloading a playlist”yt-dlp --download-archive done.txt -i \ 'https://www.youtube.com/playlist?list=...' \&& notifly-send "✅ Плейлист готов" "$(wc -l < done.txt) файлов" 4Post-hook in yt-dlp
Section titled “Post-hook in yt-dlp”In ~/.config/yt-dlp/config:
--exec "echo {} | xargs -I{} ~/bin/notifly-send '🎬 Скачано' '{}' 4"Each downloaded file is a separate push.
wget with progress
Section titled “wget with progress”wget doesn’t have a built-in hook, but we run it inside a wrapper:
notifly-run wget -c 'https://example.com/huge.iso'rsync for large transfers
Section titled “rsync for large transfers”notifly-run rsync -aHAX --info=progress2 /home/me/photos /mnt/nas/photosConverting all .mkv files in a folder
Section titled “Converting all .mkv files in a folder”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 fidonenotifly-send "🏁 Партия готова" "Сконвертировано: $(ls *.mp4 | wc -l)" 5Windows: PowerShell Notifly-Run
Section titled “Windows: PowerShell Notifly-Run”An equivalent of &&/|| and notifly-run for Windows. Assumes a configured function Send-Notifly.
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 -Forceexit $rcUsage:
.\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 /MIRShortcut via alias in your PowerShell profile:
Set-Alias nrun C:\scripts\Notifly-Run.ps1nrun 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 5Benefits
Section titled “Benefits”- 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.
Further improvements
Section titled “Further improvements”- Send a link to the preview (video thumbnail or screenshot) in
extras["client::display"]. - Use priorities — fail = 8, success = 3.