-
Notifications
You must be signed in to change notification settings - Fork 42
/
gen-vid-list
executable file
·29 lines (22 loc) · 925 Bytes
/
gen-vid-list
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
#!/bin/bash
# Get all of the YouTube playlists from the gatherings then get the
# info for each video from YouTube.
#
# A valid YouTube API key is required by fetch_gathering_videos.rb.
# Set YT_API_KEY environment variable to the API key.
PLAYLISTS="videos.yml"
# Scan all of the gatherings and get a list of the files that have YouTube playlists.
FILES=`find ./src/content/gatherings/ -name index.mdx -exec grep -l youtube_playlist_id {} \;`
# Now create the gatherings list containing title, date, and youtube_playlist_id to feed to the
# next section.
echo -e "---\ngatherings:" > $PLAYLISTS
for f in $FILES
do
TITLE=`egrep "^title: " $f`
DATE=`egrep "^date: " $f`
PLAYLIST=`egrep "^youtube_playlist_id: " $f`
echo -e " - $TITLE\n $DATE\n $PLAYLIST" >> $PLAYLISTS
done
echo -e "---" >> $PLAYLISTS
# Run the Ruby script that will get the info for each video from YouTube.
./fetch_gathering_videos.rb