Ticket #420: uk.eit.patch
File uk.eit.patch, 6.5 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/siparser.cpp
125 125 126 126 pmap_lock.lock(); 127 127 128 /* Check Dependenc ys and update if necessary */128 /* Check Dependencies and update if necessary */ 129 129 for (int x = 0 ; x < NumHandlers ; x++) 130 130 { 131 131 if (Table[x]->Complete()) … … 2429 2429 #ifdef EIT_DEBUG_SID 2430 2430 VERBOSE(VB_SIPARSER, 2431 2431 QString("[%1][%2]: %3\t%4 - %5") 2432 .arg( source_id).arg(event_id)2432 .arg(atsc_src_id).arg(event_id) 2433 2433 .arg(e.Event_Name.ascii(), 20) 2434 2434 .arg(e.StartTime.toString("MM/dd hh:mm")) 2435 2435 .arg(e.EndTime.toString("hh:mm"))); … … 2928 2928 */ 2929 2929 void SIParser::EITFixUpStyle2(Event &event) 2930 2930 { 2931 const uint16_t SUBTITLE_PCT = 50; //% of description to allow subtitle up to 2931 2932 int16_t position = event.Description.find("New Series"); 2932 2933 if (position != -1) 2933 2934 { 2934 2935 //Do something here 2935 2936 } 2936 2937 //BBC three case (could add another record here ?) 2937 event.Description = event.Description.replace(" Then 60 Seconds.",""); 2938 event.Description = 2939 event.Description.replace(" Followed by 60 Seconds.",""); 2940 event.Description = event.Description.replace("Brand New Series - ",""); 2941 event.Description = event.Description.replace("Brand New Series",""); 2942 event.Description = event.Description.replace("New Series",""); 2938 QRegExp rx("\\s*(Then 60 Seconds| Followed by 60 Seconds)\\."); 2939 rx.setCaseSensitive(FALSE); 2940 event.Description = event.Description.replace(rx,""); 2943 2941 2942 rx.setPattern("\\s*(Brand New Series - |Brand New Series|New Series)\\.?"); 2943 event.Description = event.Description.replace(rx,""); 2944 2944 2945 QRegExp terminatesWith("[\\!\\?]"); 2945 2946 //This is trying to catch the case where the subtitle is in the main title 2946 2947 //but avoid cases where it isn't a subtitle e.g cd:uk 2947 2948 if (((position = event.Event_Name.find(":")) != -1) && … … 2953 2954 } 2954 2955 else if ((position = event.Description.find(":")) != -1) 2955 2956 { 2956 event.Event_Subtitle = event.Description.left(position); 2957 event.Description = event.Description.mid(position+1); 2958 if ((event.Event_Subtitle.length() > 0) && 2959 (event.Description.length() > 0) && 2960 (event.Event_Subtitle.length() > event.Description.length())) 2957 // if the subtitle is less than 50% of the description use it. 2958 if ((position*100)/event.Description.length() < SUBTITLE_PCT) 2961 2959 { 2962 QString Temp = event.Event_Subtitle; 2963 event.Event_Subtitle = event.Description; 2964 event.Description = Temp; 2960 event.Event_Subtitle = event.Description.left(position); 2961 event.Description = event.Description.mid(position+1); 2965 2962 } 2966 2963 } 2964 else if ((position = event.Description.find(terminatesWith)) != -1) 2965 { 2966 if ((position*100)/event.Description.length() < SUBTITLE_PCT) 2967 { 2968 event.Event_Subtitle = event.Description.left(position+1); 2969 event.Description = event.Description.mid(position+2); 2970 } 2971 } 2967 2972 2973 QRegExp endsWith("\\.+$"); 2974 QRegExp startsWith("^\\.+"); 2975 terminatesWith.setPattern("[:\\!\\.\\?]"); 2968 2976 if (event.Event_Name.endsWith("...") && 2969 2977 event.Event_Subtitle.startsWith("..")) 2970 2978 { 2971 2979 //try and make the subtitle 2972 QString Full = event.Event_Name.left(event.Event_Name.length()-3)+" "; 2980 QString Full = event.Event_Name.replace(endsWith,"")+" "+ 2981 event.Event_Subtitle.replace(startsWith,""); 2973 2982 2974 if (event.Event_Subtitle.startsWith("...")) 2975 Full += event.Event_Subtitle.mid(3); 2976 else 2977 Full += event.Event_Subtitle.mid(2); 2978 if (((position = Full.find(":")) != -1) || 2979 ((position = Full.find(".")) != -1)) 2983 if ((position = Full.find(terminatesWith)) != -1) 2980 2984 { 2985 if (Full[position] == '!' || Full[position] == '?') 2986 position++; 2981 2987 event.Event_Name = Full.left(position); 2982 2988 event.Event_Subtitle = Full.mid(position+1); 2983 2989 } … … 2990 2996 else if (event.Event_Subtitle.endsWith("...") && 2991 2997 event.Description.startsWith("...")) 2992 2998 { 2993 QString Full = event.Event_Subtitle.left(event.Event_Subtitle.length() 2994 -3)+" "+ event.Description.mid(3); 2995 if (((position = Full.find(":")) != -1) || 2996 ((position = Full.find(".")) != -1)) 2999 QString Full = event.Event_Subtitle.replace(endsWith,"")+" "+ 3000 event.Description.replace(startsWith,""); 3001 if ((position = Full.find(terminatesWith)) != -1) 2997 3002 { 3003 if (Full[position] == '!' || Full[position] == '?') 3004 position++; 2998 3005 event.Event_Subtitle = Full.left(position); 2999 3006 event.Description = Full.mid(position+1); 3000 3007 } … … 3002 3009 else if (event.Event_Name.endsWith("...") && 3003 3010 event.Description.startsWith("...") && event.Event_Subtitle.isEmpty()) 3004 3011 { 3005 QString Full = event.Event_Name.left(event.Event_Name.length() 3006 -3)+" "+ event.Description.mid(3); 3007 if (((position = Full.find(":")) != -1) || 3008 ((position = Full.find(".")) != -1)) 3012 QString Full = event.Event_Name.replace(endsWith,"")+" "+ 3013 event.Description.replace(startsWith,""); 3014 if ((position = Full.find(terminatesWith)) != -1) 3009 3015 { 3016 if (Full[position] == '!' || Full[position] == '?') 3017 position++; 3010 3018 event.Event_Name = Full.left(position); 3011 3019 event.Description = Full.mid(position+1); 3012 3020 } … … 3014 3022 3015 3023 //Work out the episode numbers (if any) 3016 3024 bool series = false; 3017 QRegExp rx("^\\s*(\\d{1,2})/(\\d{1,2})\\.");3025 rx.setPattern("^\\s*(\\d{1,2})/(\\d{1,2})\\."); 3018 3026 QRegExp rx1("\\((Part|Pt)\\s+(\\d{1,2})\\s+of\\s+(\\d{1,2})\\)"); 3027 rx1.setCaseSensitive(FALSE); 3019 3028 if ((position = rx.search(event.Event_Name)) != -1) 3020 3029 { 3021 3030 event.PartNumber=rx.cap(1).toUInt(); … … 3313 3322 3314 3323 void SIParser::InitializeCategories() 3315 3324 { 3316 m_mapCategories[0x10] = tr("Movie s");3325 m_mapCategories[0x10] = tr("Movie"); 3317 3326 m_mapCategories[0x11] = tr("Movie") + " - " + 3318 3327 tr("Detective/Thriller"); 3319 3328 m_mapCategories[0x12] = tr("Movie")+ " - " +