#!/usr/bin/env bash

# https://sysadmin.pm/telegram-record-megamix/
# https://t.me/SysadminNotes

tlgToken="503225242:AAHTIQQxDGlyL6_Iju6ORuDOBj0stGbNyLo";
tlgUrl="https://api.telegram.org/bot$tlgToken";
tlgId="67605339";
rrDate=`date +%Y-%m-%d`;
rrIp="78.140.251.40";
rrmUrl="http://$rrIp/tmp_audio/itunes2/megamix_-_rr_$rrDate.mp3";
rrwUrl="http://$rrIp/tmp_audio/itunes2/wakeup_mix_-_rr_$rrDate.mp3";

if curl --output /dev/null --silent --head --fail "$rrmUrl"
 then
  curl --output /dev/null --silent "$tlgUrl/sendMessage?chat_id=$tlgId&parse_mode=HTML&text=💿 Вышел новый Megamix. <a href=\"$rrmUrl\">Скачать mp3.</a>";
fi

if curl --output /dev/null --silent --head --fail "$rrwUrl"
 then
  curl --output /dev/null --silent "$tlgUrl/sendMessage?chat_id=$tlgId&parse_mode=HTML&text=📀 Вышел новый Wakeupmix. <a href=\"$rrwUrl\">Скачать mp3.</a>";
fi

exit 0;

