##// END OF EJS Templates
using named keys and format string method + renaming VideoIframe to VideoIFrame
Eugene Van den Bulke -
Show More
@@ -6,7 +6,7 b' from os.path import exists, isfile, splitext, abspath, join, isdir'
6 from os import walk, sep
6 from os import walk, sep
7
7
8
8
9 class VideoIframe(object):
9 class VideoIFrame(object):
10 """
10 """
11 Generic class to embed videos in a iframe
11 Generic class to embed videos in a iframe
12 """
12 """
@@ -24,9 +24,12 b' class VideoIframe(object):'
24 params = "?" + urlencode(self.params)
24 params = "?" + urlencode(self.params)
25 else:
25 else:
26 params = ""
26 params = ""
27 return self.iframe % (self.width, self.height, self.id, params)
27 return self.iframe.format(width=self.width,
28 height=self.height,
29 id=self.id,
30 params=params)
28
31
29 class YouTubeVideo(VideoIframe):
32 class YouTubeVideo(VideoIFrame):
30 """Class for embedding a YouTube Video in an IPython session, based on its video id.
33 """Class for embedding a YouTube Video in an IPython session, based on its video id.
31
34
32 e.g. to embed the video on this page:
35 e.g. to embed the video on this page:
@@ -52,24 +55,24 b' class YouTubeVideo(VideoIframe):'
52
55
53 iframe = """
56 iframe = """
54 <iframe
57 <iframe
55 width="%i"
58 width="{width}"
56 height="%i"
59 height={height}"
57 src="http://www.youtube.com/embed/%s%s"
60 src="http://www.youtube.com/embed/{id}{params}"
58 frameborder="0"
61 frameborder="0"
59 allowfullscreen
62 allowfullscreen
60 ></iframe>
63 ></iframe>
61 """
64 """
62
65
63 class VimeoVideo(VideoIframe):
66 class VimeoVideo(VideoIFrame):
64 """
67 """
65 Class for embedding a Vimeo video in an IPython session, based on its video id.
68 Class for embedding a Vimeo video in an IPython session, based on its video id.
66 """
69 """
67
70
68 iframe = """
71 iframe = """
69 <iframe
72 <iframe
70 width = "%i"
73 width = "{width}"
71 height = "%i"
74 height = "{height}"
72 src="http://player.vimeo.com/video/%s%s"
75 src="http://player.vimeo.com/video/{id}{params}"
73 frameborder="0"
76 frameborder="0"
74 webkitAllowFullScreen
77 webkitAllowFullScreen
75 mozallowfullscreen
78 mozallowfullscreen
General Comments 0
You need to be logged in to leave comments. Login now