fix: add to watchlist

This commit is contained in:
Simon Ding
2024-07-12 14:36:32 +08:00
parent fc35850426
commit 55966b8115
5 changed files with 40 additions and 10 deletions

7
server/activity.go Normal file
View File

@@ -0,0 +1,7 @@
package server
import "github.com/gin-gonic/gin"
func (s *Server) GetRunningActivities(c *gin.Context) (interface{}, error) {
return nil, nil
}

View File

@@ -57,6 +57,7 @@ func (s *Server) Serve() error {
tv.POST("/watchlist", HttpHandler(s.AddWatchlist))
tv.GET("/watchlist", HttpHandler(s.GetWatchlist))
tv.GET("/series/:id", HttpHandler(s.GetTvDetails))
tv.GET("/resolutions", HttpHandler(s.GetAvailableResolutions))
}
indexer := api.Group("/indexer")
{

View File

@@ -28,8 +28,9 @@ func (s *Server) SearchTvSeries(c *gin.Context) (interface{}, error) {
}
type addWatchlistIn struct {
TmdbID int `json:"id" binding:"required"`
StorageID int `json:"storage_id"`
TmdbID int `json:"tmdb_id" binding:"required"`
StorageID int `json:"storage_id" binding:"required"`
Resolution db.ResolutionType `json:"resolution" binding:"required"`
}
func (s *Server) AddWatchlist(c *gin.Context) (interface{}, error) {
@@ -99,3 +100,11 @@ func (s *Server) GetTvDetails(c *gin.Context) (interface{}, error) {
detail := s.db.GetSeriesDetails(id)
return detail, nil
}
func (s *Server) GetAvailableResolutions(c *gin.Context) (interface{}, error) {
return []db.ResolutionType{
db.R720p,
db.R1080p,
db.R4k,
}, nil
}