Ticket #4327: eitfixup9.patch
File eitfixup9.patch, 8.5 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/eitfixup.cpp
17 17 m_bellPPVDescriptionEventId("\\([0-9]{5}\\)"), 18 18 m_ukSubtitle("\\[.*S\\]"), 19 19 m_ukThen("\\s*(Then|Followed by) 60 Seconds\\.", false), 20 m_ukNew("\\s*(Brand New|New)\\s* Series\\s*[:\\.\\-]",false),21 m_ukNew1(" ^New\\."),20 m_ukNew("\\s*(Brand New|New)\\s*(Series|Episode)\\s*[:\\.\\-]",false), 21 m_ukNew1("New\\."), 22 22 m_ukT4("^[tT]4:"), 23 23 m_ukEQ("[:\\!\\?]"), 24 24 m_ukEPQ("[:\\!\\.\\?]"), … … 34 34 m_uk24ep("^\\d{1,2}:00[ap]m to \\d{1,2}:00[ap]m: "), 35 35 m_ukStarring("(?:Western\\s)?[Ss]tarring ([\\w\\s\\-']+)[Aa]nd\\s([\\w\\s\\-']+)[\\.|,](?:\\s)*(\\d{4})?(?:\\.\\s)?"), 36 36 m_ukBBC7rpt("\\[Rptd?[^]]+\\d{1,2}\\.\\d{1,2}[ap]m\\]\\."), 37 m_ukCBBC("^CBBC ."),38 m_ukCBeebies("^CBeebies ."),39 m_ukStarring1("star(ring )"),37 m_ukCBBC("^CBBC\\s*[\\.]"), 38 m_ukCBeebies("^CBeebies\\s*[\\.]"), 39 m_ukStarring1("star(ring|s)"), 40 40 m_ukDoubleDotEnd("\\.\\.+$"), 41 41 m_ukDoubleDotStart("^\\.\\.+"), 42 42 m_ukDotSpaceStart("^\\. "), 43 m_ukTime("\\d{1,2}[\\.:]\\d{1,2}\\s*(am|pm|)"), 44 m_ukBBC3("BBC THREE on BBC TWO\\.",false), 45 m_ukBBC4("BBC FOUR on BBC TWO\\.",false), 43 46 m_comHemCountry("^(\\(.+\\))?\\s?([^ ]+)\\s([^\\.0-9]+)" 44 47 "(?:\\sfrån\\s([0-9]{4}))(?:\\smed\\s([^\\.]+))?\\.?"), 45 48 m_comHemDirector("[Rr]egi"), … … 357 360 event.description = event.description.remove(m_ukNew1); 358 361 event.title = event.title.remove(m_ukT4); 359 362 363 // Removal of CBBC and CBeebies 364 event.description = event.description.remove(m_ukCBBC); 365 event.description = event.description.remove(m_ukCBeebies); 366 367 // Removal of BBC FOUR and BBC THREE 368 event.description = event.description.remove(m_ukBBC4); 369 event.description = event.description.remove(m_ukBBC3); 370 360 371 // BBC 7 [Rpt of ...] case. 361 372 event.description = event.description.remove(m_ukBBC7rpt); 362 373 374 event.title = event.title.stripWhiteSpace(); 375 event.description = event.description.stripWhiteSpace(); 376 363 377 QRegExp tmp24ep = m_uk24ep; 364 378 if (!event.title.startsWith("CSI:") && !event.title.startsWith("CD:")) 365 379 { … … 385 399 event.description = event.title.mid(position1); 386 400 event.title = event.title.left(position1); 387 401 } 388 } 402 } 389 403 } 390 404 else if ((position1 = tmp24ep.search(event.description)) != -1) 391 405 { … … 395 409 tmp24ep.cap(0).length() - 2); 396 410 event.description = event.description.remove(tmp24ep.cap(0)); 397 411 } 398 else if (((position1 = event.title.find(m_ukColonHyphen)) != -1) && 399 (event.description.find(":") < 0 )) 412 else if ((position1 = event.description.find(m_ukTime)) == -1) 400 413 { 401 if ((uint)position1 < SUBTITLE_MAX_LEN) 414 if (((position1 = event.title.find(m_ukColonHyphen)) != -1) && 415 (event.description.find(":") < 0 )) 402 416 { 403 event.subtitle = event.title.mid(position1 + 1); 404 event.title = event.title.left(position1); 417 if ((uint)position1 < SUBTITLE_MAX_LEN) 418 { 419 event.subtitle = event.title.mid(position1 + 1); 420 event.title = event.title.left(position1); 421 } 405 422 } 423 else 424 SetUKSubtitle(event); 406 425 } 407 else408 SetUKSubtitle(event);409 426 } 410 427 411 if ( event.subtitle.isEmpty())428 if ((event.description.find(m_ukTime) == -1) && (event.subtitle.isEmpty())) 412 429 { 413 430 QStringList strList1 = QStringList::split(".",event.description,TRUE); 414 431 QStringList strList2 = QStringList::split("?",event.description,TRUE); … … 426 443 QStringList strList3 = strList2.grep("Drama",false); 427 444 QStringList strList4 = strList2.grep("sitcom",false); 428 445 QStringList strList5 = strList2.grep(m_ukStarring1); 446 QStringList strList6 = strList2.grep("Series",false); 429 447 if ((strList3.count()==0) && (strList4.count()==0) && 430 (strList5.count()==0) )448 (strList5.count()==0) && (strList6.count()==0)) 431 449 { 432 450 event.subtitle = strList1[0]+strEnd; 433 451 event.description= … … 468 486 QRegExp tmpExp3 = m_ukSeries3; 469 487 if ((position1 = tmpExp1.search(event.title)) != -1) 470 488 { 471 event.partnumber = tmpExp1.cap(1).toUInt(); 472 event.parttotal = tmpExp1.cap(2).toUInt(); 473 // Remove from the title 474 event.title = 475 event.title.mid(position1 + tmpExp1.cap(0).length()); 476 series = true; 489 if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt()) 490 && tmpExp1.cap(2).toUInt()<=50) 491 { 492 event.partnumber = tmpExp1.cap(1).toUInt(); 493 event.parttotal = tmpExp1.cap(2).toUInt(); 494 // Remove from the title 495 event.title = event.title.left(position1)+ 496 event.title.mid(position1 + tmpExp1.cap(0).length()); 497 series = true; 498 } 477 499 } 478 500 else if ((position1 = tmpExp1.search(event.subtitle)) != -1) 479 501 { 480 event.partnumber = tmpExp1.cap(1).toUInt(); 481 event.parttotal = tmpExp1.cap(2).toUInt(); 482 // Remove from the sub title 483 event.subtitle = 484 event.subtitle.mid(position1 + tmpExp1.cap(0).length()); 485 series = true; 502 if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt()) 503 && tmpExp1.cap(2).toUInt()<=50) 504 { 505 event.partnumber = tmpExp1.cap(1).toUInt(); 506 event.parttotal = tmpExp1.cap(2).toUInt(); 507 // Remove from the sub title 508 event.subtitle = event.subtitle.left(position1)+ 509 event.subtitle.mid(position1 + tmpExp1.cap(0).length()); 510 series = true; 511 } 486 512 } 487 513 else if ((position1 = tmpExp1.search(event.description)) != -1) 488 514 { 489 event.partnumber = tmpExp1.cap(1).toUInt(); 490 event.parttotal = tmpExp1.cap(2).toUInt(); 491 series = true; 515 if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt()) 516 && tmpExp1.cap(2).toUInt()<=50) 517 { 518 event.partnumber = tmpExp1.cap(1).toUInt(); 519 event.parttotal = tmpExp1.cap(2).toUInt(); 520 // Remove from the description 521 event.description = event.description.left(position1)+ 522 event.description.mid(position1+tmpExp1.cap(0).length()); 523 series = true; 524 } 492 525 } 493 526 else if ((position1 = tmpExp2.search(event.description)) != -1) 494 527 { 495 528 event.partnumber = tmpExp2.cap(2).toUInt(); 496 529 event.parttotal = tmpExp2.cap(3).toUInt(); 530 // Remove from the description 531 event.description = event.description.left(position1)+ 532 event.description.mid(position1+tmpExp2.cap(0).length()); 497 533 series = true; 498 534 } 499 535 else if ((position1 = tmpExp3.search(event.description)) != -1) 500 536 { 501 537 event.partnumber = tmpExp3.cap(1).toUInt(); 502 538 event.parttotal = tmpExp3.cap(2).toUInt(); 539 // Remove from the description 540 event.description = event.description.left(position1)+ 541 event.description.mid(position1+tmpExp3.cap(0).length()); 503 542 series = true; 504 543 } 505 544 if (series) … … 549 588 event.originalairdate = QDate(y, 1, 1); 550 589 } 551 590 552 // Remove spurious channel names553 event.subtitle = event.subtitle.remove(m_ukCBBC);554 event.description = event.description.remove(m_ukCBBC);555 event.subtitle = event.subtitle.remove(m_ukCBeebies);556 event.description = event.description.remove(m_ukCBeebies);557 558 591 // Trim trailing '.' 559 592 event.title.remove(m_ukPEnd); 560 593 event.subtitle.remove(m_ukPEnd); -
libs/libmythtv/eitfixup.h
103 103 const QRegExp m_ukDoubleDotEnd; 104 104 const QRegExp m_ukDoubleDotStart; 105 105 const QRegExp m_ukDotSpaceStart; 106 const QRegExp m_ukTime; 107 const QRegExp m_ukBBC3; 108 const QRegExp m_ukBBC4; 106 109 const QRegExp m_comHemCountry; 107 110 const QRegExp m_comHemDirector; 108 111 const QRegExp m_comHemActor;