private void updateSchedule(Item item) { Iterable<Broadcast> broadcasts = Iterables.concat(Iterables.transform(item.getVersions(), Version.TO_BROADCASTS)); for (Broadcast broadcast : broadcasts) { Maybe<Channel> channel = channelResolver.fromUri(broadcast.getBroadcastOn()); if (channel.hasValue()) { scheduleWriter.replaceScheduleBlock( item.getPublisher(), channel.requireValue(), ImmutableSet.of(new ScheduleEntry.ItemRefAndBroadcast(item, broadcast))); } } }
public C4AtomApi(ChannelResolver channelResolver) { channelMap = ImmutableBiMap.<String, Channel>builder() .put("C4", channelResolver.fromUri("http://www.channel4.com").requireValue()) .put("M4", channelResolver.fromUri("http://www.channel4.com/more4").requireValue()) .put("F4", channelResolver.fromUri("http://film4.com").requireValue()) .put("E4", channelResolver.fromUri("http://www.e4.com").requireValue()) .put("4M", channelResolver.fromUri("http://www.4music.com").requireValue()) .put("4S", channelResolver.fromUri("http://www.channel4.com/4seven").requireValue()) .build(); }
private String extractNetwork(List<Broadcast> broadcasts) { return channelResolver .fromUri(TRANSMISSION_ORDERING.min(broadcasts).getBroadcastOn()) .requireValue() .getTitle(); }