Skip to content

Commit aff491d

Browse files
committed
Bring over w3c-ccg scripts
Much more customizeable bash scripts. Thanks @msporny and @kimdhamilton!
1 parent 219521a commit aff491d

File tree

4 files changed

+195
-40
lines changed

4 files changed

+195
-40
lines changed

publish.sh.example

Lines changed: 0 additions & 40 deletions
This file was deleted.

scripts/download-raw-minutes.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/sh
2+
#
3+
# Fetches the raw minutes for cleanup
4+
5+
display_usage() {
6+
echo "Downloads raw minutes and audio for CCG group meetings."
7+
echo ""
8+
echo "Usage: ./download-raw-minutes [-lh] [-d date]"
9+
echo " -d [YYYY-MM-DD] pass date argument"
10+
echo " -l launch audio and video editors programmatically"
11+
echo " -h display help"
12+
echo ""
13+
echo "Examples:"
14+
echo ""
15+
echo " ./download-raw-minutes"
16+
echo " downloads raw minutes and audio for the current date"
17+
echo ""
18+
echo " ./download-raw-minutes -d 2018-05-15"
19+
echo " downloads raw minutes and audio for 15 May 2018"
20+
}
21+
AUTO_LAUNCH=false
22+
CREATE_DIRECTORY=true
23+
24+
for i in "$@"
25+
do
26+
case $i in
27+
--)
28+
display_usage
29+
exit 0
30+
;;
31+
-h|--help)
32+
display_usage
33+
exit 0
34+
;;
35+
-l|--autolaunch)
36+
AUTO_LAUNCH=true
37+
shift
38+
;;
39+
-d|--date)
40+
shift
41+
DATE=$1
42+
break
43+
;;
44+
esac
45+
done
46+
47+
# Guess the date if it isn't set
48+
if [ -z "$DATE" ]; then
49+
DATE=`date +%Y-%m-%d`
50+
echo "No date argument supplied; using $DATE"
51+
fi
52+
53+
echo "....Downloading minutes for date=$DATE"
54+
echo "....Auto launch setting=$AUTO_LAUNCH"
55+
56+
# Get the editor commands
57+
. ./publishing.cfg
58+
59+
# Create the minutes directory if it doesn't already exist
60+
mkdir -p $DATE
61+
62+
# Download raw logs and recordings
63+
echo "....Downloading IRC logs for $DATE..."
64+
curl -# "https://w3c-ccg.s3.digitalbazaar.com/minutes/$DATE-irc.log" > $DATE/irc.log
65+
echo "....Downloading audio recording for $DATE..."
66+
curl -# "https://w3c-ccg.s3.digitalbazaar.com/minutes/$DATE-audio.wav" > $DATE/audio-raw.wav
67+
68+
echo "Download is finished! To finalize the minutes, clean up the minutes/audio and publish."
69+
70+
if [ "$AUTO_LAUNCH" = true ]; then
71+
# Edit the IRC log
72+
$EDITOR $DATE/irc.log &
73+
74+
# Edit the audio recording
75+
$WAV_EDITOR $DATE/audio-raw.wav &
76+
fi
77+
78+
# Print out directions on finalizing minutes
79+
echo " Instructions for editing minutes and audio:"
80+
echo " https://github.com/w3c-ccg/w3c-ccg.github.io/blob/master/irc_ref.md#edit"
81+
echo " Instructions for publishing:"
82+
echo " https://github.com/w3c-ccg/w3c-ccg.github.io/blob/master/irc_ref.md#publishing"
83+

scripts/publish.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
#
3+
# Generates minutes for the directory given
4+
5+
#!/bin/sh
6+
#
7+
# Fetches the raw minutes for cleanup
8+
9+
display_usage() {
10+
echo "Publish CCG minutes via email and social media."
11+
echo ""
12+
echo "Usage: ./publish [-h] [-d directory]"
13+
echo " -d [/path/to/YYYY-MM-DD] pass directory"
14+
echo " -h display help"
15+
echo ""
16+
echo "Examples:"
17+
echo ""
18+
echo " ./publish -d /path/to/w3c-ccg-meeting/2018-05-15"
19+
echo " previews 2018-05-15 minutes and audio in preview mode (does not broadcast results)"
20+
echo ""
21+
}
22+
23+
if [ $# -eq 0 ]
24+
then
25+
display_usage
26+
exit 1
27+
else
28+
for i in "$@"
29+
do
30+
case $i in
31+
--)
32+
display_usage
33+
exit 0
34+
;;
35+
-h|--help)
36+
display_usage
37+
exit 0
38+
;;
39+
-d|--directory)
40+
shift
41+
DIRECTORY=$1
42+
break
43+
;;
44+
esac
45+
done
46+
fi
47+
48+
echo "....Publishing minutes for directory=$DIRECTORY"
49+
50+
DATE="$(basename $DIRECTORY)"
51+
52+
source ../publishing.cfg
53+
54+
echo "Generating minutes and social media posts for $DATE"
55+
MESSAGE="Add text minutes and audio logs for $DATE telecon."
56+
57+
# Add default values for missing env vars
58+
if [ -z "$NODE_COMMAND" ]; then
59+
NODE_COMMAND="nodejs"
60+
fi
61+
62+
if [ -z "$SCRAWL_TO_EMAIL_ADDRESS" ]; then
63+
SCRAWL_TO_EMAIL_ADDRESS="public-credentials@w3.org"
64+
fi
65+
66+
67+
# Generate minutes
68+
$NODE_COMMAND index.js -d $DIRECTORY -m -i
69+
70+
# Make sure we want to continue
71+
read -r -p "Check for problems, press 'y' when ready to commit to git, tweet/email: " BROADCAST
72+
73+
echo "Broadcast: $BROADCAST"
74+
75+
if [ "$BROADCAST" != "y" ]
76+
then
77+
echo "Aborting git commit and social media broadcast."
78+
exit
79+
fi
80+
81+
git add $DIRECTORY/irc.log $DIRECTORY/index.html $DIRECTORY/audio.ogg
82+
git commit $DIRECTORY/irc.log $DIRECTORY/index.html $DIRECTORY/audio.ogg $DIRECTORY/../index.html -m "$MESSAGE"
83+
git push
84+
85+
# Generate G+ post summary
86+
# $NODE_COMMAND index.js -d $1 -w
87+
88+
# Email minutes
89+
$NODE_COMMAND index.js -d $DIRECTORY -e
90+
91+
# Tweet telecon results
92+
$NODE_COMMAND index.js -d $DIRECTORY -t

scripts/publishing.cfg.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
#
3+
# Example file for configuration options for publishing minutes
4+
5+
export EDITOR="/usr/bin/gedit"
6+
export WAV_EDITOR="/usr/bin/audacity"
7+
export NODE_COMMAND="nodejs"
8+
9+
export SCRAWL_EMAIL_USERNAME=
10+
export SCRAWL_EMAIL_PASSWORD=
11+
export SCRAWL_EMAIL_SERVER=
12+
# Optional port and SSL. Default SSL is false
13+
# export SCRAWL_EMAIL_PORT=
14+
# export SCRAWL_EMAIL_SSL=
15+
export SCRAWL_TWITTER_CONSUMER_KEY=
16+
export SCRAWL_TWITTER_SECRET=
17+
export SCRAWL_TWITTER_TOKEN_KEY=
18+
export SCRAWL_TWITTER_TOKEN_SECRET=
19+
export SCRAWL_LINKEDIN_CLIENT_ID=
20+
export SCRAWL_LINKEDIN_CLIENT_SECRET=

0 commit comments

Comments
 (0)