Ticket #270: eit.patch
File eit.patch, 13.0 KB (added by , 19 years ago) |
---|
-
libs/libmythtv/siparser.cpp
1433 1433 break; 1434 1434 1435 1435 case 0x54: 1436 e.ContentDescription = 1437 ProcessContentDescriptor( 1438 &buffer[des_pos],buffer[des_pos+1]+2); 1436 ProcessContentDescriptor( 1437 &buffer[des_pos],buffer[des_pos+1]+2,e); 1439 1438 break; 1440 1439 1441 1440 default: … … 1952 1951 * \TODO Add all types, possibly just lookup from a big 1953 1952 * array that is an include file? 1954 1953 */ 1955 QString SIParser::ProcessContentDescriptor(uint8_t *buf, int)1954 void SIParser::ProcessContentDescriptor(uint8_t *buf, int, Event& e) 1956 1955 { 1957 1956 uint8_t content = buf[2]; 1958 1957 if (content) 1959 return m_mapCategories[content]; 1960 else 1961 return QString(); 1958 { 1959 e.ContentDescription = m_mapCategories[content]; 1960 switch (content) 1961 { 1962 case 0x10 ... 0x1f: 1963 e.CategoryType = "movie"; 1964 break; 1965 case 0x40 ... 0x4f: 1966 e.CategoryType = "sports"; 1967 break; 1968 default: 1969 e.CategoryType = "tvshow"; 1970 } 1971 } 1962 1972 } 1963 1973 1964 1974 /** … … 2922 2932 event.Description = event.Description.replace("New Series",""); 2923 2933 2924 2934 2925 position = event.Description.find(':'); 2926 if (position != -1) 2935 //This is trying to catch the case where the subtitle is in the main title 2936 //but avoid cases where it isn't a subtitle e.g cd:uk 2937 if (((position = event.Event_Name.find(":")) != -1) && 2938 (event.Description.find(":") == -1) && 2939 (event.Event_Name[position+1].upper()==event.Event_Name[position+1])) 2927 2940 { 2941 event.Event_Subtitle = event.Event_Name.mid(position+1); 2942 event.Event_Name = event.Event_Name.left(position); 2943 } 2944 else if ((position = event.Description.find(":")) != -1) 2945 { 2928 2946 event.Event_Subtitle = event.Description.left(position); 2929 event.Description = event.Description.right( 2930 event.Description.length()-position-2); 2947 event.Description = event.Description.mid(position+1); 2931 2948 if ((event.Event_Subtitle.length() > 0) && 2932 2949 (event.Description.length() > 0) && 2933 2950 (event.Event_Subtitle.length() > event.Description.length())) … … 2939 2956 } 2940 2957 2941 2958 if (event.Event_Name.endsWith("...") && 2942 event.Event_Subtitle.startsWith(".. ."))2959 event.Event_Subtitle.startsWith("..")) 2943 2960 { 2944 2961 //try and make the subtitle 2945 QString Full = event.Event_Name.left(event.Event_Name.length()-3)+" "+ 2946 event.Event_Subtitle.right(event.Event_Subtitle.length()-3); 2947 if ((position = Full.find(":")) != -1) 2962 QString Full = event.Event_Name.left(event.Event_Name.length()-3)+" "; 2963 2964 if (event.Event_Subtitle.startsWith("...")) 2965 Full += event.Event_Subtitle.mid(3); 2966 else 2967 Full += event.Event_Subtitle.mid(2); 2968 if (((position = Full.find(":")) != -1) || 2969 ((position = Full.find(".")) != -1)) 2948 2970 { 2949 2971 event.Event_Name = Full.left(position); 2950 event.Event_Subtitle = Full. right(Full.length()-position-2);2972 event.Event_Subtitle = Full.mid(position+1); 2951 2973 } 2952 else if ((position = Full.find(".")) != -1)2974 else 2953 2975 { 2976 event.Event_Name = Full; 2977 event.Event_Subtitle=""; 2978 } 2979 } 2980 else if (event.Event_Subtitle.endsWith("...") && 2981 event.Description.startsWith("...")) 2982 { 2983 QString Full = event.Event_Subtitle.left(event.Event_Subtitle.length() 2984 -3)+" "+ event.Description.mid(3); 2985 if (((position = Full.find(":")) != -1) || 2986 ((position = Full.find(".")) != -1)) 2987 { 2988 event.Event_Subtitle = Full.left(position); 2989 event.Description = Full.mid(position+1); 2990 } 2991 } 2992 else if (event.Event_Name.endsWith("...") && 2993 event.Description.startsWith("...") && event.Event_Subtitle.isEmpty()) 2994 { 2995 QString Full = event.Event_Name.left(event.Event_Name.length() 2996 -3)+" "+ event.Description.mid(3); 2997 if (((position = Full.find(":")) != -1) || 2998 ((position = Full.find(".")) != -1)) 2999 { 2954 3000 event.Event_Name = Full.left(position); 2955 event. Event_Subtitle = Full.right(Full.length()-position-2);3001 event.Description = Full.mid(position+1); 2956 3002 } 2957 3003 } 3004 3005 //Work out the episode numbers (if any) 3006 bool series = false; 3007 QRegExp rx("^\\s*(\\d{1,2})/(\\d{1,2})\\."); 3008 QRegExp rx1("\\((Part|Pt)\\s+(\\d{1,2})\\s+of\\s+(\\d{1,2})\\)"); 3009 if ((position = rx.search(event.Event_Name)) != -1) 3010 { 3011 event.PartNumber=rx.cap(1).toUInt(); 3012 event.PartTotal=rx.cap(2).toUInt(); 3013 //Remove from the title 3014 event.Event_Name=event.Event_Name.mid(position+rx.cap(0).length()); 3015 //but add it to the description 3016 event.Description+=rx.cap(0); 3017 series=true; 3018 } 3019 else if ((position = rx.search(event.Event_Subtitle)) != -1) 3020 { 3021 event.PartNumber=rx.cap(1).toUInt(); 3022 event.PartTotal=rx.cap(2).toUInt(); 3023 //Remove from the sub title 3024 event.Event_Subtitle=event.Event_Subtitle.mid(position+rx.cap(0).length()); 3025 //but add it to the description 3026 event.Description+=rx.cap(0); 3027 series=true; 3028 } 3029 else if ((position = rx.search(event.Description)) != -1) 3030 { 3031 event.PartNumber=rx.cap(1).toUInt(); 3032 event.PartTotal=rx.cap(2).toUInt(); 3033 //Don't cut it from the description 3034 //event.Description=event.Description.left(position)+ 3035 // event.Description.mid(position+rx.cap(0).length()); 3036 series=true; 3037 } 3038 else if ((position = rx1.search(event.Description)) != -1) 3039 { 3040 event.PartNumber=rx1.cap(2).toUInt(); 3041 event.PartTotal=rx1.cap(3).toUInt(); 3042 //Don't cut it from the description 3043 //event.Description=event.Description.left(position)+ 3044 // event.Description.mid(position+rx1.cap(0).length()); 3045 series=true; 3046 } 3047 if (series) 3048 event.CategoryType="series"; 3049 //Work out the closed captions and Audio descriptions (if any) 3050 rx.setPattern("\\[(AD)(,(S)){,1}(,SL){,1}\\]|" 3051 "\\[(S)(,AD){,1}(,SL){,1}\\]|" 3052 "\\[(SL)(,AD){,1}(,(S)){,1}\\]"); 3053 if ((position = rx.search(event.Description)) != -1) 3054 { 3055 //Enumerate throught and see if we have subtitles, don't modify 3056 //the description as we might destroy other useful information 3057 QStringList captures = rx.capturedTexts(); 3058 QStringList::Iterator i = captures.begin(); 3059 QStringList::Iterator end = captures.end(); 3060 while (i!=end) 3061 if (*(i++) == "S") 3062 event.SubTitled = true; 3063 } 3064 else if ((position = rx.search(event.Event_Subtitle)) != -1) 3065 { 3066 QStringList captures = rx.capturedTexts(); 3067 QStringList::Iterator i = captures.begin(); 3068 QStringList::Iterator end = captures.end(); 3069 while (i!=end) 3070 if (*(i++) == "S") 3071 event.SubTitled = true; 3072 //We do remove [AD,S] from the subtitle as it probably shouldn't be 3073 //there. 3074 QString Temp = event.Event_Subtitle; 3075 event.Event_Subtitle = Temp.left(position)+Temp.mid(position+rx.cap(0).length()); 3076 } 3077 //Work out the year (if any) 3078 rx.setPattern("[\\[\\(]([\\d]{4})[\\)\\]]"); 3079 if ((position = rx.search(event.Description)) != -1) 3080 { 3081 event.Description=event.Description.left(position)+ 3082 event.Description.mid(position+rx.cap(0).length()); 3083 event.Year=rx.cap(1); 3084 } 3085 3086 event.Event_Name = event.Event_Name.stripWhiteSpace(); 3087 event.Event_Subtitle = event.Event_Subtitle.stripWhiteSpace(); 3088 event.Description = event.Description.stripWhiteSpace(); 2958 3089 } 2959 3090 2960 3091 void SIParser::EITFixUpStyle3(Event &event) -
libs/libmythtv/sitypes.h
353 353 //bool PreviouslyShown; 354 354 QDate OriginalAirDate; 355 355 QValueList<Person> Credits; 356 unsigned PartNumber; 357 unsigned PartTotal; 358 QString CategoryType; 356 359 }; 357 360 358 361 // DVB TransportObject - Used with NIT Scanning -
libs/libmythtv/dbcheck.cpp
192 192 and must be selected when you compile %MythTV. Finally, the 'atscsrcid' 193 193 field currently contains both the major and minor atsc channels, encoded 194 194 in the form (majorChannel * 256 | minorChannel) when using DVB drivers. 195 196 \section program_table Program Entry Table (program) 197 'category_type' holds one of these exact four strings: "movie", "series", "sports" or "tvshow". 198 199 'airdate' is a string representing the year of release for movies and may have no meaning for other types of shows. 200 201 'stars' is a floating point number from 0.0 to 1.0. On a four star scale, 1.0 would be four stars, 0.75 would be three stars and so on. 202 203 'originalairdate' if provided is the date when a show was, or will be, first televised. 204 205 'previouslyshown' is a field created by MythTV to try to determine if a showing is more than 14 days after its original air date or if the show was marked as a repeat and did not have a date for the first airing. If this is "0" it usually means that this is a brand new show or a rebroadcast within the first two weeks. 206 207 'programid' is the Tribune Media Service database record identifier for each program description. In general, these start with a two letter prefix, MV, EP, SP or SH that equate to the 'category_type'. For most, the last four digits are "0000" except EP where the last four digits are the episode number in the series. Note that these are generated by TMS and not the show's producers but they are usually in the same order as the original air dates for the episodes. Detailed information can be found in the Data Direct documentation at http://labs.zap2it.com/ . 208 195 209 */ 196 210 197 211 /** \fn UpdateDBVersionNumber(const QString&) -
libs/libmythtv/eithelper.cpp
223 223 query.prepare("REPLACE INTO program (chanid, starttime, " 224 224 "endtime, title, description, subtitle, " 225 225 "category, stereo, closecaptioned, hdtv, " 226 "airdate, originalairdate) " 226 "airdate, originalairdate, partnumber, parttotal, " 227 "category_type) " 227 228 "VALUES (:CHANID, :STARTTIME, " 228 229 ":ENDTIME, :TITLE, :DESCRIPTION, :SUBTITLE, " 229 230 ":CATEGORY, :STEREO, :CLOSECAPTIONED, :HDTV, " 230 ":AIRDATE, :ORIGINALAIRDATE);"); 231 ":AIRDATE, :ORIGINALAIRDATE, :PARTNUMBER, :PARTTOTAL," 232 ":CATTYPE);"); 231 233 query.bindValue(":CHANID", chanid); 232 234 query.bindValue(":STARTTIME", event.StartTime. 233 235 toString(QString("yyyy-MM-dd hh:mm:00"))); … … 243 245 query.bindValue(":AIRDATE", event.Year); 244 246 query.bindValue(":ORIGINALAIRDATE", event.OriginalAirDate. 245 247 toString(QString("yyyy-MM-dd"))); 248 query.bindValue(":PARTNUMBER", event.PartNumber); 249 query.bindValue(":PARTTOTAL", event.PartTotal); 250 query.bindValue(":CATTYPE", event.CategoryType.utf8()); 246 251 247 252 if (!query.exec() || !query.isActive()) 248 253 { -
libs/libmythtv/sitypes.cpp
251 251 Stereo = false; 252 252 HDTV = false; 253 253 ATSC = false; 254 PartNumber = 0; 255 PartTotal = 0; 256 CategoryType=""; 254 257 //PreviouslyShown = false; 255 258 OriginalAirDate = QDate(); 256 259 Credits.clear(); -
libs/libmythtv/siparser.h
162 162 QString ProcessDescHuffmanTextLarge (uint8_t *buf, uint sz); 163 163 164 164 // DVB EIT Table Descriptor processors 165 QString ProcessContentDescriptor (uint8_t *buf, int sz);165 void ProcessContentDescriptor (uint8_t *buf, int sz, Event &e); 166 166 void ProcessShortEventDescriptor (uint8_t *buf, int sz, Event &e); 167 167 void ProcessExtendedEventDescriptor (uint8_t *buf, int sz, Event &e); 168 168 void ProcessComponentDescriptor (uint8_t *buf, int sz, Event &e);