| 971 | |
| 972 | /** \fn EITFixUp::FixNL(DBEvent&) const |
| 973 | * \brief Use this to standardize @Home DVB-C guide in the Netherlands. |
| 974 | */ |
| 975 | void EITFixUp::FixNL(DBEvent &event) const |
| 976 | { |
| 977 | QString fullinfo = ""; |
| 978 | fullinfo.append (event.subtitle); |
| 979 | fullinfo.append (event.description); |
| 980 | event.subtitle = ""; |
| 981 | |
| 982 | // Convert categories to Dutch categories Myth knows. |
| 983 | // nog invoegen: comedy, sport, misdaad |
| 984 | |
| 985 | if (event.category == "Documentary") |
| 986 | { |
| 987 | event.category = "Documentaire"; |
| 988 | event.category_type = kCategoryNone; |
| 989 | } |
| 990 | if (event.category == "News") |
| 991 | { |
| 992 | event.category = "Nieuws/actualiteiten"; |
| 993 | event.category_type = kCategoryNone; |
| 994 | } |
| 995 | if (event.category == "Kids") |
| 996 | { |
| 997 | event.category = "Jeugd"; |
| 998 | event.category_type = kCategoryNone; |
| 999 | } |
| 1000 | if (event.category == "Show/game Show") |
| 1001 | { |
| 1002 | event.category = "Amusement"; |
| 1003 | event.category_type = kCategoryTVShow; |
| 1004 | } |
| 1005 | if (event.category == "Music/Ballet/Dance") |
| 1006 | { |
| 1007 | event.category = "Muziek"; |
| 1008 | event.category_type = kCategoryNone; |
| 1009 | } |
| 1010 | if (event.category == "News magazine") |
| 1011 | { |
| 1012 | event.category = "Informatief"; |
| 1013 | event.category_type = kCategoryNone; |
| 1014 | } |
| 1015 | if (event.category == "Movie") |
| 1016 | { |
| 1017 | event.category = "Film"; |
| 1018 | event.category_type = kCategoryMovie; |
| 1019 | } |
| 1020 | if (event.category == "Nature/animals/Environment") |
| 1021 | { |
| 1022 | event.category = "Natuur"; |
| 1023 | event.category_type = kCategoryNone; |
| 1024 | } |
| 1025 | if (event.category == "Movie - Adult") |
| 1026 | { |
| 1027 | event.category = "Erotiek"; |
| 1028 | event.category_type = kCategoryNone; |
| 1029 | } |
| 1030 | if (event.category == "Movie - Soap/melodrama/folkloric") |
| 1031 | { |
| 1032 | event.category = "Serie/soap"; |
| 1033 | event.category_type = kCategorySeries; |
| 1034 | } |
| 1035 | if (event.category == "Arts/Culture") |
| 1036 | { |
| 1037 | event.category = "Kunst/Cultuur"; |
| 1038 | event.category_type = kCategoryNone; |
| 1039 | } |
| 1040 | if (event.category == "Sports") |
| 1041 | { |
| 1042 | event.category = "Sport"; |
| 1043 | event.category_type = kCategorySports; |
| 1044 | } |
| 1045 | if (event.category == "Cartoons/Puppets") |
| 1046 | { |
| 1047 | event.category = "Animatie"; |
| 1048 | event.category_type = kCategoryNone; |
| 1049 | } |
| 1050 | if (event.category == "Movie - Comedy") |
| 1051 | { |
| 1052 | event.category = "Comedy"; |
| 1053 | event.category_type = kCategorySeries; |
| 1054 | } |
| 1055 | if (event.category == "Movie - Detective/Thriller") |
| 1056 | { |
| 1057 | event.category = "Misdaad"; |
| 1058 | event.category_type = kCategoryNone; |
| 1059 | } |
| 1060 | if (event.category == "Social/Spiritual Sciences") |
| 1061 | { |
| 1062 | event.category = "Religieus"; |
| 1063 | event.category_type = kCategoryNone; |
| 1064 | } |
| 1065 | |
| 1066 | // Get stereo info |
| 1067 | int position; |
| 1068 | if ((position = fullinfo.find(m_nlStereo)) != -1) |
| 1069 | { |
| 1070 | event.flags |= DBEvent::kStereo; |
| 1071 | fullinfo = fullinfo.replace("stereo", "."); |
| 1072 | } |
| 1073 | |
| 1074 | //Get widescreen info |
| 1075 | if ((position = fullinfo.find(m_nlWide)) != -1) |
| 1076 | { |
| 1077 | fullinfo = fullinfo.replace("breedbeeld", "."); |
| 1078 | } |
| 1079 | |
| 1080 | // Get repeat info |
| 1081 | if ((position = fullinfo.find(m_nlRepeat)) != -1) |
| 1082 | { |
| 1083 | fullinfo = fullinfo.replace("herh.", "."); |
| 1084 | } |
| 1085 | |
| 1086 | // Get teletext subtitle info |
| 1087 | if ((position = fullinfo.find(m_nlTxt)) != -1) |
| 1088 | { |
| 1089 | event.flags |= DBEvent::kSubtitled; |
| 1090 | fullinfo = fullinfo.replace("txt", "."); |
| 1091 | } |
| 1092 | |
| 1093 | // Get HDTV information |
| 1094 | if ((position = event.title.find(m_nlHD)) != -1) |
| 1095 | { |
| 1096 | event.flags |= DBEvent::kHDTV; |
| 1097 | event.title = event.title.replace(m_nlHD, ""); |
| 1098 | } |
| 1099 | |
| 1100 | // Try to make subtitle |
| 1101 | QRegExp tmpSub = m_nlSub; |
| 1102 | QString tmpSubString; |
| 1103 | if (tmpSub.search(fullinfo) != -1) |
| 1104 | { |
| 1105 | tmpSubString = tmpSub.cap(0); |
| 1106 | tmpSubString = tmpSubString.right(tmpSubString.length() - 7); |
| 1107 | event.subtitle = tmpSubString.left(tmpSubString.length() -1); |
| 1108 | fullinfo = fullinfo.replace(tmpSub.cap(0), ""); |
| 1109 | } |
| 1110 | |
| 1111 | // This is trying to catch the case where the subtitle is in the main title |
| 1112 | // but avoid cases where it isn't a subtitle e.g cd:uk |
| 1113 | if (((position = event.title.find(":")) != -1) && |
| 1114 | (event.title[position + 1].upper() == event.title[position + 1]) && |
| 1115 | (event.subtitle.isEmpty())) |
| 1116 | { |
| 1117 | event.subtitle = event.title.mid(position + 1); |
| 1118 | event.title = event.title.left(position); |
| 1119 | } |
| 1120 | |
| 1121 | |
| 1122 | // Get the actors |
| 1123 | QRegExp tmpActors = m_nlActors; |
| 1124 | QStringList actors; |
| 1125 | QString tmpActorsString; |
| 1126 | if (tmpActors.search(fullinfo) != -1) |
| 1127 | { |
| 1128 | tmpActorsString = tmpActors.cap(0); |
| 1129 | tmpActorsString = tmpActorsString.right(tmpActorsString.length() - 6); |
| 1130 | tmpActorsString = tmpActorsString.left(tmpActorsString.length() - 5); |
| 1131 | actors = QStringList::split(QString(", "), tmpActorsString); |
| 1132 | for (QStringList::size_type i =0; i < actors.count(); i++) |
| 1133 | { |
| 1134 | event.AddPerson(DBPerson::kActor, actors[i]); |
| 1135 | } |
| 1136 | fullinfo = fullinfo.replace(tmpActors.cap(0), ""); |
| 1137 | } |
| 1138 | |
| 1139 | // Try to find presenter |
| 1140 | QRegExp tmpPres = m_nlPres; |
| 1141 | QStringList host; |
| 1142 | QString tmpPresString; |
| 1143 | if (tmpPres.search(fullinfo) != -1) |
| 1144 | { |
| 1145 | tmpPresString = tmpPres.cap(0); |
| 1146 | tmpPresString = tmpPresString.right(tmpPresString.length() - 14); |
| 1147 | tmpPresString = tmpPresString.left(tmpPresString.length() -1); |
| 1148 | host = QStringList::split(m_nlPersSeparator, tmpPresString); |
| 1149 | for (QStringList::size_type i =0; i < host.count(); i++) |
| 1150 | { |
| 1151 | event.AddPerson(DBPerson::kPresenter, host[i]); |
| 1152 | } |
| 1153 | fullinfo = fullinfo.replace(tmpPres.cap(0), ""); |
| 1154 | } |
| 1155 | |
| 1156 | // Try to find year |
| 1157 | QRegExp tmpYear1 = m_nlYear1; |
| 1158 | QRegExp tmpYear2 = m_nlYear2; |
| 1159 | if ((position = tmpYear1.search(fullinfo)) != -1) |
| 1160 | { |
| 1161 | bool ok; |
| 1162 | uint y = tmpYear1.cap(0).toUInt(&ok); |
| 1163 | if (ok) |
| 1164 | event.originalairdate = QDate(y, 1, 1); |
| 1165 | } |
| 1166 | |
| 1167 | if ((position = tmpYear2.search(fullinfo)) != -1) |
| 1168 | { |
| 1169 | bool ok; |
| 1170 | uint y = tmpYear2.cap(2).toUInt(&ok); |
| 1171 | if (ok) |
| 1172 | event.originalairdate = QDate(y, 1, 1); |
| 1173 | } |
| 1174 | |
| 1175 | // Try to find director |
| 1176 | QRegExp tmpDirector = m_nlDirector; |
| 1177 | QString tmpDirectorString; |
| 1178 | if ((position = fullinfo.find(m_nlDirector)) != -1) |
| 1179 | { |
| 1180 | tmpDirectorString = tmpDirector.cap(0); |
| 1181 | event.AddPerson(DBPerson::kDirector, tmpDirectorString); |
| 1182 | } |
| 1183 | |
| 1184 | // Strip leftovers |
| 1185 | if ((position = fullinfo.find(m_nlRub)) != -1) |
| 1186 | { |
| 1187 | fullinfo = fullinfo.replace(m_nlRub, ""); |
| 1188 | } |
| 1189 | |
| 1190 | // Strip category info from description |
| 1191 | if ((position = fullinfo.find(m_nlCat)) != -1) |
| 1192 | { |
| 1193 | fullinfo = fullinfo.replace(m_nlCat, ""); |
| 1194 | } |
| 1195 | |
| 1196 | // Remove omroep from title |
| 1197 | if ((position = event.title.find(m_nlOmroep)) != -1) |
| 1198 | { |
| 1199 | event.title = event.title.replace(m_nlOmroep, ""); |
| 1200 | } |
| 1201 | |
| 1202 | // Put information back in description |
| 1203 | |
| 1204 | event.description = fullinfo; |
| 1205 | event.description.stripWhiteSpace(); |
| 1206 | event.title.stripWhiteSpace(); |
| 1207 | event.subtitle.stripWhiteSpace(); |
| 1208 | |
| 1209 | } |