Ticket #10098: eitAU.patch
| File eitAU.patch, 14.2 KB (added by , 15 years ago) |
|---|
-
mythtv/libs/libmythtv/eitfixup.cpp
diff --git a/mythtv/libs/libmythtv/eitfixup.cpp b/mythtv/libs/libmythtv/eitfixup.cpp index cd4c300..b23d686 100644
a b 8 8 9 9 #include "programinfo.h" // for subtitle types and audio and video properties 10 10 #include "dishdescriptors.h" // for dish_theme_type_to_string 11 #include "mythverbose.h" 12 #define LOC QString("EITFixup: ") 11 13 12 14 /*------------------------------------------------------------------------ 13 15 * Event Fix Up Scripts - Turned on by entry in dtv_privatetype table … … EITFixUp::EITFixUp() 119 121 "NRK2s historiekveld|Detektimen|Nattkino|Filmklassiker|Film|Kortfilm|P.skemorgen|" 120 122 "Radioteatret|Opera|P2-Akademiet|Nyhetsmorgen i P2 og Alltid Nyheter:): (.+)"), 121 123 m_noPremiere("\\s+-\\s+(Sesongpremiere|Premiere)!?$"), 122 m_Stereo("\\b\\(?[sS]tereo\\)?\\b") 123 124 m_Stereo("\\b\\(?[sS]tereo\\)?\\b"), 125 m_AUFreeviewSY("(.*) \\((.+)\\) \\(([12][0-9][0-9][0-9])\\)$"), 126 m_AUFreeviewY("(.*) \\(([12][0-9][0-9][0-9])\\)$"), 127 m_AUFreeviewYC("(.*) \\(([12][0-9][0-9][0-9])\\) \\((.+)\\)$"), 128 m_AUFreeviewSYC("(.*) \\((.+)\\) \\(([12][0-9][0-9][0-9])\\) \\((.+)\\)$") 124 129 { 125 130 } 126 131 … … void EITFixUp::Fix(DBEventEIT &event) const 159 164 if (kFixAUStar & event.fixup) 160 165 FixAUStar(event); 161 166 167 if (kFixAUDescription & event.fixup) 168 FixAUDescription(event); 169 170 if (kFixAUFreeview & event.fixup) 171 FixAUFreeview(event); 172 173 if (kFixAUNine & event.fixup) 174 FixAUNine(event); 175 176 if (kFixAUSeven & event.fixup) 177 FixAUSeven(event); 178 162 179 if (kFixMCA & event.fixup) 163 180 FixMCA(event); 164 181 … … void EITFixUp::FixAUStar(DBEventEIT &event) const 1142 1159 } 1143 1160 } 1144 1161 1162 /** \fn EITFixUp::FixAUDescription(DBEventEIT&) const 1163 * \brief Use this to standardize DVB-T guide in Australia. (fix common annoyances common to most networks) 1164 */ 1165 void EITFixUp::FixAUDescription(DBEventEIT &event) const 1166 { 1167 if (event.description.startsWith("[Program data ") || event.description.startsWith("[Program info "))//TEN 1168 { 1169 event.description = "";//event.subtitle; 1170 //VERBOSE(VB_EIT, LOC + QString("EIT: set subtitle to empty: %1").arg(event.subtitle)); 1171 } 1172 if (event.description.endsWith("Copyright West TV Ltd. 2011)")) 1173 event.description.resize(event.description.length()-40); 1174 1175 if (event.description.isEmpty() && !event.subtitle.isEmpty())//due to ten's copyright info, this won't be caught before 1176 { 1177 event.description = event.subtitle; 1178 event.subtitle = QString::null; 1179 //VERBOSE(VB_EIT, QString("EIT: set subtitle to empty: %1").arg(event.subtitle)); 1180 } 1181 if (event.description.startsWith(event.title+" - ")) 1182 event.description.remove(0,event.title.length()+3); 1183 if (event.title.startsWith("LIVE: ", Qt::CaseInsensitive)) 1184 { 1185 event.title.remove(0, 6); 1186 event.description.prepend("(Live) "); 1187 } 1188 } 1189 /** \fn EITFixUp::FixAUNine(DBEventEIT&) const 1190 * \brief Use this to standardize DVB-T guide in Australia. (Nine network) 1191 */ 1192 void EITFixUp::FixAUNine(DBEventEIT &event) const 1193 { 1194 QRegExp rating("\\((G|PG|M|MA)\\)"); 1195 if (rating.indexIn(event.description) == 0) 1196 { 1197 EventRating prograting; 1198 prograting.system="AU"; prograting.rating = rating.cap(1); 1199 event.ratings.push_back(prograting); 1200 event.description.remove(0,rating.matchedLength()+1); 1201 } 1202 if (event.description.startsWith("[HD]")) 1203 { 1204 event.videoProps |= VID_HDTV; 1205 event.description.remove(0,5); 1206 } 1207 if (event.description.startsWith("[CC]")) 1208 { 1209 event.subtitleType |= SUB_NORMAL; 1210 event.description.remove(0,5); 1211 } 1212 if (event.subtitle == "Movie") 1213 { 1214 event.subtitle = QString::null; 1215 event.categoryType = kCategoryMovie; 1216 } 1217 if (event.description.startsWith(event.title)) 1218 event.description.remove(0,event.title.length()+1); 1219 } 1220 /** \fn EITFixUp::FixAUSeven(DBEventEIT&) const 1221 * \brief Use this to standardize DVB-T guide in Australia. (Seven network) 1222 */ 1223 void EITFixUp::FixAUSeven(DBEventEIT &event) const 1224 { 1225 if (event.description.endsWith(" Rpt")) 1226 { 1227 event.previouslyshown = true; 1228 event.description.resize(event.description.size()-4); 1229 } 1230 QRegExp year("(\\d{4})$"); 1231 if (year.indexIn(event.description) != -1) 1232 { 1233 event.airdate = year.cap(3).toUInt(); 1234 event.description.resize(event.description.size()-5); 1235 } 1236 if (event.description.endsWith(" CC")) 1237 { 1238 event.subtitleType |= SUB_NORMAL; 1239 event.description.resize(event.description.size()-3); 1240 } 1241 QString advisories;//store the advisories to append later 1242 QRegExp adv("(\\([A-Z,]+\\))$"); 1243 if (adv.indexIn(event.description) != -1) 1244 { 1245 advisories = adv.cap(1); 1246 event.description.resize(event.description.size()-(adv.matchedLength()+1)); 1247 } 1248 QRegExp rating("(C|G|PG|M|MA)$"); 1249 if (rating.indexIn(event.description) != -1) 1250 { 1251 EventRating prograting; 1252 prograting.system=""; prograting.rating = rating.cap(1); 1253 if (!advisories.isEmpty()) 1254 prograting.rating.append(" ").append(advisories); 1255 event.ratings.push_back(prograting); 1256 event.description.resize(event.description.size()-(rating.matchedLength()+1)); 1257 } 1258 } 1259 /** \fn EITFixUp::FixAUFreeview(DBEventEIT&) const 1260 * \brief Use this to standardize DVB-T guide in Australia. (generic freeview - extra info in brackets at end of desc) 1261 */ 1262 void EITFixUp::FixAUFreeview(DBEventEIT &event) const 1263 { 1264 if (event.description.endsWith(".."))//has been truncated to fit within the 'subtitle' eit field, so none of the following will work (ABC) 1265 return; 1266 1267 if (m_AUFreeviewSY.indexIn(event.description.trimmed(), 0) != -1) 1268 { 1269 if (event.subtitle.isEmpty())//nine sometimes has an actual subtitle field and the brackets thingo) 1270 event.subtitle = m_AUFreeviewSY.cap(2); 1271 event.airdate = m_AUFreeviewSY.cap(3).toUInt(); 1272 event.description = m_AUFreeviewSY.cap(1); 1273 //VERBOSE(VB_EIT, LOC + QString("freeviewSY: %1").arg(m_AUFreeviewSY.cap(1))); 1274 } 1275 else if (m_AUFreeviewY.indexIn(event.description.trimmed(), 0) != -1) 1276 { 1277 event.airdate = m_AUFreeviewY.cap(2).toUInt(); 1278 event.description = m_AUFreeviewY.cap(1); 1279 //VERBOSE(VB_EIT, LOC + QString("freeviewY: %1").arg(m_AUFreeviewY.cap(1))); 1280 } 1281 else if (m_AUFreeviewSYC.indexIn(event.description.trimmed(), 0) != -1) 1282 { 1283 if (event.subtitle.isEmpty()) 1284 event.subtitle = m_AUFreeviewSYC.cap(2); 1285 event.airdate = m_AUFreeviewSYC.cap(3).toUInt(); 1286 QStringList actors = m_AUFreeviewSYC.cap(4).split("/"); 1287 for (int i = 0; i < actors.size(); ++i) 1288 event.AddPerson(DBPerson::kActor, actors.at(i)); 1289 event.description = m_AUFreeviewSYC.cap(1); 1290 //VERBOSE(VB_EIT, LOC + QString("freeviewSY: %1").arg(m_AUFreeviewSYC.cap(1))); 1291 } 1292 else if (m_AUFreeviewYC.indexIn(event.description.trimmed(), 0) != -1) 1293 { 1294 event.airdate = m_AUFreeviewYC.cap(2).toUInt(); 1295 QStringList actors = m_AUFreeviewYC.cap(3).split("/"); 1296 for (int i = 0; i < actors.size(); ++i) 1297 event.AddPerson(DBPerson::kActor, actors.at(i)); 1298 event.description = m_AUFreeviewYC.cap(1); 1299 //VERBOSE(VB_EIT, LOC + QString("freeviewSY: %1").arg(m_AUFreeviewSYC.cap(1))); 1300 } 1301 else 1302 { 1303 //VERBOSE(VB_EIT, LOC + QString("no freeview match: %1").arg(event.description)); 1304 } 1305 } 1306 1145 1307 /** \fn EITFixUp::FixMCA(DBEventEIT&) const 1146 1308 * \brief Use this to standardise the MultiChoice Africa DVB-S guide. 1147 1309 */ -
mythtv/libs/libmythtv/eitfixup.h
diff --git a/mythtv/libs/libmythtv/eitfixup.h b/mythtv/libs/libmythtv/eitfixup.h index d4e9cf8..34e1001 100644
a b class EITFixUp 51 51 kFixNO = 0x10000, 52 52 kFixNRK_DVBT = 0x20000, 53 53 kFixDish = 0x40000, 54 kFixAUFreeview = 0x80000, 55 kFixAUDescription = 0x100000, 56 kFixAUNine = 0x200000, 57 kFixAUSeven = 0x400000, 54 58 55 59 // Early fixups 56 60 kEFixForceISO8859_1 = 0x2000, … … class EITFixUp 82 86 void FixComHem(DBEventEIT &event, 83 87 bool parse_subtitle) const; // Sweden DVB-C 84 88 void FixAUStar(DBEventEIT &event) const; // Australia DVB-S 89 void FixAUFreeview(DBEventEIT &event) const; // Australia DVB-T 90 void FixAUNine(DBEventEIT &event) const; 91 void FixAUSeven(DBEventEIT &event) const; 92 void FixAUDescription(DBEventEIT &event) const; 85 93 void FixMCA(DBEventEIT &event) const; // MultiChoice Africa DVB-S 86 94 void FixRTL(DBEventEIT &event) const; // RTL group DVB 87 95 void FixFI(DBEventEIT &event) const; // Finland DVB-T … … class EITFixUp 192 200 const QRegExp m_noNRKCategories; 193 201 const QRegExp m_noPremiere; 194 202 const QRegExp m_Stereo; 203 const QRegExp m_AUFreeviewSY;//subtitle, year 204 const QRegExp m_AUFreeviewY;//year 205 const QRegExp m_AUFreeviewYC;//year, cast 206 const QRegExp m_AUFreeviewSYC;//subtitle, year, cast 195 207 }; 196 208 197 209 #endif // EITFIXUP_H -
mythtv/libs/libmythtv/eithelper.cpp
diff --git a/mythtv/libs/libmythtv/eithelper.cpp b/mythtv/libs/libmythtv/eithelper.cpp index 9afe5df..1fb89a3 100644
a b void EITHelper::AddEIT(const DVBEventInformationTable *eit) 443 443 if (EITFixUp::kFixDish & fix) 444 444 category = content.GetCategory(); 445 445 } 446 else if (EITFixUp::kFixAUDescription & fix)//AU Freeview assigned genres 447 { 448 ContentDescriptor content(content_data); 449 switch (content.Nibble1(0)) 450 { 451 case 0x01: 452 category = "Movie"; 453 break; 454 case 0x02: 455 category = "News"; 456 break; 457 case 0x03: 458 category = "Entertainment"; 459 break; 460 case 0x04: 461 category = "Sport"; 462 break; 463 case 0x05: 464 category = "Children"; 465 break; 466 case 0x06: 467 category = "Music"; 468 break; 469 case 0x07: 470 category = "Arts/Culture"; 471 break; 472 case 0x08: 473 category = "Current Affairs"; 474 break; 475 case 0x09: 476 category = "Education"; 477 break; 478 case 0x0A: 479 category = "Infotainment"; 480 break; 481 case 0x0B: 482 category = "Special"; 483 break; 484 case 0x0C: 485 category = "Comedy"; 486 break; 487 case 0x0D: 488 category = "Drama"; 489 break; 490 case 0x0E: 491 category = "Documentary"; 492 break; 493 default: 494 category = ""; 495 break; 496 } 497 category_type = content.GetMythCategory(0); 498 } 446 499 else 447 500 { 448 501 ContentDescriptor content(content_data); … … void EITHelper::AddEIT(const DVBEventInformationTable *eit) 464 517 if (desc.ContentType() == 0x01 || desc.ContentType() == 0x31) 465 518 programId = desc.ContentId(); 466 519 else if (desc.ContentType() == 0x02 || desc.ContentType() == 0x32) 520 { 467 521 seriesId = desc.ContentId(); 522 category_type = kCategorySeries; 523 } 468 524 } 525 else 526 VERBOSE(VB_EIT, LOC + QString("Crid with unknown encoding: %1").arg(desc.ContentEncoding())); 469 527 } 470 528 471 529 QDateTime starttime = MythUTCToLocal(eit->StartTimeUTC(i)); … … static void init_fixup(QMap<uint64_t,uint> &fix) 818 876 fix[40999U << 16 | 1069] = EITFixUp::kFixSubtitle; 819 877 820 878 // Australia 821 fix[ 4096U << 16] = EITFixUp::kFixAUStar; 822 fix[ 4096U << 16] = EITFixUp::kFixAUStar; 879 fix[ 4096U << 16] = EITFixUp::kFixAUStar; 880 fix[ 4096U << 16] = EITFixUp::kFixAUStar; 881 fix[ 12801U << 16] = EITFixUp::kFixAUFreeview | EITFixUp::kFixAUDescription;//ABC 882 fix[ 12803U << 16] = EITFixUp::kFixAUFreeview | EITFixUp::kFixAUDescription | EITFixUp::kFixAUNine;//Nine 883 fix[ 12802U << 16] = EITFixUp::kFixAUDescription;//SBS 884 fix[ 4115U << 16] = EITFixUp::kFixAUDescription | EITFixUp::kFixAUSeven;//Seven 885 fix[ 4116U << 16] = EITFixUp::kFixAUDescription;//Ten 886 fix[12862U << 16] = EITFixUp::kFixAUDescription;//WestTV 823 887 824 888 // MultiChoice Africa 825 889 fix[ 6144U << 16] = EITFixUp::kFixMCA; -
mythtv/libs/libmythtv/programdata.cpp
diff --git a/mythtv/libs/libmythtv/programdata.cpp b/mythtv/libs/libmythtv/programdata.cpp index 8b36660..565c61e 100644
a b uint DBEvent::UpdateDB( 583 583 for (uint i = 0; i < credits->size(); i++) 584 584 (*credits)[i].InsertDB(query, chanid, starttime); 585 585 } 586 587 QList<EventRating>::const_iterator j = ratings.begin(); 588 for (; j != ratings.end(); ++j) 589 { 590 query.prepare( 591 "INSERT INTO programrating " 592 " ( chanid, starttime, system, rating) " 593 "VALUES (:CHANID, :START, :SYS, :RATING)"); 594 query.bindValue(":CHANID", chanid); 595 query.bindValue(":START", starttime); 596 query.bindValue(":SYS", (*j).system); 597 query.bindValue(":RATING", (*j).rating); 598 599 if (!query.exec()) 600 MythDB::DBError("programrating insert", query); 601 } 586 602 587 603 return 1; 588 604 }
