<commit_before>package com.dsbeckham.nasaimageryfetcher.util;

import com.dsbeckham.nasaimageryfetcher.model.ApodMorphIoModel;
import com.dsbeckham.nasaimageryfetcher.model.ApodNasaGovModel;
import com.dsbeckham.nasaimageryfetcher.model.IotdRssModel;
import com.dsbeckham.nasaimageryfetcher.model.UniversalImageModel;

public class ModelUtils {
    public static final String MODEL_TYPE_IOTD = "iotd";
    public static final String MODEL_TYPE_APOD = "apod";

    public static UniversalImageModel convertIotdRssModelChannelItem(IotdRssModel.Channel.Item iotdRssModelChannelItem) {
        UniversalImageModel universalImageModel = new UniversalImageModel();
        universalImageModel.setDate(DateUtils.convertDateToCustomDateFormat(iotdRssModelChannelItem.getPubDate(), "EEE, dd MMM yyyy HH:mm zzz", "yyyy-MM-dd"));
        universalImageModel.setDescription(iotdRssModelChannelItem.getDescription());
        universalImageModel.setImageThumbnailUrl(iotdRssModelChannelItem.getEnclosure().getUrl());
        // The RSS feed always links to the image thumbnail URL. The full image URL is a few directories down.
        universalImageModel.setImageUrl(iotdRssModelChannelItem.getEnclosure().getUrl().replace("styles/full_width_feature/public/", ""));
        universalImageModel.setPageUrl(iotdRssModelChannelItem.getLink());
        universalImageModel.setTitle(iotdRssModelChannelItem.getTitle());
        universalImageModel.setType(MODEL_TYPE_IOTD);
        return universalImageModel;
    }

    public static UniversalImageModel convertApodMorphIoModel(ApodMorphIoModel apodMorphIoModel) {
        UniversalImageModel universalImageModel = new UniversalImageModel();
        universalImageModel.setCredit(apodMorphIoModel.getCredit());
        universalImageModel.setDate(apodMorphIoModel.getDate());
        universalImageModel.setDescription(apodMorphIoModel.getExplanation());
        universalImageModel.setImageThumbnailUrl(apodMorphIoModel.getPictureThumbnailUrl());
        universalImageModel.setImageUrl(apodMorphIoModel.getPictureUrl());
        universalImageModel.setPageUrl(apodMorphIoModel.getUrl());
        universalImageModel.setTitle(apodMorphIoModel.getTitle());
        universalImageModel.setType(MODEL_TYPE_APOD);
        return universalImageModel;
    }

    public static UniversalImageModel convertApodNasaGovModel(ApodNasaGovModel apodNasaGovModel) {
        UniversalImageModel universalImageModel = new UniversalImageModel();
        universalImageModel.setCredit(apodNasaGovModel.getCopyright());<commit_msg>Fix RSS thumbnail and full size image locations<commit_after>package com.dsbeckham.nasaimageryfetcher.util;

import com.dsbeckham.nasaimageryfetcher.model.ApodMorphIoModel;
import com.dsbeckham.nasaimageryfetcher.model.ApodNasaGovModel;
import com.dsbeckham.nasaimageryfetcher.model.IotdRssModel;
import com.dsbeckham.nasaimageryfetcher.model.UniversalImageModel;

public class ModelUtils {
    public static final String MODEL_TYPE_IOTD = "iotd";
    public static final String MODEL_TYPE_APOD = "apod";

    public static UniversalImageModel convertIotdRssModelChannelItem(IotdRssModel.Channel.Item iotdRssModelChannelItem) {
        UniversalImageModel universalImageModel = new UniversalImageModel();
        universalImageModel.setDate(DateUtils.convertDateToCustomDateFormat(iotdRssModelChannelItem.getPubDate(), "EEE, dd MMM yyyy HH:mm zzz", "yyyy-MM-dd"));
        universalImageModel.setDescription(iotdRssModelChannelItem.getDescription());
        universalImageModel.setImageUrl(iotdRssModelChannelItem.getEnclosure().getUrl());
        // The RSS feed always links to the full URL. The thumbnail URL is a different directory.
        universalImageModel.setImageThumbnailUrl(iotdRssModelChannelItem.getEnclosure().getUrl().replace("files/thumbnails/", "files/styles/full_width_feature/public/thumbnails/"));
        universalImageModel.setPageUrl(iotdRssModelChannelItem.getLink());
        universalImageModel.setTitle(iotdRssModelChannelItem.getTitle());
        universalImageModel.setType(MODEL_TYPE_IOTD);
        return universalImageModel;
    }

    public static UniversalImageModel convertApodMorphIoModel(ApodMorphIoModel apodMorphIoModel) {
        UniversalImageModel universalImageModel = new UniversalImageModel();
        universalImageModel.setCredit(apodMorphIoModel.getCredit());
        universalImageModel.setDate(apodMorphIoModel.getDate());
        universalImageModel.setDescription(apodMorphIoModel.getExplanation());
        universalImageModel.setImageThumbnailUrl(apodMorphIoModel.getPictureThumbnailUrl());
        universalImageModel.setImageUrl(apodMorphIoModel.getPictureUrl());
        universalImageModel.setPageUrl(apodMorphIoModel.getUrl());
        universalImageModel.setTitle(apodMorphIoModel.getTitle());
        universalImageModel.setType(MODEL_TYPE_APOD);
        return universalImageModel;
    }

    public static UniversalImageModel convertApodNasaGovModel(ApodNasaGovModel apodNasaGovModel) {
        UniversalImageModel universalImageModel = new UniversalImageModel();
        universalImageModel.setCredit(apodNasaGovModel.getCopyright());
{'fraction_non_alphanumeric': 0.0796271120605943, 'fraction_numerical': 0.0, 'mean_word_length': 5.645161290322581, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1695528', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1477, 'n_words': 200}