0

Отображение постеров к фильмам

This commit is contained in:
2017-05-26 01:26:08 +03:00
parent c70129ae9d
commit 3ec91237eb
5 changed files with 36 additions and 13 deletions

View File

@@ -62,13 +62,13 @@ public class OnlinelifeScanner implements ScannerCinema {
Document document = Jsoup.parse(browser.get(url));
Element element = document.getElementsByClass("full-poster").get(0);
File saveTo = new File(this.saveToDir, url.substring(url.lastIndexOf("/")+1, url.lastIndexOf("."))+".jpg");
this.fileDownloader.addFile(element.attr("src"), saveTo);
String pathFile = "onlinelife/"+url.substring(url.lastIndexOf("/")+1, url.lastIndexOf("."))+".jpg";
this.fileDownloader.addFile(element.attr("src"), new File(this.saveToDir, pathFile));
CinemaDocument cinemaDocument = new CinemaDocument();
cinemaDocument.setTitle(document.getElementsByClass("film_info").get(0).child(0).child(0).text().trim());
cinemaDocument.setDescription(document.getElementsByClass("film-description").get(0).text());
cinemaDocument.setFileName(saveTo.getAbsolutePath());
cinemaDocument.setFileName(pathFile);
cinemaDocument.setTypeWarez(this.getName());
cinemaDocument.setUrl(url);
repository.save(cinemaDocument);

View File

@@ -58,14 +58,14 @@ public class SeasonvarScanner implements ScannerCinema {
Document document = Jsoup.parse(browser.get(url));
Element element = document.getElementsByAttributeValue("itemprop", "thumbnailUrl").get(0);
File saveTo = new File(this.saveTo, url.substring(url.lastIndexOf("/")+1, url.lastIndexOf("."))+".jpg");
this.fileDownloader.addFile(element.attr("src"), saveTo);
String pathFile = "seasonvar/"+url.substring(url.lastIndexOf("/")+1, url.lastIndexOf("."))+".jpg";
this.fileDownloader.addFile(element.attr("src"), new File(this.saveTo, pathFile));
CinemaDocument cinemaDocument = new CinemaDocument();
String title = document.getElementsByClass("pgs-sinfo-title").get(0).text();
cinemaDocument.setTitle(title.replaceAll("^Сериал ", "").replaceAll(" онлайн$", ""));
cinemaDocument.setDescription(document.getElementsByAttributeValue("itemprop", "description").get(0).text());
cinemaDocument.setFileName(saveTo.getAbsolutePath());
cinemaDocument.setFileName(pathFile);
cinemaDocument.setTypeWarez(this.getName());
cinemaDocument.setUrl(url);
this.repository.save(cinemaDocument);