summaryrefslogtreecommitdiff
path: root/devfiles/scripts
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2013-11-20 22:24:40 -0800
committerJesse Morgan <jesse@jesterpm.net>2013-11-20 22:30:02 -0800
commit4056997543c7bf17704baf6951cb7af538b55206 (patch)
tree038d268948cb689590d08ddb4079765d7f4210b9 /devfiles/scripts
parent9688b6bf00ab1c66868609a86d1d2fce0aad2d7e (diff)
Adding webm formatted videos
Diffstat (limited to 'devfiles/scripts')
-rwxr-xr-xdevfiles/scripts/videos-from-csv.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/devfiles/scripts/videos-from-csv.py b/devfiles/scripts/videos-from-csv.py
index ce4874c..2f1ad94 100755
--- a/devfiles/scripts/videos-from-csv.py
+++ b/devfiles/scripts/videos-from-csv.py
@@ -18,7 +18,8 @@ def mkjson(chapter, number, title, length, image, pdf, videos):
"pdf": "$pdf",
"urls": [""")
- urltemplate = Template("""{"src":"$src", "type":"$type"},""")
+ # NB we seek backwards to trim the comma after the loop
+ urltemplate = Template("""{"src":"$src", "type":"$type"},\n""")
directory = string.lower("videos/" + chapter)
try:
@@ -37,7 +38,7 @@ def mkjson(chapter, number, title, length, image, pdf, videos):
for type,src in videos.iteritems():
outfile.write(urltemplate.substitute(dict(type=type, src=BASE_URL + urllib.quote(src))))
- outfile.seek(-1, 2)
+ outfile.seek(-2, 2)
outfile.write("]\n}")
# This script reads lines from the given csv file and creates json files for
@@ -54,8 +55,9 @@ with open(filename, 'rb') as csvfile:
image = row[4]
pdf = row[5]
h264 = row[6]
+ webm = row[7]
- videos = { "video/mp4": h264 }
+ videos = { "video/mp4": h264, "video/webm": webm }
mkjson(chapter, number, title, length, image, pdf, videos)