1 """
2 MoinMoin - Create a list of OGV videos, using thumbnails from the attachment directories in which the videos are stored.
3
4 @copyright: 2011 Eric thrift
5 @license: GNU GPL, see COPYING for details.
6 """
7 import re
8 from MoinMoin import search, Page
9 Dependencies = ["language"]
10
11 def macro_RecentVideos(macro):
12 _ = macro.request.getText
13 result = ''
14
15 regex = re.compile(u'^V[0-9]*$', re.UNICODE)
16
17
18
19 filterfn = regex.search
20 videos = macro.request.rootpage.getPageList(filter=filterfn)
21 result = []
22 if videos:
23
24 videos.sort(reverse=True)
25 page = macro.formatter.page
26 result.append(macro.formatter.table(1, attrs={'width':'100%'}))
27
28
29 for video in videos[:40]:
30 result.append(macro.formatter.table_row(1))
31 videofile = video+"/"+video+".ogv"
32 thumbfile = video+"/"+video+".png"
33 srtfile = video+"/"+video+".srt"
34 thumblink = macro.formatter.attachment_image(thumbfile)
35
36
37 result.append(
38 macro.formatter.table_cell(1) +
39 macro.formatter.pagelink(1, video) +
40 thumblink +
41 macro.formatter.pagelink(0) +
42 macro.formatter.table_cell(0) +
43 macro.formatter.table_cell(1) +
44 video +
45 macro.formatter.bullet_list(1) +
46 macro.formatter.listitem(1) +
47 macro.formatter.pagelink(1, video) +
48 _("Description") +
49 macro.formatter.pagelink(0) +
50 macro.formatter.listitem(0) +
51 macro.formatter.listitem(1) +
52 macro.formatter.attachment_link(1, videofile) +
53 _("Video") +
54 macro.formatter.attachment_link(0) +
55 macro.formatter.listitem(0) +
56 macro.formatter.listitem(1) +
57 macro.formatter.attachment_link(1, srtfile) +
58 _("Transcript") +
59 macro.formatter.attachment_link(0) +
60 macro.formatter.listitem(0) +
61 macro.formatter.bullet_list(0) +
62 macro.formatter.table_cell(0) +
63 macro.formatter.table_row(0)
64 )
65
66 result.append(macro.formatter.table(0))
67 result = ''.join(result)
68 return result
MoinMoinCustomizations/RecentVideos.py (last edited 2011-09-07 14:32:56 by MandalWebHome)