blob: 0432a83b385247f3f07e75bc2792376acb791fcc
1 | #define LOG_TAG "CTvDimension" |
2 | |
3 | #include "CTvDimension.h" |
4 | #include "CTvProgram.h" |
5 | #include "CTvTime.h" |
6 | #include "CTvEvent.h" |
7 | #include "../tvconfig/tvconfig.h" |
8 | |
9 | /** |
10 | *TV ATSC rating dimension |
11 | */ |
12 | |
13 | void CTvDimension::createFromCursor(CTvDatabase::Cursor &c) |
14 | { |
15 | int col; |
16 | |
17 | col = c.getColumnIndex("db_id"); |
18 | this->id = c.getInt(col); |
19 | |
20 | col = c.getColumnIndex("index_j"); |
21 | this->indexj = c.getInt(col); |
22 | |
23 | col = c.getColumnIndex("rating_region"); |
24 | this->ratingRegion = c.getInt(col); |
25 | |
26 | col = c.getColumnIndex("graduated_scale"); |
27 | this->graduatedScale = c.getInt(col); |
28 | |
29 | col = c.getColumnIndex("name"); |
30 | this->name = c.getString(col); |
31 | |
32 | col = c.getColumnIndex("rating_region_name"); |
33 | this->ratingRegionName = c.getString(col); |
34 | |
35 | col = c.getColumnIndex("values_defined"); |
36 | this->valuesDefined = c.getInt(col); |
37 | this->lockValues = new int[valuesDefined]; |
38 | this->abbrevValues = new String8[valuesDefined]; |
39 | this->textValues = new String8[valuesDefined]; |
40 | char temp[256]; |
41 | for (int i = 0; i < valuesDefined; i++) { |
42 | sprintf(temp, "abbrev%d", i); |
43 | col = c.getColumnIndex(temp); |
44 | this->abbrevValues[i] = c.getString(col); |
45 | sprintf(temp, "text%d", i); |
46 | col = c.getColumnIndex(temp); |
47 | this->textValues[i] = c.getString(col); |
48 | sprintf(temp, "locked%d", i); |
49 | col = c.getColumnIndex(temp); |
50 | this->lockValues[i] = c.getInt(col); |
51 | } |
52 | |
53 | if (ratingRegion == REGION_US && !strcmp(name, "All")) { |
54 | isPGAll = true; |
55 | } else { |
56 | isPGAll = false; |
57 | } |
58 | } |
59 | |
60 | CTvDimension::CTvDimension(CTvDatabase::Cursor &c) |
61 | { |
62 | createFromCursor(c); |
63 | } |
64 | CTvDimension::CTvDimension() |
65 | { |
66 | |
67 | } |
68 | CTvDimension::~CTvDimension() |
69 | { |
70 | if (lockValues != NULL) { |
71 | delete []lockValues; |
72 | } |
73 | if (textValues != NULL) { |
74 | delete []textValues; |
75 | } |
76 | if (abbrevValues != NULL) { |
77 | delete []abbrevValues; |
78 | } |
79 | } |
80 | |
81 | /* 'All' is a very special case, it links to dimension0 & dimension5 */ |
82 | int CTvDimension::getUSPGAllLockStatus(String8 abbrev) |
83 | { |
84 | int len = 0; |
85 | CTvDimension dm5; |
86 | int j = 0; |
87 | selectByIndex(dm5, CTvDimension::REGION_US, 5); |
88 | len = dm5.getDefinedValue(); |
89 | String8 dm5Abbrev[len - 1]; |
90 | dm5.getAbbrev(dm5Abbrev); |
91 | for (j = 0; j < len - 1; j++) { |
92 | if (dm5Abbrev[j] == abbrev) { |
93 | return dm5.getLockStatus(j + 1); |
94 | } |
95 | } |
96 | CTvDimension dm0; |
97 | selectByIndex(dm0, CTvDimension::REGION_US, 0); |
98 | len = dm0.getDefinedValue(); |
99 | String8 dm0Abbrev[len - 1]; |
100 | dm0.getAbbrev(dm0Abbrev); |
101 | for (j = 0; j < len - 1; j++) { |
102 | if (dm0Abbrev[j] == abbrev) { |
103 | return dm0.getLockStatus(j + 1); |
104 | } |
105 | } |
106 | return -1; |
107 | } |
108 | |
109 | void CTvDimension::setUSPGAllLockStatus(String8 abbrev, int lock) |
110 | { |
111 | |
112 | int len = 0; |
113 | int j = 0; |
114 | |
115 | CTvDimension dm5; |
116 | |
117 | selectByIndex(dm5, REGION_US, 5); |
118 | len = dm5.getDefinedValue(); |
119 | String8 dm5Abbrev[len - 1]; |
120 | dm5.getAbbrev(dm5Abbrev); |
121 | |
122 | for (j = 0; j < len - 1; j++) { |
123 | if (abbrev == dm5Abbrev[j]) { |
124 | dm5.setLockStatus(j + 1, lock); |
125 | return; |
126 | } |
127 | } |
128 | |
129 | CTvDimension dm0; |
130 | selectByIndex(dm0, REGION_US, 0); |
131 | len = dm0.getDefinedValue(); |
132 | String8 dm0Abbrev[len - 1]; |
133 | dm0.getAbbrev(dm0Abbrev); |
134 | |
135 | for (j = 0; j < len - 1; j++) { |
136 | if (abbrev == dm0Abbrev[j]) { |
137 | dm0.setLockStatus(j + 1, lock); |
138 | return; |
139 | } |
140 | } |
141 | return; |
142 | } |
143 | |
144 | |
145 | |
146 | /** |
147 | *根据记录ID取得对应的TVDimension |
148 | *@param context 当前Context |
149 | *@param id 记录ID |
150 | *@return 返回ID对应的TVDimension对象 |
151 | */ |
152 | void CTvDimension::selectByID(CTvDimension &dm, int id) |
153 | { |
154 | String8 cmd = String8("select * from dimension_table where evt_table.db_id = ") + String8::format("%d", id); |
155 | CTvDatabase::Cursor c; |
156 | int ret = CTvDatabase::GetTvDb()->select(cmd, c); |
157 | |
158 | if (c.moveToFirst()) { |
159 | dm.createFromCursor(c); |
160 | LOGD("%s, %d success", "TV", __LINE__); |
161 | } else { |
162 | LOGD("%s, %d fail", "TV", __LINE__); |
163 | c.close(); |
164 | return; |
165 | } |
166 | c.close(); |
167 | |
168 | } |
169 | |
170 | /** |
171 | *根据记录ID取得对应的TVDimension |
172 | *@param context 当前Context |
173 | *@param ratingRegionID rating region ID |
174 | *@return 返回ID对应的TVDimension对象 |
175 | */ |
176 | void CTvDimension::selectByRatingRegion(CTvDimension &dm, int ratingRegionID) |
177 | { |
178 | String8 cmd = String8("select * from dimension_table where rating_region = ") + String8::format("%d", ratingRegionID); |
179 | CTvDatabase::Cursor c; |
180 | int ret = CTvDatabase::GetTvDb()->select(cmd, c); |
181 | |
182 | if (c.moveToFirst()) { |
183 | dm.createFromCursor(c); |
184 | LOGD("%s, %d success", "TV", __LINE__); |
185 | } else { |
186 | LOGD("%s, %d fail", "TV", __LINE__); |
187 | c.close(); |
188 | return; |
189 | } |
190 | c.close(); |
191 | } |
192 | |
193 | /** |
194 | *根据记录ID取得对应的TVDimension |
195 | *@param context 当前Context |
196 | *@param ratingRegionID rating region ID |
197 | *@param index RRT中对应的index_j |
198 | *@return 返回对应的TVDimension对象 |
199 | */ |
200 | int CTvDimension::selectByIndex(CTvDimension &dm, int ratingRegionID, int index) |
201 | { |
202 | String8 cmd = String8("select * from dimension_table where rating_region = ") + String8::format("%d", ratingRegionID); |
203 | cmd += String8(" and index_j=") + String8::format("%d", index); |
204 | CTvDatabase::Cursor c; |
205 | int ret = CTvDatabase::GetTvDb()->select(cmd, c); |
206 | |
207 | if (c.moveToFirst()) { |
208 | dm.createFromCursor(c); |
209 | LOGD("%s, %d success", "TV", __LINE__); |
210 | } else { |
211 | LOGD("%s, %d fail", "TV", __LINE__); |
212 | c.close(); |
213 | return -1; |
214 | } |
215 | c.close(); |
216 | |
217 | return 0; |
218 | } |
219 | |
220 | /** |
221 | *根据ID和名字取得对应的TVDimension |
222 | *@param context 当前Context |
223 | *@param ratingRegionID rating region ID |
224 | *@param dimensionName dimension的名称 |
225 | *@return 返回对应的TVDimension对象 |
226 | */ |
227 | void CTvDimension::selectByName(CTvDimension &dm, int ratingRegionID, String8 dimensionName) |
228 | { |
229 | String8 cmd = String8("select * from dimension_table where rating_region = ") + String8::format("%d", ratingRegionID); |
230 | cmd += String8(" and name='") + dimensionName + String8("'"); |
231 | CTvDatabase::Cursor c; |
232 | CTvDatabase::GetTvDb()->select(cmd, c); |
233 | |
234 | if (c.moveToFirst()) { |
235 | LOGD("%s, %d success", "TV", __LINE__); |
236 | dm.createFromCursor(c); |
237 | } else { |
238 | LOGD("%s, %d fail", "TV", __LINE__); |
239 | c.close(); |
240 | return; |
241 | } |
242 | c.close(); |
243 | |
244 | return; |
245 | } |
246 | |
247 | |
248 | /** |
249 | *判断指定rating_value是否需要block |
250 | *@param context 当前Context |
251 | *@param definedRating content_advisory_descr中定义的级别信息 |
252 | *@return 是否block |
253 | */ |
254 | bool CTvDimension::isBlocked(CTvDimension &dm, VChipRating *definedRating) |
255 | { |
256 | int ret = 0; |
257 | ret = selectByIndex(dm, definedRating->getRegion(), definedRating->getDimension()); |
258 | if (ret != -1) { |
259 | LOGD("%s, %d, index=%d", "TV", __LINE__, definedRating->getValue()); |
260 | return (dm.getLockStatus(definedRating->getValue()) == 1); |
261 | } |
262 | |
263 | return false; |
264 | } |
265 | |
266 | /** |
267 | *取得事件的ID |
268 | *@return 返回事件的ID |
269 | */ |
270 | int CTvDimension::getID() |
271 | { |
272 | return id; |
273 | } |
274 | |
275 | /** |
276 | *取得 rating region ID |
277 | *@return 返回 rating region ID |
278 | */ |
279 | int CTvDimension::getRatingRegion() |
280 | { |
281 | return ratingRegion; |
282 | } |
283 | |
284 | int CTvDimension::getDefinedValue() |
285 | { |
286 | return valuesDefined; |
287 | } |
288 | /** |
289 | *取得 rating region 名称 |
290 | *@return 返回 rating region 名称 |
291 | */ |
292 | String8 CTvDimension::getRatingRegionName() |
293 | { |
294 | return ratingRegionName; |
295 | } |
296 | |
297 | /** |
298 | *取得Dimension名称 |
299 | *@return 返回Dimension名称 |
300 | */ |
301 | String8 CTvDimension::getName() |
302 | { |
303 | return name; |
304 | } |
305 | |
306 | /** |
307 | *取得graduated scale标志 |
308 | *@return 返回graduated scale标志 |
309 | */ |
310 | int CTvDimension::getGraduatedScale() |
311 | { |
312 | return graduatedScale; |
313 | } |
314 | |
315 | /** |
316 | *取得该dimension的所有values的加锁状态 |
317 | *@return 返回所有values的加锁状态,0-未加锁,-1-无效值,即不能对该项进行设置,其他-已加锁 |
318 | */ |
319 | #if 0 |
320 | int *CTvDimension::getLockStatus() |
321 | { |
322 | int len = getDefinedValue(); |
323 | if (len > 1) { |
324 | if (isPGAll) { |
325 | return getUSPGAllLockStatus(abbrevValues); |
326 | } else { |
327 | int *lock = new int[len - 1]; |
328 | //System.arraycopy(lockValues, 1, l, 0, l.length); |
329 | for (int i = 0; i < len - 1; i++) |
330 | lock[i] = lockValues[1 + i]; |
331 | return lock; |
332 | } |
333 | } else { |
334 | return NULL; |
335 | } |
336 | } |
337 | #endif |
338 | /** |
339 | *取得该dimension的指定value的加锁状态 |
340 | *@param valueIndex value索引 |
341 | *@return 返回指定value的加锁状态,0-未加锁,-1-无效值,即不能对该项进行设置,其他-已加锁 |
342 | */ |
343 | int CTvDimension::getLockStatus(int valueIndex) |
344 | { |
345 | int len = getDefinedValue(); |
346 | if (valueIndex >= len) { |
347 | return -1; |
348 | } else { |
349 | return lockValues[valueIndex]; |
350 | } |
351 | } |
352 | |
353 | /** |
354 | *取得该dimension的指定几个values的加锁状态 |
355 | *@param abbrevs 需要获取的value的abbrev集合 |
356 | *@return 返回指定values的加锁状态,0-未加锁,-1-无效值,即不能对该项进行设置,其他-已加锁 |
357 | */ |
358 | void CTvDimension::getLockStatus(String8 abbrevs[], int lock[], int *array_len) |
359 | { |
360 | int i = 0; |
361 | int len = getDefinedValue(); |
362 | |
363 | if (abbrevs != NULL && lock != NULL) { |
364 | for (int i = 0; i < *array_len; i++) { |
365 | *(lock + i) = -1; |
366 | for (int j = 0; j < len; j++) { |
367 | if (abbrevs[i] == abbrevValues[j]) { |
368 | *(lock + i) = lockValues[j]; |
369 | break; |
370 | } |
371 | } |
372 | } |
373 | } |
374 | *array_len = len; |
375 | } |
376 | |
377 | /** |
378 | *取得该dimension的所有values的abbrev text |
379 | *@return 返回所有values的abbrev text |
380 | */ |
381 | int CTvDimension::getAbbrev(String8 abb[]) |
382 | { |
383 | /* the first rating_value must be not visible to user */ |
384 | int len = getDefinedValue(); |
385 | if (len > 1) { |
386 | for (int i = 0; i < len - 1; i++) |
387 | abb[i] = abbrevValues[i + 1]; |
388 | return 0; |
389 | } else { |
390 | return -1; |
391 | } |
392 | } |
393 | |
394 | /** |
395 | *取得该dimension指定value的abbrev text |
396 | *@return 返回abbrev text |
397 | */ |
398 | String8 CTvDimension::getAbbrev(int valueIndex) |
399 | { |
400 | int len = getDefinedValue(); |
401 | if (valueIndex >= len) |
402 | return String8(""); |
403 | else |
404 | return abbrevValues[valueIndex]; |
405 | } |
406 | |
407 | /** |
408 | *取得该dimension的所有values的value text |
409 | *@return 返回所有values的value text |
410 | */ |
411 | int CTvDimension::getText(String8 tx[]) |
412 | { |
413 | int len = getDefinedValue(); |
414 | if (len > 1) { |
415 | for (int i = 0; i < len - 1; i++) |
416 | tx[i] = textValues[i + 1]; |
417 | return 0; |
418 | } else { |
419 | return -1; |
420 | } |
421 | } |
422 | |
423 | /** |
424 | *取得该dimension指定value的value text |
425 | *@return 返回value text |
426 | */ |
427 | String8 CTvDimension::getText(int valueIndex) |
428 | { |
429 | int len = getDefinedValue(); |
430 | if (valueIndex >= len) |
431 | return String8(""); |
432 | else |
433 | return textValues[valueIndex]; |
434 | } |
435 | |
436 | /** |
437 | *设置指定value的加锁状态 |
438 | *@param valueIndex value索引 |
439 | *@param status 加锁状态 |
440 | */ |
441 | void CTvDimension::setLockStatus(int valueIndex, int status) |
442 | { |
443 | int len = getDefinedValue(); |
444 | if (valueIndex >= len) |
445 | return; |
446 | |
447 | if (lockValues[valueIndex] != -1 && lockValues[valueIndex] != status) { |
448 | lockValues[valueIndex] = status; |
449 | String8 cmd = String8("update dimension_table set locked") + String8::format("%d", valueIndex); |
450 | cmd += String8("=") + String8::format("%d", status) + String8(" where db_id = ") + String8::format("%d", id); |
451 | |
452 | CTvDatabase::GetTvDb()->exeSql(cmd.string()); |
453 | } |
454 | } |
455 | |
456 | /** |
457 | *设置该dimension所有values的加锁状态 |
458 | *@param status 加锁状态 |
459 | */ |
460 | void CTvDimension::setLockStatus(int status[]) |
461 | { |
462 | int len = getDefinedValue(); |
463 | if (status == NULL) { |
464 | LOGD("Cannot set lock status, invalid param"); |
465 | return; |
466 | } |
467 | for (int i = 0; i < len; i++) { |
468 | setLockStatus(i + 1, status[i]); |
469 | } |
470 | } |
471 | |
472 | /** |
473 | *设置指定values的加锁状态 |
474 | *@param abbrevs abbrev集合 |
475 | *@param locks 需要修改的与abbrev对应的加锁状态集合 |
476 | */ |
477 | void CTvDimension::setLockStatus(String8 abbrevs[], int locks[], int abb_size) |
478 | { |
479 | int len = getDefinedValue(); |
480 | if (abbrevs == NULL || locks == NULL) |
481 | return; |
482 | |
483 | for (int i = 0; i < abb_size; i++) { |
484 | for (int j = 0; j < len; j++) { |
485 | if (abbrevs[i] == abbrevValues[j]) { |
486 | setLockStatus(j, locks[i]); |
487 | break; |
488 | } |
489 | } |
490 | } |
491 | } |
492 | |
493 | CTvDimension::VChipRating::VChipRating(int region, int dimension, int value) |
494 | { |
495 | this->region = region; |
496 | this->dimension = dimension; |
497 | this->value = value; |
498 | } |
499 | CTvDimension::VChipRating::VChipRating() |
500 | { |
501 | } |
502 | |
503 | CTvDimension::VChipRating::~VChipRating() |
504 | { |
505 | } |
506 | int CTvDimension::VChipRating::getRegion() |
507 | { |
508 | return region; |
509 | } |
510 | |
511 | int CTvDimension::VChipRating::getDimension() |
512 | { |
513 | return dimension; |
514 | } |
515 | |
516 | int CTvDimension::VChipRating::getValue()const |
517 | { |
518 | return value; |
519 | } |
520 | |
521 | String8 CTvDimension::getCurdimension() |
522 | { |
523 | return CurvchipDimension; |
524 | } |
525 | String8 CTvDimension::getCurAbbr() |
526 | { |
527 | return CurvchipAbbrev; |
528 | |
529 | } |
530 | String8 CTvDimension::getCurText() |
531 | { |
532 | return CurvchipText; |
533 | } |
534 | |
535 | void CTvDimension::insertNewDimension(const int region, String8 regionName, String8 name, |
536 | int indexj, int *lock, const char **abbrev, const char **text, int size) |
537 | { |
538 | String8 cmd = String8("insert into dimension_table(rating_region,rating_region_name,name,graduated_scale,"); |
539 | cmd += String8("values_defined,index_j,version,abbrev0,text0,locked0,abbrev1,text1,locked1,abbrev2,text2,locked2,"); |
540 | cmd += String8("abbrev3,text3,locked3,abbrev4,text4,locked4,abbrev5,text5,locked5,abbrev6,text6,locked6,"); |
541 | cmd += String8("abbrev7,text7,locked7,abbrev8,text8,locked8,abbrev9,text9,locked9,abbrev10,text10,locked10,"); |
542 | cmd += String8("abbrev11,text11,locked11,abbrev12,text12,locked12,abbrev13,text13,locked13,abbrev14,text14,locked14,"); |
543 | cmd += String8("abbrev15,text15,locked15) values(") + String8::format("%d", region) + String8(",'") + regionName.string(); |
544 | cmd += String8("','") + name.string() + String8("',0,") + String8::format("%d", size) + String8(",") + String8::format("%d", indexj) + String8(",0"); |
545 | for (int i = 0; i < 16; i++) { |
546 | if (i < size) { |
547 | cmd += String8(",'") + String8::format("%s", abbrev[i]) + String8("'"); |
548 | cmd += String8(",'") + String8::format("%s", text[i]) + String8("'"); |
549 | cmd += String8(",'") + String8::format("%d", lock[i]) + String8("'"); |
550 | } else { |
551 | cmd += String8(",''"); |
552 | cmd += String8(",''"); |
553 | cmd += String8(",-1"); |
554 | } |
555 | } |
556 | cmd += String8(")"); |
557 | CTvDatabase::GetTvDb()->exeSql(cmd.string()); |
558 | } |
559 | /** |
560 | * ??????Standard ATSC V-Chip Dimensions |
561 | */ |
562 | void CTvDimension::builtinAtscDimensions() |
563 | { |
564 | CTvDatabase::GetTvDb()->exeSql("delete from dimension_table"); |
565 | |
566 | /* Add U.S. Rating region 0x1 */ |
567 | const char *abbrev0[] = {"", "None", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
568 | const char *text0[] = {"", "None", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
569 | int lock0[] = { -1, -1, 0, 0, 0, 0}; |
570 | const char *abbrev1[] = {"", "D", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
571 | const char *text1[] = {"", "D", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
572 | int lock1[] = { -1, -1, -1, 0, 0, -1}; |
573 | const char *abbrev2[] = {"", "L", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
574 | const char *text2[] = {"", "L", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
575 | int lock2[] = { -1, -1, -1, 0, 0, 0}; |
576 | const char *abbrev3[] = {"", "S", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
577 | const char *text3[] = {"", "S", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
578 | int lock3[] = { -1, -1, -1, 0, 0, 0}; |
579 | const char *abbrev4[] = {"", "V", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
580 | const char *text4[] = {"", "V", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
581 | int lock4[] = { -1, -1, -1, 0, 0, 0}; |
582 | const char *abbrev5[] = {"", "TV-Y", "TV-Y7"}; |
583 | const char *text5[] = {"", "TV-Y", "TV-Y7"}; |
584 | int lock5[] = { -1, 0, 0}; |
585 | const char *abbrev6[] = {"", "FV", "TV-Y7"}; |
586 | const char *text6[] = {"", "FV", "TV-Y7"}; |
587 | int lock6[] = { -1, -1, 0}; |
588 | const char *abbrev7[] = {"", "N/A", "G", "PG", "PG-13", "R", "NC-17", "X", "NR"}; |
589 | const char *text7[] = {"", "MPAA Rating Not Applicable", "Suitable for AllAges", |
590 | "Parental GuidanceSuggested", "Parents Strongly Cautioned", |
591 | "Restricted, under 17 must be accompanied by adult", |
592 | "No One 17 and Under Admitted", "No One 17 and Under Admitted", |
593 | "no Rated by MPAA" |
594 | }; |
595 | int lock7[] = { -1, -1, 0, 0, 0, 0, 0, 0, 0}; |
596 | /*Extra for 'All' */ |
597 | const char *abbrevall[] = {"TV-Y", "TV-Y7", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
598 | const char *textall[] = {"TV-Y", "TV-Y7", "TV-G", "TV-PG", "TV-14", "TV-MA"}; |
599 | int lockall[] = {0, 0, 0, 0, 0, 0}; |
600 | |
601 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
602 | String8("Entire Audience"), 0, lock0, abbrev0, text0, sizeof(lock0) / sizeof(int)); |
603 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
604 | String8("Dialogue"), 1, lock1, abbrev1, text1, sizeof(lock1) / sizeof(int)); |
605 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
606 | String8("Language"), 2, lock2, abbrev2, text2, sizeof(lock2) / sizeof(int)); |
607 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
608 | String8("Sex"), 3, lock3, abbrev3, text3, sizeof(lock3) / sizeof(int)); |
609 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
610 | String8("Violence"), 4, lock4, abbrev4, text4, sizeof(lock4) / sizeof(int)); |
611 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
612 | String8("Children"), 5, lock5, abbrev5, text5, sizeof(lock5) / sizeof(int)); |
613 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
614 | String8("Fantasy violence"), 6, lock6, abbrev6, text6, sizeof(lock6) / sizeof(int)); |
615 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
616 | String8("MPAA"), 7, lock7, abbrev7, text7, sizeof(lock7) / sizeof(int)); |
617 | insertNewDimension(CTvDimension::REGION_US, String8("US (50 states + possessions)"), |
618 | String8("All"), -1, lockall, abbrevall, textall, sizeof(lockall) / sizeof(int)); |
619 | /* Add Canadian Rating region 0x2 */ |
620 | const char *cabbrev0[] = {"E", "C", "C8+", "G", "PG", "14+", "18+"}; |
621 | const char *ctext0[] = {"Exempt", "Children", "8+", "General", "PG", "14+", "18+"}; |
622 | int clock0[] = {0, 0, 0, 0, 0, 0, 0}; |
623 | const char *cabbrev1[] = {"E", "G", "8 ans+", "13 ans+", "16 ans+", "18 ans+"}; |
624 | const char *ctext1[] = {"Exempt??es", "Pour tous", "8+", "13+", "16+", "18+"}; |
625 | int clock1[] = {0, 0, 0, 0, 0, 0}; |
626 | |
627 | insertNewDimension(CTvDimension::REGION_CANADA, String8("Canada"), |
628 | String8("Canadian English Language Rating"), 0, clock0, cabbrev0, ctext0, sizeof(clock0) / sizeof(int)); |
629 | insertNewDimension(CTvDimension::REGION_CANADA, String8("Canada"), |
630 | String8("Codes francais du Canada"), 1, clock1, cabbrev1, ctext1, sizeof(clock1) / sizeof(int)); |
631 | } |
632 | |
633 | int CTvDimension::isDimensionTblExist() |
634 | { |
635 | String8 cmd = String8("select * from dimension_table"); |
636 | CTvDatabase::Cursor c; |
637 | CTvDatabase::GetTvDb()->select(cmd, c); |
638 | return c.moveToFirst(); |
639 | } |
640 |