Ticket #1321: uk-eit-guide-fixups.diff
File uk-eit-guide-fixups.diff, 1.9 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/eitfixup.cpp
old new 130 130 */ 131 131 void EITFixUp::FixStyle2(Event &event) 132 132 { 133 const uint SUBTITLE_PCT = 50; //% of description to allow subtitle up to 133 const uint SUBTITLE_PCT = 35; //% of description to allow subtitle up to 134 const uint16_t SUBTITLE_MAX_LEN = 128; // max length of subtitle field in db. 134 135 int position = event.Description.find("New Series"); 135 136 if (position != -1) 136 137 { 137 138 //Do something here 138 139 } 140 QRegExp sub("\\[.*S\\]"); 141 position = event.Description.find(sub); 142 if (position != -1) 143 { 144 event.SubTitled=true; 145 } 146 139 147 //BBC three case (could add another record here ?) 140 148 QRegExp rx("\\s*(Then|Followed by) 60 Seconds\\."); 141 149 rx.setCaseSensitive(false); … … 160 168 else if ((position = event.Description.find(":")) != -1) 161 169 { 162 170 // if the subtitle is less than 50% of the description use it. 163 if ((position*100)/event.Description.length() < SUBTITLE_PCT) 171 if ((position < SUBTITLE_MAX_LEN) && 172 ((position*100)/event.Description.length() < SUBTITLE_PCT)) 164 173 { 165 174 event.Event_Subtitle = event.Description.left(position); 166 175 event.Description = event.Description.mid(position+1); … … 168 177 } 169 178 else if ((position = event.Description.find(terminatesWith)) != -1) 170 179 { 171 if ((position*100)/event.Description.length() < SUBTITLE_PCT) 180 if ((position < SUBTITLE_MAX_LEN) && 181 ((position*100)/event.Description.length() < SUBTITLE_PCT)) 172 182 { 173 183 event.Event_Subtitle = event.Description.left(position+1); 174 184 event.Description = event.Description.mid(position+2);