-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-ep.sh
195 lines (167 loc) · 4.37 KB
/
new-ep.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
## title: Generate Show Page
## description: This script will generate a show page for the podcast
## author: Sam Greenwood
## date: 2023-06-05
## version: beta 0.1
## usage: ./generate-show-page.sh
## bash_version: 5.0.17(1)-release
## license: MIT License
## Generate Show Notes
echo "---"
echo "Date: \"$(date --utc +%FT%TZ)\""
## Get the description from user input
echo "Description: \"$(read -p "Description: " desc; echo $desc)\""
## Prompt for the title
echo "Title: \"$(read -p "Title: " title; echo $title)\""
## prompt for episode number
echo "episode: \"$(read -p "Episode: " episode; echo $episode)\""
## prompt for image
echo "image: \"$(read -p "Image: " image; echo $image)\""
## prompt for explicit (select from yes/no in menu bash)
PS3='Explicit? ' # Sets the menu prompt
select explicit in yes no # Creates a menu from the choices in the select statement
do
case $explicit in # The case statement then selects the appropriate option.
yes)
echo "explicit: \"yes\"" # This is displayed if "yes" is selected.
break
;;
no)
echo "explicit: \"no\"" # This is displayed if "no" is selected.
break
;;
*)
echo "invalid option $REPLY" # This is displayed if an invalid option is selected.
;;
esac
done
## prompt for hosts
echo "hosts:" # This is displayed if an invalid option is selected.
while true; do
read -p "Host: " host # This is displayed if an invalid option is selected.
if [[ -z "$host" ]]; then## title: Generate Show Page
## description: This script will generate a show page for the podcast
## author: Sam Greenwood
## date: 2023-06-05
## version: beta 0.1
## usage: ./generate-show-page.sh
## bash_version: 5.0.17(1)-release
## license: MIT License
## file shuld be created in /home/sam/samgoesbts.com/content/episodes/episde_create.md
## Generate Show Notes
echo "---"
echo "Date: \"$(date --utc +%FT%TZ)\""
## Get the description from user input
echo "Description: \"$(read -p "Description: " desc; echo $desc)\""
## Prompt for the title
echo "Title: \"$(read -p "Title: " title; echo $title)\""
## save title as contigous variable with dashes instead of spaces
title=$(echo $title | sed -e 's/ /-/g' | tr '[:upper:]' '[:lower:]')
## prompt for episode number
echo "episode: \"$(read -p "Episode: " episode; echo $episode)\""
## prompt for image
echo "image: \"$(read -p "Image: " image; echo $image)\""
## prompt for explicit (select from yes/no in menu bash)
PS3='Explicit? '
select explicit in yes no
do
case $explicit in
yes)
echo "explicit: \"yes\""
break
;;
no)
echo "explicit: \"no\""
break
;;
*)
echo "invalid option $REPLY"
;;
esac
done
## prompt for hosts
echo "hosts:"
while true; do
read -p "Host: " host
if [[ -z "$host" ]]; then
break
fi
echo " - $host"
done
## prompt for path to images
echo "images:"
while true; do
read -p "Image: " image
if [[ -z "$image" ]]; then
break
fi
echo " - $image"
done
## prompt for series
echo "series:"
while true; do
read -p "Series: " series
if [[ -z "$series" ]]; then
break
fi
echo " - $series"
done
## prompt for tags
echo "tags:"
while true; do
read -p "Tag: " tag
if [[ -z "$tag" ]]; then
break
fi
echo " - $tag"
done
## prompt for youtube video
echo "youtube: $(read -p "YouTube: " youtube; echo $youtube)"
break
fi
echo " - $host"
done
## prompt for path to images
echo "images:"
while true; do
read -p "Image: " image
if [[ -z "$image" ]]; then
break
fi
echo " - $image"
done
## prompt for series
echo "series:"
while true; do
read -p "Series: " series
if [[ -z "$series" ]]; then
break
fi
echo " - $series"
done
## prompt for tags
echo "tags:"
while true; do
read -p "Tag: " tag
if [[ -z "$tag" ]]; then
break
fi
echo " - $tag"
done
## prompt for youtube video
echo "youtube: $(read -p "YouTube: " youtube; echo $youtube)"
## end of file
echo "---"
## Print out the variables to the user in simple command line format
echo "Title: $title"
echo "Description: $desc"
echo "Episode: $episode"
echo "Image: $image"
echo "Explicit: $explicit"
echo "Hosts: $host"
echo "Images: $image"
echo "Series: $series"
echo "Tags: $tag"
echo "YouTube: $youtube"
## create file
touch /home/sam/samgoesbts.com/content/episodes/$title.md