chore: updates

This commit is contained in:
Simon Ding
2024-07-19 17:08:24 +08:00
parent 38e5550398
commit 2004df49b9
2 changed files with 28 additions and 27 deletions

View File

@@ -53,7 +53,7 @@ type addWatchlistIn struct {
TmdbID int `json:"tmdb_id" binding:"required"`
StorageID int `json:"storage_id" `
Resolution string `json:"resolution" binding:"required"`
Folder string `json:"folder" binding:"required"`
Folder string `json:"folder"`
}
func (s *Server) AddTv2Watchlist(c *gin.Context) (interface{}, error) {
@@ -61,6 +61,9 @@ func (s *Server) AddTv2Watchlist(c *gin.Context) (interface{}, error) {
if err := c.ShouldBindJSON(&in); err != nil {
return nil, errors.Wrap(err, "bind query")
}
if (in.Folder == "") {
return nil, errors.New("folder should be provided")
}
detailCn, err := s.MustTMDB().GetTvDetails(in.TmdbID, db.LanguageCN)
if err != nil {
return nil, errors.Wrap(err, "get tv detail")
@@ -160,6 +163,7 @@ func (s *Server) AddMovie2Watchlist(c *gin.Context) (interface{}, error) {
AirDate: detail.ReleaseDate,
Resolution: string(in.Resolution),
StorageID: in.StorageID,
TargetDir: "./",
}, nil)
if err != nil {
return nil, errors.Wrap(err, "add to list")