mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
* api/urlbuilders/movie: Auto format. * graphql+pkg+ui: Implement scraping movies by URL. This patch implements the missing required boilerplate for scraping movies by URL, using performers and scenes as a reference. Although this patch contains a big chunck of ground work for enabling scraping movies by fragment, the feature would require additional changes to be completely implemented and was not tested. * graphql+pkg+ui: Scrape movie studio. Extends and corrects the movie model for the ability to store and dereference studio IDs with received studio string from the scraper. This was done with Scenes as a reference. For simplicity the duplication of having `ScrapedMovieStudio` and `ScrapedSceneStudio` was kept, which should probably be refactored to be the same type in the model in the future. * ui/movies: Add movie scrape dialog. Adds possibility to update existing movie entries with the URL scraper. For this the MovieScrapeDialog.tsx was implemented with Performers and Scenes as a reference. In addition DurationUtils needs to be called one time for converting seconds from the model to the string that is displayed in the component. This seemed the least intrusive to me as it kept a ScrapeResult<string> type compatible with ScrapedInputGroupRow.
159 lines
7.2 KiB
Go
159 lines
7.2 KiB
Go
package models
|
|
|
|
import (
|
|
"database/sql"
|
|
)
|
|
|
|
type ScrapedItem struct {
|
|
ID int `db:"id" json:"id"`
|
|
Title sql.NullString `db:"title" json:"title"`
|
|
Description sql.NullString `db:"description" json:"description"`
|
|
URL sql.NullString `db:"url" json:"url"`
|
|
Date SQLiteDate `db:"date" json:"date"`
|
|
Rating sql.NullString `db:"rating" json:"rating"`
|
|
Tags sql.NullString `db:"tags" json:"tags"`
|
|
Models sql.NullString `db:"models" json:"models"`
|
|
Episode sql.NullInt64 `db:"episode" json:"episode"`
|
|
GalleryFilename sql.NullString `db:"gallery_filename" json:"gallery_filename"`
|
|
GalleryURL sql.NullString `db:"gallery_url" json:"gallery_url"`
|
|
VideoFilename sql.NullString `db:"video_filename" json:"video_filename"`
|
|
VideoURL sql.NullString `db:"video_url" json:"video_url"`
|
|
StudioID sql.NullInt64 `db:"studio_id,omitempty" json:"studio_id"`
|
|
CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"`
|
|
UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
|
|
}
|
|
|
|
type ScrapedPerformer struct {
|
|
Name *string `graphql:"name" json:"name"`
|
|
Gender *string `graphql:"gender" json:"gender"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
Twitter *string `graphql:"twitter" json:"twitter"`
|
|
Instagram *string `graphql:"instagram" json:"instagram"`
|
|
Birthdate *string `graphql:"birthdate" json:"birthdate"`
|
|
Ethnicity *string `graphql:"ethnicity" json:"ethnicity"`
|
|
Country *string `graphql:"country" json:"country"`
|
|
EyeColor *string `graphql:"eye_color" json:"eye_color"`
|
|
Height *string `graphql:"height" json:"height"`
|
|
Measurements *string `graphql:"measurements" json:"measurements"`
|
|
FakeTits *string `graphql:"fake_tits" json:"fake_tits"`
|
|
CareerLength *string `graphql:"career_length" json:"career_length"`
|
|
Tattoos *string `graphql:"tattoos" json:"tattoos"`
|
|
Piercings *string `graphql:"piercings" json:"piercings"`
|
|
Aliases *string `graphql:"aliases" json:"aliases"`
|
|
Image *string `graphql:"image" json:"image"`
|
|
}
|
|
|
|
// this type has no Image field
|
|
type ScrapedPerformerStash struct {
|
|
Name *string `graphql:"name" json:"name"`
|
|
Gender *string `graphql:"gender" json:"gender"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
Twitter *string `graphql:"twitter" json:"twitter"`
|
|
Instagram *string `graphql:"instagram" json:"instagram"`
|
|
Birthdate *string `graphql:"birthdate" json:"birthdate"`
|
|
Ethnicity *string `graphql:"ethnicity" json:"ethnicity"`
|
|
Country *string `graphql:"country" json:"country"`
|
|
EyeColor *string `graphql:"eye_color" json:"eye_color"`
|
|
Height *string `graphql:"height" json:"height"`
|
|
Measurements *string `graphql:"measurements" json:"measurements"`
|
|
FakeTits *string `graphql:"fake_tits" json:"fake_tits"`
|
|
CareerLength *string `graphql:"career_length" json:"career_length"`
|
|
Tattoos *string `graphql:"tattoos" json:"tattoos"`
|
|
Piercings *string `graphql:"piercings" json:"piercings"`
|
|
Aliases *string `graphql:"aliases" json:"aliases"`
|
|
}
|
|
|
|
type ScrapedScene struct {
|
|
Title *string `graphql:"title" json:"title"`
|
|
Details *string `graphql:"details" json:"details"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
Date *string `graphql:"date" json:"date"`
|
|
Image *string `graphql:"image" json:"image"`
|
|
File *SceneFileType `graphql:"file" json:"file"`
|
|
Studio *ScrapedSceneStudio `graphql:"studio" json:"studio"`
|
|
Movies []*ScrapedSceneMovie `graphql:"movies" json:"movies"`
|
|
Tags []*ScrapedSceneTag `graphql:"tags" json:"tags"`
|
|
Performers []*ScrapedScenePerformer `graphql:"performers" json:"performers"`
|
|
}
|
|
|
|
// stash doesn't return image, and we need id
|
|
type ScrapedSceneStash struct {
|
|
ID string `graphql:"id" json:"id"`
|
|
Title *string `graphql:"title" json:"title"`
|
|
Details *string `graphql:"details" json:"details"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
Date *string `graphql:"date" json:"date"`
|
|
File *SceneFileType `graphql:"file" json:"file"`
|
|
Studio *ScrapedSceneStudio `graphql:"studio" json:"studio"`
|
|
Tags []*ScrapedSceneTag `graphql:"tags" json:"tags"`
|
|
Performers []*ScrapedScenePerformer `graphql:"performers" json:"performers"`
|
|
}
|
|
|
|
type ScrapedScenePerformer struct {
|
|
// Set if performer matched
|
|
ID *string `graphql:"id" json:"id"`
|
|
Name string `graphql:"name" json:"name"`
|
|
Gender *string `graphql:"gender" json:"gender"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
Twitter *string `graphql:"twitter" json:"twitter"`
|
|
Instagram *string `graphql:"instagram" json:"instagram"`
|
|
Birthdate *string `graphql:"birthdate" json:"birthdate"`
|
|
Ethnicity *string `graphql:"ethnicity" json:"ethnicity"`
|
|
Country *string `graphql:"country" json:"country"`
|
|
EyeColor *string `graphql:"eye_color" json:"eye_color"`
|
|
Height *string `graphql:"height" json:"height"`
|
|
Measurements *string `graphql:"measurements" json:"measurements"`
|
|
FakeTits *string `graphql:"fake_tits" json:"fake_tits"`
|
|
CareerLength *string `graphql:"career_length" json:"career_length"`
|
|
Tattoos *string `graphql:"tattoos" json:"tattoos"`
|
|
Piercings *string `graphql:"piercings" json:"piercings"`
|
|
Aliases *string `graphql:"aliases" json:"aliases"`
|
|
}
|
|
|
|
type ScrapedSceneStudio struct {
|
|
// Set if studio matched
|
|
ID *string `graphql:"id" json:"id"`
|
|
Name string `graphql:"name" json:"name"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
}
|
|
|
|
type ScrapedSceneMovie struct {
|
|
// Set if movie matched
|
|
ID *string `graphql:"id" json:"id"`
|
|
Name string `graphql:"name" json:"name"`
|
|
Aliases string `graphql:"aliases" json:"aliases"`
|
|
Duration string `graphql:"duration" json:"duration"`
|
|
Date string `graphql:"date" json:"date"`
|
|
Rating string `graphql:"rating" json:"rating"`
|
|
Director string `graphql:"director" json:"director"`
|
|
Synopsis string `graphql:"synopsis" json:"synopsis"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
}
|
|
|
|
type ScrapedSceneTag struct {
|
|
// Set if tag matched
|
|
ID *string `graphql:"id" json:"id"`
|
|
Name string `graphql:"name" json:"name"`
|
|
}
|
|
|
|
type ScrapedMovie struct {
|
|
Name *string `graphql:"name" json:"name"`
|
|
Aliases *string `graphql:"aliases" json:"aliases"`
|
|
Duration *string `graphql:"duration" json:"duration"`
|
|
Date *string `graphql:"date" json:"date"`
|
|
Rating *string `graphql:"rating" json:"rating"`
|
|
Director *string `graphql:"director" json:"director"`
|
|
Studio *ScrapedMovieStudio `graphql:"studio" json:"studio"`
|
|
Synopsis *string `graphql:"synopsis" json:"synopsis"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
FrontImage *string `graphql:"front_image" json:"front_image"`
|
|
BackImage *string `graphql:"back_image" json:"back_image"`
|
|
}
|
|
|
|
type ScrapedMovieStudio struct {
|
|
// Set if studio matched
|
|
ID *string `graphql:"id" json:"id"`
|
|
Name string `graphql:"name" json:"name"`
|
|
URL *string `graphql:"url" json:"url"`
|
|
}
|