##// 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 6 from os import walk, sep
7 7
8 8
9 class VideoIframe(object):
9 class VideoIFrame(object):
10 10 """
11 11 Generic class to embed videos in a iframe
12 12 """
@@ -24,9 +24,12 b' class VideoIframe(object):'
24 24 params = "?" + urlencode(self.params)
25 25 else:
26 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 33 """Class for embedding a YouTube Video in an IPython session, based on its video id.
31 34
32 35 e.g. to embed the video on this page:
@@ -52,24 +55,24 b' class YouTubeVideo(VideoIframe):'
52 55
53 56 iframe = """
54 57 <iframe
55 width="%i"
56 height="%i"
57 src="http://www.youtube.com/embed/%s%s"
58 width="{width}"
59 height={height}"
60 src="http://www.youtube.com/embed/{id}{params}"
58 61 frameborder="0"
59 62 allowfullscreen
60 63 ></iframe>
61 64 """
62 65
63 class VimeoVideo(VideoIframe):
66 class VimeoVideo(VideoIFrame):
64 67 """
65 68 Class for embedding a Vimeo video in an IPython session, based on its video id.
66 69 """
67 70
68 71 iframe = """
69 72 <iframe
70 width = "%i"
71 height = "%i"
72 src="http://player.vimeo.com/video/%s%s"
73 width = "{width}"
74 height = "{height}"
75 src="http://player.vimeo.com/video/{id}{params}"
73 76 frameborder="0"
74 77 webkitAllowFullScreen
75 78 mozallowfullscreen
General Comments 0
You need to be logged in to leave comments. Login now