Issue Description
Currently, when using client.upload_audio(), the ragas parameter in AudioMetadata expects a specific structure that is not well documented or validated:
- The ragas array should contain objects where the key is the raga name string
- Each raga object should have a
performance_sections key with an empty object {} as the default value
- Example:
[{"Rageshree": {"performance_sections": {}}}]
Current Problems
- No validation: The API doesn't validate the raga structure, leading to potential upload failures or incorrect data
- Poor developer experience: Users might intuitively try
Raga({"name": "Rageshree"}) or similar patterns
- Lack of documentation: The expected structure is not clearly documented
- Upload failures: Using plain dictionaries results in
'dict' object has no attribute 'to_json' errors during upload
Proposed Solutions
Consider one or both of these approaches:
Option 1: Add validation in upload_audio()
- Validate the raga structure during upload
- Provide clear error messages when the structure is incorrect
- Guide users toward the correct format
Option 2: Provide syntactic sugar
- Allow multiple input formats for ragas (e.g., simple strings, name-based objects)
- Automatically convert to the expected internal structure
- Examples:
# Allow simple strings
ragas=["Rageshree", "Yaman"]
# Allow name-based objects
ragas=[Raga("Rageshree"), Raga("Yaman")]
# Still support current format
ragas=[{"Rageshree": {"performance_sections": {}}}]
Context
This issue was discovered while updating upload scripts where the intuitive Raga({"name": "Rageshree"}) pattern was used but doesn't work with the current API expectations. Testing with plain dictionaries also fails with 'dict' object has no attribute 'to_json' errors, indicating the API expects objects with specific methods.
Priority
This issue is blocking current upload functionality and needs to be addressed to enable proper raga metadata uploads.
Issue Description
Currently, when using
client.upload_audio(), theragasparameter inAudioMetadataexpects a specific structure that is not well documented or validated:performance_sectionskey with an empty object{}as the default value[{"Rageshree": {"performance_sections": {}}}]Current Problems
Raga({"name": "Rageshree"})or similar patterns'dict' object has no attribute 'to_json'errors during uploadProposed Solutions
Consider one or both of these approaches:
Option 1: Add validation in
upload_audio()Option 2: Provide syntactic sugar
Context
This issue was discovered while updating upload scripts where the intuitive
Raga({"name": "Rageshree"})pattern was used but doesn't work with the current API expectations. Testing with plain dictionaries also fails with'dict' object has no attribute 'to_json'errors, indicating the API expects objects with specific methods.Priority
This issue is blocking current upload functionality and needs to be addressed to enable proper raga metadata uploads.