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