Skip to content

Commit e607848

Browse files
unknownunknown
unknown
authored and
unknown
committedJan 18, 2014
Added HTML templates to decouple UX from sync info
1 parent 322ca42 commit e607848

File tree

4 files changed

+37
-13
lines changed

4 files changed

+37
-13
lines changed
 

‎examples/README.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Goto "scipts" folder and run: python ../examples/template.html ../examples/sync.txt > ../examples/video_test.html

‎examples/sync.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
qBtfh0uxGM8
2+
0,"10701png/page_1.png","Welcome",1,
3+
77,"10701png/page_2.png","Administrative Stuff",1,
4+
80,"10701png/page_3.png", "Important Stuff",2,
5+
403,"10701png/page_4.png","Projects & Homeworks",2,
6+
637,"10701png/page_5.png","Color Coding",2,
7+
657,"10701png/page_6.png","Feedback",2,
8+
711,"10701png/page_7.png","Outline",1,
9+
792,"10701png/page_8.png","Who cares ? It is not indexed anyway",0,
10+
842,"10701png/page_9.png","Programming with data",1

‎web_ux/video_test.html ‎examples/template.html

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<!DOCTYPE html>
22
<html xmlns="http://www.w3.org/1999/xhtml">
33
<head>
4-
<script type="text/javascript" src="utube_slides.js"></script>
5-
<script type="text/javascript" src="swfobject/swfobject.js"></script>
4+
<script type="text/javascript" src="../web_ux/utube_slides.js"></script>
65
<script type="text/javascript">
76
function startPlayer() {
87
//Optional: set index style
@@ -13,18 +12,10 @@
1312

1413
//Optional: Set youtube player dimensions (default is 640x480)
1514
setVideoDims(640, 480);
16-
17-
initYoutubeAndSlides("qBtfh0uxGM8",
15+
initYoutubeAndSlides(
16+
"NOW_UC_SLIDES_VIDEO_ID",
1817
[
19-
0,"10701png/page_1.png","Welcome",1,
20-
77,"10701png/page_2.png","Administrative Stuff",1,
21-
80,"10701png/page_3.png", "Important Stuff",2,
22-
403,"10701png/page_4.png","Projects & Homeworks",2,
23-
637,"10701png/page_5.png","Color Coding",2,
24-
657,"10701png/page_6.png","Feedback",2,
25-
711,"10701png/page_7.png","Outline",1,
26-
792,"10701png/page_8.png","Who cares ? It is not indexed anyway",0,
27-
842,"10701png/page_9.png","Programming with data",1
18+
NOW_UC_SLIDES_SYNC
2819
]
2920
, "ytapiplayer"
3021
, "slidedisplay"

‎scripts/apply_template.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
3+
help_message = '''apply_template.py: Script to embed synchronization info into an HTML template
4+
Usage: python apply_template.py <template_file_name> <sync_info_file_name>'''
5+
6+
if len(sys.argv) != 3:
7+
print(sys.argv)
8+
print(help_message)
9+
exit()
10+
11+
f_template = open(sys.argv[1], 'r')
12+
f_sync = open(sys.argv[2], 'r')
13+
html = f_template.read()
14+
video_id = f_sync.readline().rstrip()
15+
sync = f_sync.read()
16+
17+
html = html.replace('NOW_UC_SLIDES_VIDEO_ID', video_id).replace('NOW_UC_SLIDES_SYNC', sync)
18+
19+
print(html)
20+
21+
f_template.close()
22+
f_sync.close()

0 commit comments

Comments
 (0)
Please sign in to comment.