Skip to content

Commit

Permalink
feat: save media alternative titles
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ding committed Dec 13, 2024
1 parent 60edeac commit 67014cf
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 2 deletions.
1 change: 1 addition & 0 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func (c *Client) AddMediaWatchlist(m *ent.Media, episodes []int) (*ent.Media, er
SetDownloadHistoryEpisodes(m.DownloadHistoryEpisodes).
SetLimiter(m.Limiter).
SetExtras(m.Extras).
SetAlternativeTitles(m.AlternativeTitles).
AddEpisodeIDs(episodes...).
Save(context.TODO())
return r, err
Expand Down
15 changes: 14 additions & 1 deletion ent/media.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ent/media/media.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions ent/media/where.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions ent/media_create.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions ent/media_update.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ent/migrate/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 91 additions & 1 deletion ent/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions ent/schema/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func (Media) Fields() []ent.Field {
field.Bool("download_history_episodes").Optional().Default(false).Comment("tv series only"),
field.JSON("limiter", MediaLimiter{}).Optional(),
field.JSON("extras", MediaExtras{}).Optional(),
field.JSON("alternative_titles", []AlternativeTilte{}).Optional(),
}
}

Expand All @@ -41,6 +42,12 @@ func (Media) Edges() []ent.Edge {
}
}

type AlternativeTilte struct {
Iso3166_1 string `json:"iso_3166_1"`
Title string `json:"title"`
Type string `json:"type"`
}

type MediaLimiter struct {
SizeMin int64 `json:"size_min"` //in B
SizeMax int64 `json:"size_max"` //in B
Expand Down
Loading

0 comments on commit 67014cf

Please sign in to comment.