diff --git a/server/watchlist.go b/server/watchlist.go index 340336d..f43dfea 100644 --- a/server/watchlist.go +++ b/server/watchlist.go @@ -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") diff --git a/ui/lib/search.dart b/ui/lib/search.dart index 49db4e4..828f3c4 100644 --- a/ui/lib/search.dart +++ b/ui/lib/search.dart @@ -161,7 +161,6 @@ class _SearchPageState extends ConsumerState { }); }, ), - storage.when( data: (v) { return Column( @@ -180,33 +179,31 @@ class _SearchPageState extends ConsumerState { }); }, ), + item.mediaType == "tv" + ? name.when( + data: (s) { + final path = v[storageSelected] + .settings!["tv_path"]; - name.when( - data: (s) { - - final path = item.mediaType == "tv" - ? v[storageSelected] - .settings!["tv_path"] - : v[storageSelected] - .settings!["movie_path"]; - pathController.text = s; - return SizedBox( - //width: 300, - child: TextField ( - - controller: pathController, - decoration: InputDecoration( - labelText: "存储路径", - prefix: Text(path) + pathController.text = s; + return SizedBox( + //width: 300, + child: TextField( + controller: pathController, + decoration: InputDecoration( + labelText: "存储路径", + prefix: Text(path)), + ), + ); + }, + error: (error, stackTrace) => + Text("$error"), + loading: () => + const MyProgressIndicator( + size: 20, ), - ), - ); - }, - error: (error, stackTrace) => Text("$error"), - loading: () => const MyProgressIndicator( - size: 20, - ), - ), + ) + : Text(""), ], ); },