Ticket #8777: dish_descriptors5.diff
File dish_descriptors5.diff, 10.2 KB (added by , 14 years ago) |
---|
-
libs/libmythtv/eitfixup.cpp
7 7 #include "channelutil.h" // for GetDefaultAuthority() 8 8 9 9 #include "programinfo.h" // for subtitle types and audio and video properties 10 #include "dishdescriptors.h" // for dish_theme_type_to_string 10 11 11 12 /*------------------------------------------------------------------------ 12 13 * Event Fix Up Scripts - Turned on by entry in dtv_privatetype table … … 15 16 EITFixUp::EITFixUp() 16 17 : m_bellYear("[\\(]{1}[0-9]{4}[\\)]{1}"), 17 18 m_bellActors("\\set\\s|,"), 19 m_bellPPVTitleAllDayHD("\\s*\\(All Day\\, HD\\)\\s*$"), 18 20 m_bellPPVTitleAllDay("\\s*\\(All Day.*\\)\\s*$"), 19 21 m_bellPPVTitleHD("^HD\\s?-\\s?"), 20 m_bellPPVSubtitleAllDay("^All Day \\(.*\\sEastern\\) $"),22 m_bellPPVSubtitleAllDay("^All Day \\(.*\\sEastern\\)\\s*$"), 21 23 m_bellPPVDescriptionAllDay("^\\(.*\\sEastern\\)"), 22 24 m_bellPPVDescriptionAllDay2("^\\([0-9].*am-[0-9].*am\\sET\\)"), 23 25 m_bellPPVDescriptionEventId("\\([0-9]{5}\\)"), 26 m_dishPPVTitleHD("\\sHD\\s*$"), 27 m_dishPPVTitleColon("\\:\\s*$"), 28 m_dishPPVSpacePerenEnd("\\s\\)\\s*$"), 29 m_dishDescriptionNew("\\s*New\\.\\s*"), 30 m_dishDescriptionFinale("\\s*(Series|Season)\\sFinale\\.\\s*"), 31 m_dishDescriptionFinale2("\\s*Finale\\.\\s*"), 32 m_dishDescriptionPremiere("\\s*(Series|Season)\\s(Premier|Premiere)\\.\\s*"), 33 m_dishDescriptionPremiere2("\\s*(Premier|Premiere)\\.\\s*"), 34 m_dishPPVCode("\\s*\\(([A-Z]|[0-9]){5}\\)\\s*$"), 24 35 m_ukThen("\\s*(Then|Followed by) 60 Seconds\\.", Qt::CaseInsensitive), 25 36 m_ukNew("(New\\.|\\s*(Brand New|New)\\s*(Series|Episode)\\s*[:\\.\\-])",Qt::CaseInsensitive), 26 37 m_ukCEPQ("[:\\!\\.\\?]"), … … 127 138 if (kFixBell & event.fixup) 128 139 FixBellExpressVu(event); 129 140 141 if (kFixDish & event.fixup) 142 FixBellExpressVu(event); 143 130 144 if (kFixUK & event.fixup) 131 145 FixUK(event); 132 146 … … 244 258 // you come up with an odd category 245 259 if (position < 10) 246 260 { 247 const QString stmp = event.description;248 event.description = stmp.right(stmp.length() - position - 2);249 event.category = stmp.left(position);250 261 } 251 262 else 252 263 { 253 264 event.category = "Unknown"; 254 265 } 255 266 256 // When a channel is off air the category is "-" 257 // so leave the category as blank 258 if (event.category == "-") 259 event.category = "OffAir"; 267 // If the content descriptor didn't come up with anything, try parsing the category 268 // out of the description. 269 if (event.category == "") 270 { 271 // Take out the content description which is 272 // always next with a period after it 273 position = event.description.indexOf("."); 274 if ((position + 1) < event.description.length()) 275 position = event.description.indexOf(". "); 276 // Make sure they didn't leave it out and 277 // you come up with an odd category 278 if ((position > -1) && position < 20) 279 { 280 const QString stmp = event.description; 281 event.description = stmp.right(stmp.length() - position - 2); 282 event.category = stmp.left(position); 260 283 261 if (event.category.length() > 10) 262 event.category = "Unknown"; 284 int position_p = event.category.indexOf("("); 285 if (position_p == -1) 286 event.description = stmp.right(stmp.length() - position - 2); 287 else 288 event.category = "Unknown"; 289 } 290 else 291 { 292 event.category = "Unknown"; 293 } 263 294 295 // When a channel is off air the category is "-" 296 // so leave the category as blank 297 if (event.category == "-") 298 event.category = "OffAir"; 264 299 300 if (event.category.length() > 20) 301 event.category = "Unknown"; 302 } 303 else if (event.categoryType) 304 { 305 QString theme = dish_theme_type_to_string(event.categoryType); 306 event.description = event.description.replace(theme, ""); 307 if (event.description.startsWith(".")) 308 event.description = event.description.right(event.description.length() - 1); 309 if (event.description.startsWith(" ")) 310 event.description = event.description.right(event.description.length() - 1); 311 } 312 265 313 // See if a year is present as (xxxx) 266 314 position = event.description.indexOf(m_bellYear); 267 315 if (position != -1 && event.category != "") … … 271 319 bool ok; 272 320 uint y = event.description.mid(position + 1, 4).toUInt(&ok); 273 321 if (ok) 322 { 274 323 event.originalairdate = QDate(y, 1, 1); 324 event.previouslyshown = true; 325 } 275 326 276 327 // Get the actors if they exist 277 328 if (position > 3) … … 305 356 event.description = event.description.replace(m_Stereo, ""); 306 357 } 307 358 359 // Check for "title (All Day, HD)" in the title 360 position = event.title.indexOf(m_bellPPVTitleAllDayHD); 361 if (position != -1) 362 { 363 event.title = event.title.replace(m_bellPPVTitleAllDayHD, ""); 364 event.videoProps |= VID_HDTV; 365 } 366 308 367 // Check for "title (All Day)" in the title 309 368 position = event.title.indexOf(m_bellPPVTitleAllDay); 310 369 if (position != -1) … … 320 379 event.videoProps |= VID_HDTV; 321 380 } 322 381 382 // Check for (HD) in the decription 383 position = event.description.indexOf("(HD)"); 384 if (position != -1) 385 { 386 event.description = event.description.replace("(HD)", ""); 387 event.videoProps |= VID_HDTV; 388 } 389 390 // Check for (HD) in the title 391 position = event.title.indexOf("(HD)"); 392 if (position != -1) 393 { 394 event.description = event.title.replace("(HD)", ""); 395 event.videoProps |= VID_HDTV; 396 } 397 398 // Check for HD at the end of the title 399 position = event.title.indexOf(m_dishPPVTitleHD); 400 if (position != -1) 401 { 402 event.title = event.title.replace(m_dishPPVTitleHD, ""); 403 event.videoProps |= VID_HDTV; 404 } 405 406 // Check for (DD) at the end of the description 407 position = event.description.indexOf("(DD)"); 408 if (position != -1) 409 { 410 event.description = event.description.replace("(DD)", ""); 411 event.audioProps |= AUD_DOLBY; 412 event.audioProps |= AUD_STEREO; 413 } 414 415 // Remove SAP from Dish descriptions 416 position = event.description.indexOf("(SAP)"); 417 if (position != -1) 418 { 419 event.description = event.description.replace("(SAP", ""); 420 event.subtitleType |= SUB_HARDHEAR; 421 } 422 423 // Remove any trailing colon in title 424 position = event.title.indexOf(m_dishPPVTitleColon); 425 if (position != -1) 426 { 427 event.title = event.title.replace(m_dishPPVTitleColon, ""); 428 } 429 430 // Remove New at the end of the description 431 position = event.description.indexOf(m_dishDescriptionNew); 432 if (position != -1) 433 { 434 event.previouslyshown = false; 435 event.description = event.description.replace(m_dishDescriptionNew, ""); 436 } 437 438 // Remove Series Finale at the end of the desciption 439 position = event.description.indexOf(m_dishDescriptionFinale); 440 if (position != -1) 441 { 442 event.previouslyshown = false; 443 event.description = event.description.replace(m_dishDescriptionFinale, ""); 444 } 445 446 // Remove Series Finale at the end of the desciption 447 position = event.description.indexOf(m_dishDescriptionFinale2); 448 if (position != -1) 449 { 450 event.previouslyshown = false; 451 event.description = event.description.replace(m_dishDescriptionFinale2, ""); 452 } 453 454 // Remove Series Premiere at the end of the description 455 position = event.description.indexOf(m_dishDescriptionPremiere); 456 if (position != -1) 457 { 458 event.previouslyshown = false; 459 event.description = event.description.replace(m_dishDescriptionPremiere, ""); 460 } 461 462 // Remove Series Premiere at the end of the description 463 position = event.description.indexOf(m_dishDescriptionPremiere2); 464 if (position != -1) 465 { 466 event.previouslyshown = false; 467 event.description = event.description.replace(m_dishDescriptionPremiere2, ""); 468 } 469 470 // Remove Dish's PPV code at the end of the description 471 QRegExp ppvcode = m_dishPPVCode; 472 ppvcode.setCaseSensitivity(Qt::CaseInsensitive); 473 position = event.description.indexOf(ppvcode); 474 if (position != -1) 475 { 476 event.description = event.description.replace(ppvcode, ""); 477 } 478 479 // Remove trailing garbage 480 position = event.description.indexOf(m_dishPPVSpacePerenEnd); 481 if (position != -1) 482 { 483 event.description = event.description.replace(m_dishPPVSpacePerenEnd, ""); 484 } 485 323 486 // Check for subtitle "All Day (... Eastern)" in the subtitle 324 487 position = event.subtitle.indexOf(m_bellPPVSubtitleAllDay); 325 488 if (position != -1) -
libs/libmythtv/eitfixup.h
49 49 kFixNL = 0x1000, 50 50 kFixCategory = 0x8000, 51 51 kFixNO = 0x10000, 52 kFixDish = 0x20000, 52 53 53 54 // Early fixups 54 55 kEFixForceISO8859_1 = 0x2000, … … 92 93 93 94 const QRegExp m_bellYear; 94 95 const QRegExp m_bellActors; 96 const QRegExp m_bellPPVTitleAllDayHD; 95 97 const QRegExp m_bellPPVTitleAllDay; 96 98 const QRegExp m_bellPPVTitleHD; 97 99 const QRegExp m_bellPPVSubtitleAllDay; 98 100 const QRegExp m_bellPPVDescriptionAllDay; 99 101 const QRegExp m_bellPPVDescriptionAllDay2; 100 102 const QRegExp m_bellPPVDescriptionEventId; 103 const QRegExp m_dishPPVTitleHD; 104 const QRegExp m_dishPPVTitleColon; 105 const QRegExp m_dishPPVSpacePerenEnd; 106 const QRegExp m_dishDescriptionNew; 107 const QRegExp m_dishDescriptionFinale; 108 const QRegExp m_dishDescriptionFinale2; 109 const QRegExp m_dishDescriptionPremiere; 110 const QRegExp m_dishDescriptionPremiere2; 111 const QRegExp m_dishPPVCode; 101 112 const QRegExp m_ukThen; 102 113 const QRegExp m_ukNew; 103 114 const QRegExp m_ukCEPQ;