mirror of
https://github.com/moparisthebest/rcrdit
synced 2024-12-21 23:08:57 -05:00
Make sure our guide data always contains all programs that end since the "Top of the hour"
This commit is contained in:
parent
3c23769504
commit
ad24fcc8a3
@ -43,9 +43,17 @@ public class Channel {
|
||||
this.displayNames = fromChannel.displayNames;
|
||||
this.id = fromChannel.id;
|
||||
List<Program> programsForNewChannel = new ArrayList<>();
|
||||
fromChannel.getPrograms().stream().filter((program) -> ((program.getStop().isAfter(startTime) && program.getStop().isBefore(stopTime)) || (program.getStart().isBefore(stopTime) && program.getStart().isAfter(startTime) )|| (program.getStart().isBefore(startTime) && program.getStop().isAfter(stopTime) ) || program.getStart().equals(startTime) || program.getStop().equals(stopTime) )).forEach((program) -> {
|
||||
programsForNewChannel.add(program);
|
||||
fromChannel.getPrograms().stream().forEach((program) -> {
|
||||
boolean startsDuringDisplayTime = program.getStart().isAfter(startTime) && program.getStart().isBefore(stopTime);
|
||||
boolean endsDuringDisplayTime = program.getStop().isAfter(startTime) && program.getStop().isBefore(stopTime);
|
||||
boolean stopsAtStopTime = program.getStop().equals(stopTime);
|
||||
boolean startsAtStartTime = program.getStart().equals(startTime);
|
||||
boolean startsBeforeStartTimeAndEndsAfterEndTime = program.getStart().isBefore(startTime) && program.getStop().isAfter(stopTime);
|
||||
if (startsDuringDisplayTime || endsDuringDisplayTime || stopsAtStopTime || startsAtStartTime || startsBeforeStartTimeAndEndsAfterEndTime) {
|
||||
programsForNewChannel.add(program);
|
||||
}
|
||||
});
|
||||
|
||||
this.programs.addAll(programsForNewChannel);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,9 @@ import com.moparisthebest.sxf4j.impl.AbstractXmlElement;
|
||||
import com.moparisthebest.sxf4j.impl.XmlElement;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.time.format.ResolverStyle;
|
||||
@ -126,8 +128,9 @@ public class Tv {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final Instant now = Instant.now().truncatedTo(ChronoUnit.MINUTES);
|
||||
final LocalDateTime topOfHour = LocalDateTime.now().withMinute(0);
|
||||
final Instant now = topOfHour.toInstant(ZoneOffset.systemDefault().getRules().getOffset(topOfHour)).truncatedTo(ChronoUnit.MINUTES);
|
||||
//final Instant now = Instant.now()..truncatedTo(ChronoUnit.MINUTES);
|
||||
for (final XmlElement prog : tv.getChildren("programme")) {
|
||||
final String chanId = prog.getAttribute("channel");
|
||||
final Channel channel = chanIdToChannel.get(chanId);
|
||||
|
Loading…
Reference in New Issue
Block a user