示例#1
0
  private void setDescription(ProgData progData, Item item, boolean isWelshChannel) {
    if (progData.getBillings() != null) {
      for (Billing billing : progData.getBillings().getBilling()) {

        if ((item.getDescription() == null || !isWelshChannel)
            && billing.getType().equals(BILLING_DESCRIPTION)) {
          item.setDescription(billing.getvalue());
        }
        if ((item.getShortDescription() == null || !isWelshChannel)
            && billing.getType().equals(BILLING_SHORT_DESCRIPTION)) {
          item.setShortDescription(billing.getvalue());
        }
        if ((item.getMediumDescription() == null || !isWelshChannel)
            && billing.getType().equals(BILLING_MEDIUM_DESCRIPTION)) {
          item.setMediumDescription(billing.getvalue());
        }
        if ((item.getLongDescription() == null || !isWelshChannel)
            && billing.getType().equals(BILLING_LONG_DESCRIPTION)) {
          item.setLongDescription(billing.getvalue());
        }
      }
    }
  }
示例#2
0
  private Broadcast setCommonDetails(
      ProgData progData, Channel channel, DateTimeZone zone, Item episode, Timestamp updatedAt) {

    // currently Welsh channels have Welsh titles/descriptions
    // which flip the English ones, resulting in many writes. We'll only take the Welsh title if we
    // don't
    // already have a title from another channel
    if (episode.getTitle() == null || !channel.getUri().contains("wales")) {
      if (progData.getEpisodeTitle() != null) {
        episode.setTitle(progData.getEpisodeTitle());
      } else {
        episode.setTitle(progData.getTitle());
      }
    }

    if (progData.getBillings() != null) {
      for (Billing billing : progData.getBillings().getBilling()) {
        if ((episode.getDescription() == null || !channel.getUri().contains("wales"))
            && billing.getType().equals("synopsis")) {
          episode.setDescription(billing.getvalue());
        }
        if ((episode.getShortDescription() == null || !channel.getUri().contains("wales"))
            && billing.getType().equals("pa_detail1")) {
          episode.setShortDescription(billing.getvalue());
        }
        if ((episode.getMediumDescription() == null || !channel.getUri().contains("wales"))
            && billing.getType().equals("pa_detail2")) {
          episode.setMediumDescription(billing.getvalue());
        }
        if ((episode.getLongDescription() == null || !channel.getUri().contains("wales"))
            && billing.getType().equals("pa_detail3")) {
          episode.setLongDescription(billing.getvalue());
        }
      }
    }

    episode.setMediaType(channel.getMediaType());
    episode.setSpecialization(specialization(progData, channel));
    setGenres(progData, episode);

    if (progData.getCountry() != null) {
      episode.setCountriesOfOrigin(countryMap.parseCountries(progData.getCountry()));
    }

    if (progData.getAttr() != null) {
      episode.setBlackAndWhite(getBooleanValue(progData.getAttr().getBw()));
    }

    selectImages(
        progData.getPictures(),
        episode,
        PA_PICTURE_TYPE_EPISODE,
        PA_PICTURE_TYPE_SERIES,
        Maybe.just(PA_PICTURE_TYPE_BRAND));

    episode.setPeople(people(progData));

    Version version = findBestVersion(episode.getVersions());
    version.set3d(getBooleanValue(progData.getAttr().getThreeD()));
    Duration duration = Duration.standardMinutes(Long.valueOf(progData.getDuration()));
    version.setDuration(duration);
    setCertificate(progData, episode);

    Broadcast broadcast = broadcast(progData, channel, zone, updatedAt);
    addBroadcast(version, broadcast);
    return broadcast;
  }