mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Include scene o-counter in import/export (#488)
* Include o-counter in import/export * Fix scene card o-counter display
This commit is contained in:
@@ -40,6 +40,7 @@ type Scene struct {
|
|||||||
URL string `json:"url,omitempty"`
|
URL string `json:"url,omitempty"`
|
||||||
Date string `json:"date,omitempty"`
|
Date string `json:"date,omitempty"`
|
||||||
Rating int `json:"rating,omitempty"`
|
Rating int `json:"rating,omitempty"`
|
||||||
|
OCounter int `json:"o_counter,omitempty"`
|
||||||
Details string `json:"details,omitempty"`
|
Details string `json:"details,omitempty"`
|
||||||
Gallery string `json:"gallery,omitempty"`
|
Gallery string `json:"gallery,omitempty"`
|
||||||
Performers []string `json:"performers,omitempty"`
|
Performers []string `json:"performers,omitempty"`
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ func (t *ExportTask) ExportScenes(ctx context.Context) {
|
|||||||
if scene.Rating.Valid {
|
if scene.Rating.Valid {
|
||||||
newSceneJSON.Rating = int(scene.Rating.Int64)
|
newSceneJSON.Rating = int(scene.Rating.Int64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newSceneJSON.OCounter = scene.OCounter
|
||||||
|
|
||||||
if scene.Details.Valid {
|
if scene.Details.Valid {
|
||||||
newSceneJSON.Details = scene.Details.String
|
newSceneJSON.Details = scene.Details.String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -489,6 +489,8 @@ func (t *ImportTask) ImportScenes(ctx context.Context) {
|
|||||||
if sceneJSON.Rating != 0 {
|
if sceneJSON.Rating != 0 {
|
||||||
newScene.Rating = sql.NullInt64{Int64: int64(sceneJSON.Rating), Valid: true}
|
newScene.Rating = sql.NullInt64{Int64: int64(sceneJSON.Rating), Valid: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newScene.OCounter = sceneJSON.OCounter
|
||||||
newScene.CreatedAt = models.SQLiteTimestamp{Timestamp: t.getTimeFromJSONTime(sceneJSON.CreatedAt)}
|
newScene.CreatedAt = models.SQLiteTimestamp{Timestamp: t.getTimeFromJSONTime(sceneJSON.CreatedAt)}
|
||||||
newScene.UpdatedAt = models.SQLiteTimestamp{Timestamp: t.getTimeFromJSONTime(sceneJSON.UpdatedAt)}
|
newScene.UpdatedAt = models.SQLiteTimestamp{Timestamp: t.getTimeFromJSONTime(sceneJSON.UpdatedAt)}
|
||||||
|
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ func NewSceneQueryBuilder() SceneQueryBuilder {
|
|||||||
func (qb *SceneQueryBuilder) Create(newScene Scene, tx *sqlx.Tx) (*Scene, error) {
|
func (qb *SceneQueryBuilder) Create(newScene Scene, tx *sqlx.Tx) (*Scene, error) {
|
||||||
ensureTx(tx)
|
ensureTx(tx)
|
||||||
result, err := tx.NamedExec(
|
result, err := tx.NamedExec(
|
||||||
`INSERT INTO scenes (checksum, path, title, details, url, date, rating, size, duration, video_codec,
|
`INSERT INTO scenes (checksum, path, title, details, url, date, rating, o_counter, size, duration, video_codec,
|
||||||
audio_codec, format, width, height, framerate, bitrate, studio_id, cover,
|
audio_codec, format, width, height, framerate, bitrate, studio_id, cover,
|
||||||
created_at, updated_at)
|
created_at, updated_at)
|
||||||
VALUES (:checksum, :path, :title, :details, :url, :date, :rating, :size, :duration, :video_codec,
|
VALUES (:checksum, :path, :title, :details, :url, :date, :rating, :o_counter, :size, :duration, :video_codec,
|
||||||
:audio_codec, :format, :width, :height, :framerate, :bitrate, :studio_id, :cover,
|
:audio_codec, :format, :width, :height, :framerate, :bitrate, :studio_id, :cover,
|
||||||
:created_at, :updated_at)
|
:created_at, :updated_at)
|
||||||
`,
|
`,
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ export const SceneCard: React.FC<ISceneCardProps> = (
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button className="minimal">
|
<Button className="minimal">
|
||||||
<SweatDrops />
|
<span className="fa-icon"><SweatDrops /></span>
|
||||||
<span>{props.scene.o_counter}</span>
|
<span>{props.scene.o_counter}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user