Ticket #3429: mythtv-perl_bindings-use_recstartts_for_formatted_names_allow_starttime.patch
File mythtv-perl_bindings-use_recstartts_for_formatted_names_allow_starttime.patch, 7.1 KB (added by , 17 years ago) |
---|
-
bindings/perl/MythTV/Program.pm
213 213 $format = '%c %- %Y-%m-%d, %g-%i %A %- %S'; 214 214 } 215 215 } 216 # Start/end times 217 my ($ssecond, $sminute, $shour, $sday, $smonth, $syear) = localtime($self->{'starttime'}); 218 my ($esecond, $eminute, $ehour, $eday, $emonth, $eyear) = localtime($self->{'endtime'}); 216 # Recording start/end times 217 my ($ssecond, $sminute, $shour, $sday, $smonth, $syear) = localtime($self->{'recstartts'}); 218 my ($esecond, $eminute, $ehour, $eday, $emonth, $eyear) = localtime($self->{'recendts'}); 219 # Program start/end times 220 my ($spsecond, $spminute, $sphour, $spday, $spmonth, $spyear) = localtime($self->{'recstartts'}); 221 my ($epsecond, $epminute, $ephour, $epday, $epmonth, $epyear) = localtime($self->{'recendts'}); 219 222 # Format some fields we may be parsing below 220 # Start time223 # Recording start time 221 224 $syear += 1900; 222 225 $smonth++; 223 226 $smonth = "0$smonth" if ($smonth < 10); … … 232 235 } 233 236 $shour = "0$shour" if ($shour < 10); 234 237 $sminute = "0$sminute" if ($sminute < 10); 235 # End time238 # Recording end time 236 239 $eyear += 1900; 237 240 $emonth++; 238 241 $emonth = "0$emonth" if ($emonth < 10); … … 247 250 } 248 251 $ehour = "0$ehour" if ($ehour < 10); 249 252 $eminute = "0$eminute" if ($eminute < 10); 253 # Program start time 254 $spyear += 1900; 255 $spmonth++; 256 $spmonth = "0$spmonth" if ($spmonth < 10); 257 $spday = "0$spday" if ($spday < 10); 258 my $pmeridian = ($sphour > 12) ? 'PM' : 'AM'; 259 my $phour = ($sphour > 12) ? $sphour - 12 : $sphour; 260 if ($phour < 10) { 261 $phour = "0$phour"; 262 } 263 elsif ($phour < 1) { 264 $phour = 12; 265 } 266 $sphour = "0$sphour" if ($sphour < 10); 267 $spminute = "0$spminute" if ($spminute < 10); 268 # Program end time 269 $epyear += 1900; 270 $epmonth++; 271 $epmonth = "0$epmonth" if ($epmonth < 10); 272 $epday = "0$epday" if ($epday < 10); 273 my $epmeridian = ($ephour > 12) ? 'PM' : 'AM'; 274 my $epthour = ($ephour > 12) ? $ephour - 12 : $ephour; 275 if ($epthour < 10) { 276 $epthour = "0$epthour"; 277 } 278 elsif ($epthour < 1) { 279 $epthour = 12; 280 } 281 $ephour = "0$ephour" if ($ephour < 10); 282 $epminute = "0$epminute" if ($epminute < 10); 250 283 # Original airdate 251 284 my ($oyear, $omonth, $oday) = split('-', $self->{'airdate'}, 3); 252 285 # Build a list of name format options … … 261 294 ($fields{'cn'} = ($self->{'channel'}{'channum'} or '')) =~ s/%/%%/g; 262 295 ($fields{'cc'} = ($self->{'channel'}{'callsign'} or '')) =~ s/%/%%/g; 263 296 ($fields{'cN'} = ($self->{'channel'}{'name'} or '')) =~ s/%/%%/g; 264 # Start time297 # Recording start time 265 298 $fields{'y'} = substr($syear, 2); # year, 2 digits 266 299 $fields{'Y'} = $syear; # year, 4 digits 267 300 $fields{'n'} = int($smonth); # month … … 276 309 $fields{'s'} = $ssecond; # seconds 277 310 $fields{'a'} = lc($meridian); # am/pm 278 311 $fields{'A'} = $meridian; # AM/PM 279 # End time312 # Recording end time 280 313 $fields{'ey'} = substr($eyear, 2); # year, 2 digits 281 314 $fields{'eY'} = $eyear; # year, 4 digits 282 315 $fields{'en'} = int($emonth); # month … … 291 324 $fields{'es'} = $esecond; # seconds 292 325 $fields{'ea'} = lc($emeridian); # am/pm 293 326 $fields{'eA'} = $emeridian; # AM/PM 327 # Program start time 328 $fields{'py'} = substr($spyear, 2); # year, 2 digits 329 $fields{'pY'} = $spyear; # year, 4 digits 330 $fields{'pn'} = int($spmonth); # month 331 $fields{'pm'} = $spmonth; # month, leading zero 332 $fields{'pj'} = int($spday); # day of month 333 $fields{'pd'} = $spday; # day of month, leading zero 334 $fields{'pg'} = int($phour); # 12-hour hour 335 $fields{'pG'} = int($sphour); # 24-hour hour 336 $fields{'ph'} = $phour; # 12-hour hour, with leading zero 337 $fields{'pH'} = $sphour; # 24-hour hour, with leading zero 338 $fields{'pi'} = $spminute; # minutes 339 $fields{'ps'} = $spsecond; # seconds 340 $fields{'pa'} = lc($pmeridian); # am/pm 341 $fields{'pA'} = $pmeridian; # AM/PM 342 # Program end time 343 $fields{'pey'} = substr($epyear, 2);# year, 2 digits 344 $fields{'peY'} = $epyear; # year, 4 digits 345 $fields{'pen'} = int($epmonth); # month 346 $fields{'pem'} = $epmonth; # month, leading zero 347 $fields{'pej'} = int($epday); # day of month 348 $fields{'ped'} = $epday; # day of month, leading zero 349 $fields{'peg'} = int($epthour); # 12-hour hour 350 $fields{'peG'} = int($ephour); # 24-hour hour 351 $fields{'peh'} = $epthour; # 12-hour hour, with leading zero 352 $fields{'peH'} = $ephour; # 24-hour hour, with leading zero 353 $fields{'pei'} = $epminute; # minutes 354 $fields{'pes'} = $epsecond; # seconds 355 $fields{'pea'} = lc($epmeridian); # am/pm 356 $fields{'peA'} = $epmeridian; # AM/PM 294 357 # Original Airdate 295 358 $fields{'oy'} = substr($oyear, 2); # year, 2 digits 296 359 $fields{'oY'} = $oyear; # year, 4 digits -
contrib/mythrename.pl
102 102 \%- = separator character 103 103 / = directory/folder (path separator) 104 104 105 * For end time, prepend an "e" to the appropriate time/date format code 106 above; i.e. "\%eG" gives the 24-hour hour for the end time. 105 * The time/date format codes above represent the recording start times. 107 106 107 * For recording end time, prepend an "e" to the appropriate time/date 108 format code above; i.e. "\%eG" gives the 24-hour hour for the end time. 109 110 * For program start time, prepend a "p" to the appropriate time/date 111 format code above; i.e. "\%pi" gives the minutes for the program start 112 time. The program start time is the time from the listings data and is 113 not affected by when the recording started. Therefore, using program 114 start (or end) times may result in duplicate names. In that case, the 115 script will append a "counter" value to the name. 116 117 * For program end time, prepend a "pe" to the appropriate time/date format 118 code above; i.e. "\%pes" gives the seconds for the program end time. 119 108 120 * For original airdate, prepend an "o" to the year, month, or day format 109 121 codes above; i.e. "\%oY" gives the year in which the episode was first 110 122 aired.