use of com.furyviewer.domain.Series in project FuryViewer by TheDoctor-95.
the class SeriesOmdbDTOService method importSeries.
/**
* Convierte la informacion de una series de OMDB al formato de FuryViewer.
* @param seriesOmdbDTO SeriesOmdbDTO | Informacion de la Series propocionada por la api.
* @return Series | Contiene la informacion de una series en el formato FuryViewer.
*/
public Series importSeries(SeriesOmdbDTO seriesOmdbDTO) {
Series ss = new Series();
ss.setName(seriesOmdbDTO.getTitle());
ss.setDescription(stringApiCorrectorService.eraserNA(seriesOmdbDTO.getPlot()));
if (seriesOmdbDTO.getYear().length() == 5) {
ss.setState(SeriesEmittingEnum.emiting);
} else {
ss.setState(SeriesEmittingEnum.ended);
}
ss.setReleaseDate(dateConversorService.releseDateOMDB(seriesOmdbDTO.getReleased()));
ss.setImgUrl(stringApiCorrectorService.eraserNA(seriesOmdbDTO.getPoster()));
ss.setImdb_id(stringApiCorrectorService.eraserNA(seriesOmdbDTO.getImdbID()));
ss.setAwards(stringApiCorrectorService.eraserNA(seriesOmdbDTO.getAwards()));
ss.setGenres(genreService.importGenre(seriesOmdbDTO.getGenre()));
ss.setCountry(countryService.importCountry(seriesOmdbDTO.getCountry()));
ss.setCompany(companyService.importCompany(seriesTmdbDTOService.getCompanyName(seriesOmdbDTO.getTitle())));
ss = seriesRepository.save(ss);
trailerTmdbDTOService.importSeriesTrailer(ss);
marksService.markTransformationSeries(seriesOmdbDTO.getRatings(), ss);
seasonOmdbDTOService.importSeason(seriesOmdbDTO.getTitle(), Integer.parseInt(seriesOmdbDTO.getTotalSeasons()));
return ss;
}
Aggregations