В базу заносится название и описание кино/сериала
This commit is contained in:
@@ -59,7 +59,11 @@ public class OnlinelifeScanner implements ScannerCinema {
|
||||
File saveTo = new File(this.saveToDir, url.substring(url.lastIndexOf("/")+1, url.lastIndexOf("."))+".jpg");
|
||||
this.fileDownloader.addFile(element.attr("src"), saveTo);
|
||||
|
||||
CinemaDocument cinemaDocument = new CinemaDocument(saveTo.getAbsolutePath(), this.getName());
|
||||
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.setTypeWarez(this.getName());
|
||||
repository.save(cinemaDocument);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,12 @@ public class SeasonvarScanner implements ScannerCinema {
|
||||
File saveTo = new File(this.saveTo, url.substring(url.indexOf("/")+1, url.lastIndexOf("."))+".jpg");
|
||||
this.fileDownloader.addFile(element.attr("src"), saveTo);
|
||||
|
||||
CinemaDocument cinemaDocument = new CinemaDocument(saveTo.getAbsolutePath(), this.getName());
|
||||
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.setTypeWarez(this.getName());
|
||||
this.repository.save(cinemaDocument);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,17 +13,18 @@ import org.springframework.data.mongodb.core.mapping.Document;
|
||||
@Document(collection = "cinema")
|
||||
@NoArgsConstructor
|
||||
public class CinemaDocument {
|
||||
@Id
|
||||
@Id @Getter
|
||||
private String id;
|
||||
|
||||
@Getter @Setter
|
||||
private String title;
|
||||
|
||||
@Getter @Setter
|
||||
private String description;
|
||||
|
||||
@Getter @Setter
|
||||
private String fileName;
|
||||
|
||||
@Getter @Setter
|
||||
private String typeWarez;
|
||||
|
||||
public CinemaDocument(String fileName, String typeWarez) {
|
||||
this.fileName = fileName;
|
||||
this.typeWarez = typeWarez;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user