Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/blocklist/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var addCmd = &cobra.Command{

body := api.NewBlocklist()
if cmd.Flags().Changed("tmdb-id") {
v, _ := cmd.Flags().GetFloat32("tmdb-id")
body.SetTmdbId(v)
v, _ := cmd.Flags().GetInt("tmdb-id")
body.SetTmdbId(float32(v))
}

r, err := apiClient.BlocklistAPI.BlocklistPost(ctx).Blocklist(*body).Execute()
Expand All @@ -26,7 +26,7 @@ var addCmd = &cobra.Command{
}

func init() {
addCmd.Flags().Float32("tmdb-id", 0, "TMDB ID of the media to blocklist (required)")
addCmd.Flags().Int("tmdb-id", 0, "TMDB ID of the media to blocklist (required)")
addCmd.MarkFlagRequired("tmdb-id")
Cmd.AddCommand(addCmd)
}
12 changes: 6 additions & 6 deletions cmd/blocklist/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ var listCmd = &cobra.Command{
req := apiClient.BlocklistAPI.BlocklistGet(ctx)

if cmd.Flags().Changed("take") {
v, _ := cmd.Flags().GetFloat32("take")
req = req.Take(v)
v, _ := cmd.Flags().GetInt("take")
req = req.Take(float32(v))
}
if cmd.Flags().Changed("skip") {
v, _ := cmd.Flags().GetFloat32("skip")
req = req.Skip(v)
v, _ := cmd.Flags().GetInt("skip")
req = req.Skip(float32(v))
}
if cmd.Flags().Changed("search") {
v, _ := cmd.Flags().GetString("search")
Expand All @@ -42,8 +42,8 @@ var listCmd = &cobra.Command{
}

func init() {
listCmd.Flags().Float32("take", 20, "Number of items to return")
listCmd.Flags().Float32("skip", 0, "Number of items to skip")
listCmd.Flags().Int("take", 20, "Number of items to return")
listCmd.Flags().Int("skip", 0, "Number of items to skip")
listCmd.Flags().String("search", "", "Search by title")
listCmd.Flags().String("filter", "", "Filter: all, manual, blocklistedTags")
Cmd.AddCommand(listCmd)
Expand Down
2 changes: 1 addition & 1 deletion cmd/collection/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var getCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
apiClient, ctx, isVerbose := apiutil.NewAPIClient()

id, err := strconv.ParseFloat(args[0], 32)
id, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/issue/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var commentCmd = &cobra.Command{
Short: "Add a comment to an issue",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
id, err := strconv.ParseFloat(args[0], 32)
id, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return fmt.Errorf("invalid issue ID: %s", args[0])
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/issue/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var createCmd = &cobra.Command{
Short: "Create a new issue",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
issueType, err := strconv.ParseFloat(args[0], 32)
issueType, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return fmt.Errorf("invalid issue type: %s", args[0])
}
Expand All @@ -26,8 +26,8 @@ var createCmd = &cobra.Command{
body.SetMessage(v)
}
if cmd.Flags().Changed("media-id") {
v, _ := cmd.Flags().GetFloat32("media-id")
body.SetMediaId(v)
v, _ := cmd.Flags().GetInt("media-id")
body.SetMediaId(float32(v))
}
apiClient, ctx, isVerbose := apiutil.NewAPIClient()
res, r, apiErr := apiClient.IssueAPI.IssuePost(ctx).IssuePostRequest(*body).Execute()
Expand All @@ -37,6 +37,6 @@ var createCmd = &cobra.Command{

func init() {
createCmd.Flags().String("message", "", "Issue message")
createCmd.Flags().Float32("media-id", 0, "Media ID associated with the issue")
createCmd.Flags().Int("media-id", 0, "Media ID associated with the issue")
Cmd.AddCommand(createCmd)
}
2 changes: 1 addition & 1 deletion cmd/issue/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var getCmd = &cobra.Command{
Short: "Get a single issue",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
id, err := strconv.ParseFloat(args[0], 32)
id, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return fmt.Errorf("invalid issue ID: %s", args[0])
}
Expand Down
18 changes: 9 additions & 9 deletions cmd/issue/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ var listCmd = &cobra.Command{
apiClient, ctx, isVerbose := apiutil.NewAPIClient()
req := apiClient.IssueAPI.IssueGet(ctx)
if cmd.Flags().Changed("take") {
v, _ := cmd.Flags().GetFloat32("take")
req = req.Take(v)
v, _ := cmd.Flags().GetInt("take")
req = req.Take(float32(v))
}
if cmd.Flags().Changed("skip") {
v, _ := cmd.Flags().GetFloat32("skip")
req = req.Skip(v)
v, _ := cmd.Flags().GetInt("skip")
req = req.Skip(float32(v))
}
if cmd.Flags().Changed("sort") {
v, _ := cmd.Flags().GetString("sort")
Expand All @@ -29,19 +29,19 @@ var listCmd = &cobra.Command{
req = req.Filter(v)
}
if cmd.Flags().Changed("requested-by") {
v, _ := cmd.Flags().GetFloat32("requested-by")
req = req.RequestedBy(v)
v, _ := cmd.Flags().GetInt("requested-by")
req = req.RequestedBy(float32(v))
}
res, r, err := req.Execute()
return apiutil.HandleResponse(cmd, r, err, res, isVerbose, "IssueGet")
},
}

func init() {
listCmd.Flags().Float32("take", 20, "Number of issues to return")
listCmd.Flags().Float32("skip", 0, "Number of issues to skip")
listCmd.Flags().Int("take", 20, "Number of issues to return")
listCmd.Flags().Int("skip", 0, "Number of issues to skip")
listCmd.Flags().String("sort", "added", "Sort by: added, modified")
listCmd.Flags().String("filter", "open", "Filter by status: all, open, resolved")
listCmd.Flags().Float32("requested-by", 0, "Filter by user ID")
listCmd.Flags().Int("requested-by", 0, "Filter by user ID")
Cmd.AddCommand(listCmd)
}
8 changes: 4 additions & 4 deletions cmd/mcp/enrich.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
const tmdbImageBase = "https://image.tmdb.org/t/p/w500"

// GenreMap maps a TMDB genre ID to its human-readable name.
type GenreMap map[float32]string
type GenreMap map[int]string

// FetchMovieGenres fetches the TMDB movie genre list and returns a lookup map.
// Returns nil on error; genre enrichment is best-effort.
Expand All @@ -25,7 +25,7 @@ func FetchMovieGenres(ctx context.Context, client *api.APIClient) GenreMap {
m := make(GenreMap, len(genres))
for _, g := range genres {
if g.Id != nil && g.Name != nil {
m[*g.Id] = *g.Name
m[int(*g.Id)] = *g.Name
}
}
return m
Expand All @@ -41,7 +41,7 @@ func FetchTVGenres(ctx context.Context, client *api.APIClient) GenreMap {
m := make(GenreMap, len(genres))
for _, g := range genres {
if g.Id != nil && g.Name != nil {
m[*g.Id] = *g.Name
m[int(*g.Id)] = *g.Name
}
}
return m
Expand Down Expand Up @@ -87,7 +87,7 @@ func EnrichMediaMap(m map[string]interface{}, genres GenreMap) {
names := make([]string, 0, len(ids))
for _, v := range ids {
if id, ok := v.(float64); ok {
if name := genres[float32(id)]; name != "" {
if name := genres[int(id)]; name != "" {
names = append(names, name)
}
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/mcp/tools_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func BlocklistListHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
client := newAPIClientWithKey(apiKeyFromContext(callCtx))
r := client.BlocklistAPI.BlocklistGet(callCtx)
if take := req.GetFloat("take", 0); take > 0 {
if take := req.GetInt("take", 0); take > 0 {
r = r.Take(float32(take))
}
if skip := req.GetFloat("skip", 0); skip > 0 {
if skip := req.GetInt("skip", 0); skip > 0 {
r = r.Skip(float32(skip))
}
res, _, err := r.Execute()
Expand All @@ -71,13 +71,13 @@ func BlocklistListHandler() server.ToolHandlerFunc {

func BlocklistAddHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
tmdbId, err := req.RequireFloat("tmdbId")
tmdbId, err := req.RequireInt("tmdbId")
if err != nil {
return nil, err
}
tmdbIdFloat := float32(tmdbId)
tmdbIdF := float32(tmdbId)
body := api.Blocklist{
TmdbId: &tmdbIdFloat,
TmdbId: &tmdbIdF,
}
if title := req.GetString("title", ""); title != "" {
body.Title = &title
Expand Down
2 changes: 1 addition & 1 deletion cmd/mcp/tools_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func registerCollectionTools(s *server.MCPServer) {

func CollectionGetHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
collectionId, err := req.RequireFloat("collectionId")
collectionId, err := req.RequireInt("collectionId")
if err != nil {
return nil, err
}
Expand Down
18 changes: 9 additions & 9 deletions cmd/mcp/tools_issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ func IssueListHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
client := newAPIClientWithKey(apiKeyFromContext(callCtx))
r := client.IssueAPI.IssueGet(callCtx)
if take := req.GetFloat("take", 0); take > 0 {
if take := req.GetInt("take", 0); take > 0 {
r = r.Take(float32(take))
}
if skip := req.GetFloat("skip", 0); skip > 0 {
if skip := req.GetInt("skip", 0); skip > 0 {
r = r.Skip(float32(skip))
}
res, _, err := r.Execute()
Expand All @@ -94,7 +94,7 @@ func IssueListHandler() server.ToolHandlerFunc {

func IssueGetHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
issueId, err := req.RequireFloat("issueId")
issueId, err := req.RequireInt("issueId")
if err != nil {
return nil, err
}
Expand All @@ -113,24 +113,24 @@ func IssueGetHandler() server.ToolHandlerFunc {

func IssueCreateHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
issueType, err := req.RequireFloat("issueType")
issueType, err := req.RequireInt("issueType")
if err != nil {
return nil, err
}
message, err := req.RequireString("message")
if err != nil {
return nil, err
}
mediaId, err := req.RequireFloat("mediaId")
mediaId, err := req.RequireInt("mediaId")
if err != nil {
return nil, err
}
issueTypeFloat := float32(issueType)
mediaIdFloat := float32(mediaId)
issueTypeF := float32(issueType)
mediaIdF := float32(mediaId)
body := api.IssuePostRequest{
IssueType: &issueTypeFloat,
IssueType: &issueTypeF,
Message: &message,
MediaId: &mediaIdFloat,
MediaId: &mediaIdF,
}
client := newAPIClientWithKey(apiKeyFromContext(callCtx))
res, _, err := client.IssueAPI.IssuePost(callCtx).IssuePostRequest(body).Execute()
Expand Down
4 changes: 2 additions & 2 deletions cmd/mcp/tools_media.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func MediaListHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
client := newAPIClientWithKey(apiKeyFromContext(callCtx))
r := client.MediaAPI.MediaGet(callCtx)
take := req.GetFloat("take", 20)
take := req.GetInt("take", 20)
r = r.Take(float32(take))
if skip := req.GetFloat("skip", 0); skip > 0 {
if skip := req.GetInt("skip", 0); skip > 0 {
r = r.Skip(float32(skip))
}
if filter := req.GetString("filter", ""); filter != "" {
Expand Down
12 changes: 6 additions & 6 deletions cmd/mcp/tools_movies.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func registerMoviesTools(s *server.MCPServer) {

func MoviesGetHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
movieId, err := req.RequireFloat("movieId")
movieId, err := req.RequireInt("movieId")
if err != nil {
return nil, err
}
Expand All @@ -77,13 +77,13 @@ func MoviesGetHandler() server.ToolHandlerFunc {

func MoviesRecommendationsHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
movieId, err := req.RequireFloat("movieId")
movieId, err := req.RequireInt("movieId")
if err != nil {
return nil, err
}
client := newAPIClientWithKey(apiKeyFromContext(callCtx))
r := client.MoviesAPI.MovieMovieIdRecommendationsGet(callCtx, float32(movieId))
if page := req.GetFloat("page", 0); page > 0 {
if page := req.GetInt("page", 0); page > 0 {
r = r.Page(float32(page))
}
res, _, err := r.Execute()
Expand All @@ -100,13 +100,13 @@ func MoviesRecommendationsHandler() server.ToolHandlerFunc {

func MoviesSimilarHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
movieId, err := req.RequireFloat("movieId")
movieId, err := req.RequireInt("movieId")
if err != nil {
return nil, err
}
client := newAPIClientWithKey(apiKeyFromContext(callCtx))
r := client.MoviesAPI.MovieMovieIdSimilarGet(callCtx, float32(movieId))
if page := req.GetFloat("page", 0); page > 0 {
if page := req.GetInt("page", 0); page > 0 {
r = r.Page(float32(page))
}
res, _, err := r.Execute()
Expand All @@ -123,7 +123,7 @@ func MoviesSimilarHandler() server.ToolHandlerFunc {

func MoviesRatingsHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
movieId, err := req.RequireFloat("movieId")
movieId, err := req.RequireInt("movieId")
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/mcp/tools_person.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func registerPersonTools(s *server.MCPServer) {

func PersonGetHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
personId, err := req.RequireFloat("personId")
personId, err := req.RequireInt("personId")
if err != nil {
return nil, err
}
Expand All @@ -53,7 +53,7 @@ func PersonGetHandler() server.ToolHandlerFunc {

func PersonCreditsHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
personId, err := req.RequireFloat("personId")
personId, err := req.RequireInt("personId")
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/mcp/tools_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ func RequestListHandler() server.ToolHandlerFunc {
return func(callCtx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
client := newAPIClientWithKey(apiKeyFromContext(callCtx))
r := client.RequestAPI.RequestGet(callCtx)
if take := req.GetFloat("take", 0); take > 0 {
if take := req.GetInt("take", 0); take > 0 {
r = r.Take(float32(take))
}
if skip := req.GetFloat("skip", 0); skip > 0 {
if skip := req.GetInt("skip", 0); skip > 0 {
r = r.Skip(float32(skip))
}
if filter := req.GetString("filter", ""); filter != "" {
Expand Down Expand Up @@ -154,7 +154,7 @@ func RequestCreateHandler() server.ToolHandlerFunc {
if err != nil {
return nil, err
}
mediaId, err := req.RequireFloat("mediaId")
mediaId, err := req.RequireInt("mediaId")
if err != nil {
return nil, err
}
Expand Down
Loading
Loading