Search in sources :

Example 11 with Series

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;
}
Also used : Series(com.furyviewer.domain.Series)

Aggregations

Series (com.furyviewer.domain.Series)11 Transactional (org.springframework.transaction.annotation.Transactional)6 Timed (com.codahale.metrics.annotation.Timed)5 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 SeriesOmdbDTO (com.furyviewer.service.dto.OpenMovieDatabase.SeriesOmdbDTO)2 FavouriteSeries (com.furyviewer.domain.FavouriteSeries)1 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1