CLI: reject invalid player seek and volume values before connecting

Open Beginner friendly
#87 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #90 by @bfs2021 — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start in the CLI argument parsing for the spotapi player seek and spotapi player volume subcommands, and read the existing range checks in Player.seek() and Player.volume() to match their limits. Add small argparse type validators that reject negative seek values and volumes outside 0-100 with exit status 2, keeping 0 and 100 valid. Done when offline tests cover negative seek, volume below zero, volume above 100, and both boundaries, and the issue asks you to comment before starting to avoid duplicate work.

Written by the indexing model from the issue text.

Description

bug good first issue

Problem

The Python player API correctly rejects negative seek positions and volume values outside 0–100. The CLI currently parses both as unrestricted integers, so obviously invalid input can reach account/session setup before producing an error.

Proposed change

Validate these values during argument parsing:

  • spotapi player seek MILLISECONDS: integer greater than or equal to zero.
  • spotapi player volume PERCENT: integer from zero through 100.

Acceptance criteria

  • Invalid values fail through argparse with a clear range message and exit status 2.
  • Invalid input is rejected before reading account state or opening a Spotify connection.
  • Boundary values 0 and 100 remain valid where applicable.
  • Existing valid commands retain their current behavior.
  • Offline tests cover negative seek, volume below zero, volume above 100, and boundaries.

Scope

Keep validation helpers small and local to the CLI. The existing validation inside Player.seek() and Player.volume() must remain as the library-level safety boundary.

Comment before starting so duplicate work can be avoided.

Dominant language
Python
Stars
493
Forks
40
Avg merge
5m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Aran404/SpotAPI

All issues in Aran404/SpotAPI

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.