-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmake-episode.sh
executable file
·49 lines (38 loc) · 1.27 KB
/
make-episode.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
post=$1
today=$(date +%Y-%m-%d)
hhmmss=$(date +%H:%M:%S)
currdir=$(dirname $0)
cd ${currdir}
echo "current dir=$currdir"
if [ "$#" -eq 0 ]; then
echo "no post number passed, using info from radio-t.com"
post=$(./utils/get-next-rt.py)
fi
if [ "$#" -eq 2 ]; then
echo "date defined as $2"
today=$2
fi
currdir=`dirname $0`
cd ${currdir}
echo "current dir=$currdir"
echo "new post number=$post"
cd hugo
outfile="./content/posts/${today}-podcast-${post}.markdown"
echo '---' > ${outfile}
echo "title: \"После РТ $post\"" >> ${outfile}
echo "date: ${today}T${hhmmss}-05:00" >> ${outfile}
echo "slug: \"podcast-${post}\"" >> ${outfile}
echo "comments: true" >> ${outfile}
echo "categories: podcast" >> ${outfile}
echo "filename: rt${post}post" >> ${outfile}
echo '---' >> ${outfile}
echo "" >> ${outfile}
echo "[аудио](http://cdn.radio-t.com/rt${post}post.mp3) ● [лог чата](http://chat.radio-t.com/logs/radio-t-$post.html)" >> ${outfile}
echo "<audio src=\"http://cdn.radio-t.com/rt${post}post.mp3\" preload=\"none\"></audio>" >> ${outfile}
echo "deploy"
git add ${outfile}
cd ..
git commit -a -m "auto commit new episode ${post}" && git push
ssh master.radio-t.com "cd /srv/pirates && git pull && docker-compose run hugo"
echo "all done for ${post}"