-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathpreload.cpp
129 lines (121 loc) · 3.6 KB
/
preload.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include "preload.h"
#include "filecache.h"
#include <vdr/tools.h>
namespace vdrlive {
// to get an updated list of these files do:
// (cd live; find * -type f ! -wholename '*CVS*' ! -wholename '*themes*' ! -name '*~' ! -name '.*') | awk '{print "\"" $1 "\","}'
// and clean out unneeded entries.
void PreLoadFileCache(std::string const& configDir)
{
static char const * const preloadFiles[] = {
"css/siteprefs.css",
"css/styles.css",
"img/rounded-box-blue-bl.png",
"img/rounded-box-blue-br.png",
"img/rounded-box-blue-ml.png",
"img/rounded-box-blue-mr.png",
"img/rounded-box-blue-tr.png",
"img/rounded-box-green-bl.png",
"img/rounded-box-blue-tl.png",
"img/rounded-box-green-br.png",
"img/rounded-box-green-ml.png",
"img/rounded-box-green-mr.png",
"img/del.png",
"img/info-win-t-r.png",
"img/info-win-m-l.png",
"img/info-win-m-r.png",
"img/info-win-b-l.png",
"img/info-win-b-r.png",
"img/close_red.png",
"img/info-win-t-l.png",
"img/rounded-box-green-tl.png",
"img/rounded-box-green-tr.png",
"img/rounded-box-orange-bl.png",
"img/rounded-box-orange-br.png",
"img/rounded-box-orange-ml.png",
"img/rounded-box-orange-mr.png",
"img/rounded-box-orange-tl.png",
"img/rounded-box-orange-tr.png",
"img/active.png",
"img/arrow.png",
"img/bg_box_h.png",
"img/bg_box_l.png",
"img/bg_box_r.png",
"img/bg_header_h.png",
"img/bg_header_l.png",
"img/bg_header_r.png",
"img/bg_line.png",
"img/bg_line_top.png",
"img/bg_tools.png",
"img/button_blue.png",
"img/button_green.png",
"img/button_new.png",
"img/button_red.png",
"img/button_yellow.png",
"img/close.png",
"img/edit.png",
"img/ffw.png",
"img/file.png",
"img/folder_closed.png",
"img/folder_open.png",
"img/help.png",
"img/imdb.png",
"img/inactive.png",
"img/logo_login.png",
"img/logo.png",
"img/menu_line_bg.png",
"img/minus.png",
"img/movie.png",
"img/on_dvd.png",
"img/one_downarrow.png",
"img/one_uparrow.png",
"img/pause.png",
"img/play.png",
"img/plus.png",
"img/record.png",
"img/record_timer.png",
"img/recording_timer.gif",
"img/reload.png",
"img/rwd.png",
"img/search.png",
"img/stop.png",
"img/stop_update.png",
"img/transparent.png",
"img/zap.png",
"img/remotecontrol.jpg",
"img/tv.jpg",
"img/arrow_rec.gif",
"img/favicon.ico",
"img/playlist.png",
"img/sd.png",
"img/hd.png",
"img/rd.png",
"img/RecordingErrors.png",
"img/NoRecordingErrors.png",
"img/NotCheckedForRecordingErrors.png",
"js/live/browserwin.js",
"js/live/vdr_status.js",
"js/live/infowin.js",
"js/live/header.js",
"js/live/liveajax.js",
"js/live/hinttips.js",
"js/live/pageenhance.js",
"js/live/createHtml.js",
"js/live/epg_tt_box.js",
"js/live/treeview.js",
"js/mootools/mootools.v1.11.js",
"html/back.html",
0
};
FileCache& fc = LiveFileCache();
size_t i = 0;
while (preloadFiles[i]) {
FileCache::ptr_type f = fc.get(configDir + "/" + preloadFiles[i]);
if (0 == f.get()) {
isyslog("live: can't preload %s/%s! Generated pages might be degraded!", configDir.c_str(), preloadFiles[i]);
}
i++;
}
isyslog("live: initial file cache has %zu entries and needs %zu bytes of data!", fc.count(), fc.weight());
}
}