asweigart / asweigart/pyaudacity

Should get_info have a "list" mode?

Open
#7 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
38
Forks
8
PR merge metrics
No merged PRs in 30d

Description

I have a lot of calls to get_info, particularly because if you want to create a label with a name, you have to create the label, then pull the list of labels to find the number of the label you just created, then submit a separate call, with that label number, giving the new label a description. (e.g. i have a whole 90+ line function to set a label [here](https://github.com/trjh/netradio_DNB_analysis/blob/a8d63b72d0d8177d3f58d3e585ebda533ea8698f/scripts/splitexport.py#L74))

All my calls look like this:
```
jdata = pa.get_info(info_type='Tracks')
jdata = (jdata [:jdata.rfind(']')+1])
aud_tracks = json.loads(jdata)
```

Does it make sense to implement this as
```
aud_tracks = pa.get_info(info_type='Tracks', format='JSONlist')
```
or similar, where `aud_tracks` will now be a list of dictionaries representing each track, in order?

I'd like to implement this to make my calling code cleaner, but want to sanity check it first. What do you think, @bwagner?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing get_info interface and the 90+ line label-setting example in scripts/splitexport.py. Check how get_info currently formats Tracks results and how callers parse them. Done means an agreed list mode returns ordered track dictionaries and the existing label workflow can use it without manual JSON-string trimming.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.