Skip to content

Commit d225b5e

Browse files
audiostackhenryguillem-211harry97ukCodeBooster97martinezpl
authored
Main -> Internal (#77)
* version poetry * feat: add query method to Voice with tests * updoate * fix comit * Fix - remove emojis from section headers and add public asset link * Include changelog * bump version * feat: add customer trace id header * feat: enhance header creation to accept custom headers * docs: update changelog to include custom headers feature * feat: implement context manager for setting customer trace id * chore: reorganize imports in request_interface.py * feat: update use_trace context manager to specify return type and add tests for trace id handling * fix: update use_trace context manager to improve type hinting for trace_id * fix: improve type hinting for current_trace_id in request_interface.py * chore: reorder imports in request_interface.py for consistency * fix: pass 0 float values (#73) * fix: pass 0 float values * chore: changelog * chore: lint * feat: update for new file system implementation (#75) * feat: update for new file system implementation * change base url * only useful methods * add docstrings * fix files and typing * fix cc reporter * revert snake_case to camelCase * Update CHANGELOG.md * fix: Deleted unused import --------- Co-authored-by: Guillem <[email protected]> Co-authored-by: Harry Gardiner <[email protected]> Co-authored-by: CodeBooster97 <[email protected]> Co-authored-by: Lars <[email protected]> Co-authored-by: Marcin Szleszynski <[email protected]>
1 parent b0dbeed commit d225b5e

File tree

19 files changed

+476
-367
lines changed

19 files changed

+476
-367
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
./cc-test-reporter before-build
3939
export AUDIO_STACK_DEV_KEY=$AFLR_API_KEY_PROD_TEST
4040
poetry run task test
41-
./cc-test-reporter after-build \
42-
--coverage-input-type coverage.py --exit-code $?
41+
# ./cc-test-reporter after-build \
42+
# --coverage-input-type coverage.py --exit-code $?
4343
lint:
4444
docker:
4545
- image: cimg/python:3.8

CHANGELOG.md

Lines changed: 167 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,172 @@ All notable changes to `audiostack` will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [3.0.0] - 2025-07-29
8+
9+
### 🆕 New Features
10+
11+
#### File System Overhaul
12+
- **Complete file system redesign** with hierarchical folder structure
13+
- **New File.Item class** with comprehensive metadata:
14+
- `fileId`: Unique file identifier
15+
- `fileName`: Name of the file
16+
- `url`: Download URL for the file
17+
- `createdBy`: ID of user who created the file
18+
- `lastModified`: Last modification timestamp
19+
- `fileType`: File type information (dict with fileTypeId and name)
20+
- `fileCategory`: Optional file category (can be null)
21+
- `size`: File size as string
22+
- `createdAt`: Creation timestamp
23+
- `status`: File status (e.g., "uploaded")
24+
- `duration`: Optional file duration (can be null)
25+
26+
#### New Folder System
27+
- **New Folder.Item class** with hierarchical structure:
28+
- `folderId`: Unique folder identifier
29+
- `folderName`: Name of the folder
30+
- `parentFolderId`: Parent folder ID (empty string for root)
31+
- `createdBy`: ID of user who created the folder
32+
- `lastModified`: Optional last modification timestamp (can be null)
33+
- `createdAt`: Creation timestamp
34+
- **New Folder.ListResponse class** for folder listing operations with:
35+
- `folders`: List of Folder.Item objects
36+
- `files`: List of File.Item objects
37+
- `currentPathChain`: Dictionary containing path chain information
38+
- **New Folder.get_root_folder_id()` method to get root folder ID
39+
40+
#### Enhanced File Operations
41+
- **Improved file upload process** with automatic polling for completion
42+
- **Timeout handling** using `TIMEOUT_THRESHOLD_S` for upload operations
43+
- **Better error handling** with specific error messages for upload failures
44+
45+
### 🔄 API Changes
46+
47+
#### File.create() Method
48+
- **BREAKING CHANGE**: Parameter names updated:
49+
- `fileType`**REMOVED** (no longer needed)
50+
- **New parameter**: `folderId` (Optional[UUID]) for specifying upload location
51+
- **Enhanced behavior**: Now polls for upload completion and returns complete file metadata
52+
53+
#### File.get() Method
54+
- **BREAKING CHANGE**: Parameter name updated:
55+
- `fileId``fileId` (kept camelCase)
56+
57+
#### File.delete() Method
58+
- **BREAKING CHANGE**: Parameter names updated:
59+
- `fileId``fileId` (kept camelCase)
60+
- `folderId``folderId` (kept camelCase, optional, defaults to root folder)
61+
- **Return type change**: Now returns `None` instead of `APIResponseItem`
62+
63+
#### File.Item Attributes
64+
- **BREAKING CHANGE**: All attribute names kept in camelCase:
65+
- `fileId`: Unique file identifier
66+
- `fileName`: Name of the file
67+
- `url`: Download URL for the file
68+
- `createdBy`: ID of user who created the file
69+
- `lastModified`: Last modification timestamp
70+
- `fileType`: File type information (dict with fileTypeId and name)
71+
- `fileCategory`: Optional file category (can be null)
72+
- `size`: File size as string
73+
- `createdAt`: Creation timestamp
74+
- `status`: File status (e.g., "uploaded")
75+
- `duration`: Optional file duration (can be null)
76+
77+
#### File.Item.download() Method
78+
- **BREAKING CHANGE**: Now requires `fileName` parameter (no longer optional)
79+
80+
#### Folder Methods
81+
- **Folder.create(name, parentFolderId)** - Create new folder with optional parent
82+
- **Folder.get(folderId)** - Retrieve folder by ID
83+
- **Folder.delete(folderId)** - Delete folder by ID
84+
- **Folder.get_root_folder_id()** - Get root folder ID
85+
86+
### 🗑️ Removed Features
87+
88+
#### Deprecated Methods
89+
- **File.modify()** - Completely removed
90+
- **File.get_file_categories()** - Completely removed
91+
- **File.get_category_id_by_name()** - Completely removed
92+
- **File.Item.delete()** - Instance method removed (use static method instead)
93+
94+
#### Deprecated Classes
95+
- **Media class** - Completely removed
96+
- **File.List class** - Replaced with Folder.ListResponse
97+
- **Folder.List class** - Replaced with Folder.ListResponse
98+
99+
#### Deprecated Inheritance
100+
- **File.Item** no longer inherits from `APIResponseItem`
101+
- **Folder.Item** no longer inherits from `APIResponseItem`
102+
103+
### 🔧 Technical Improvements
104+
105+
#### Code Quality
106+
- **Comprehensive docstrings** added to all methods and classes (PEP 257 compliant)
107+
- **Type hints** improved throughout the codebase
108+
- **Better error messages** with more descriptive exceptions
109+
- **Fixed typos** in error messages ("eixst" → "exist")
110+
111+
#### Upload Process
112+
- **Fixed upload polling logic** with proper timeout handling
113+
- **Added mime_type parameter** to `send_upload_request` calls
114+
- **Improved upload status checking** with proper boolean logic
115+
116+
### 📝 Migration Guide
117+
118+
#### For File Operations
119+
```python
120+
# OLD
121+
file = File.create(localPath="file.mp3", uploadPath="name.mp3", fileType="audio")
122+
fileId = file.fileId
123+
file.delete(fileId=fileId, folderId=folderId)
124+
125+
# NEW
126+
file = File.create(localPath="file.mp3", uploadPath="name.mp3", folderId=folderId)
127+
fileId = file.fileId
128+
File.delete(fileId=fileId, folderId=folderId)
129+
```
130+
131+
#### For Folder Operations
132+
```python
133+
# OLD
134+
root = Folder.get_root() # Returns Folder.Item
135+
folderId = root.currentPathChain["folderId"]
136+
137+
# NEW
138+
folderId = Folder.get_root_folder_id() # Returns string directly
139+
```
140+
141+
#### For File Item Access
142+
```python
143+
# OLD
144+
fileId = file.fileId
145+
fileName = file.fileName
146+
147+
# NEW
148+
fileId = file.fileId # No change - kept camelCase
149+
fileName = file.fileName # No change - kept camelCase
150+
```
151+
152+
### ⚠️ Breaking Changes Summary
153+
154+
1. **Parameter names** kept in camelCase (no changes to existing camelCase parameters)
155+
2. **Attribute names** kept in camelCase (no changes to existing camelCase attributes)
156+
3. **File.modify()** method completely removed
157+
4. **File.Item.delete()** instance method removed
158+
5. **Media class** completely removed
159+
6. **File.List and Folder.List** classes removed
160+
7. **Inheritance from APIResponseItem** removed for Item classes
161+
8. **File.create()** now requires `fileName` parameter in download method
162+
9. **Return types** changed for some methods (e.g., delete returns None)
163+
10. **New parameter**: `folderId` added to File.create() for specifying upload location
164+
165+
### 🧪 Testing
166+
167+
- **All existing tests updated** to work with new API
168+
- **New test patterns** for folder operations
169+
- **Conditional test skipping** for staging environment
170+
- **Improved test coverage** for new file system features
171+
172+
7173
## [2.10.1] - 2025-02-24
8174
- Fixed logic that removed 0 float values from payload
9175

@@ -128,4 +294,4 @@ Improved error messaging for Media files
128294
### Fixes
129295

130296
- Fixed missing argument in `content.list_modules`.
131-
- Fixed inclusion of missing `x-assume-org` header in `request_interface.download_url`.
297+
- Fixed inclusion of missing `x-assume-org` header in `request_interface.download_url`.

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
<br>
1212
</p>
1313

14-
## 🧐 About <a name = "about"></a>
14+
## About <a name = "about"></a>
1515

1616
This repository is actively maintained by [Audiostack](https://audiostack.ai/). For examples, recipes and api reference see the [api.audio docs](https://docs.audiostack.ai/reference/quick-start). Feel free to get in touch with any questions or feedback!
1717

18-
## :book: Changelog
18+
## Changelog
1919

2020
You can view [here](https://docs.audiostack.ai/changelog) our updated Changelog.
2121

22-
## 🏁 Getting Started <a name = "getting_started"></a>
22+
## Getting Started <a name = "getting_started"></a>
2323

2424
### Installation
2525

@@ -51,7 +51,7 @@ audiostack.assume_org_id = "your-org-id"
5151

5252
### Create your first audio asset
5353

54-
#### ✍️ First, create a Script.
54+
#### First, create a Script.
5555

5656
Audiostack Scripts are the first step in creating audio assets. Not only do they contain the text to be spoken, but also determine the final structure of our audio asset using the [Script Syntax](https://docs.audiostack.ai/docs/script-syntax).
5757

@@ -71,7 +71,7 @@ We are excited to see what you'll create with our product!
7171
""")
7272
```
7373

74-
#### 🎤 Now, let's read it out load.
74+
#### Now, let's read it out load.
7575

7676
We integrate all the major TTS voices in the market. You can browse them in our [voice library](https://library.audiostack.ai/).
7777

@@ -88,7 +88,7 @@ When you listen to these files, you'll notice each of them has a certain silence
8888
tts = audiostack.Speech.TTS.remove_padding(speechId=tts.speechId)
8989
```
9090

91-
#### 🎛️ Now let's mix the speech we just created with a [sound template](https://library.audiostack.ai/sound).
91+
#### Now let's mix the speech we just created with a [sound template](https://library.audiostack.ai/sound).
9292

9393
```python
9494
mix = audiostack.Production.Mix.create(speechItem=tts, soundTemplate="chill_vibes")
@@ -101,18 +101,18 @@ You can list all the sound templates to see what segments are available or even
101101
Mixing comes with a lot of options to tune your audio to sound just right.
102102
[More on this here.](https://docs.audiostack.ai/docs/advance-timing-parameters)
103103

104-
#### 🎧 At this point, we can download the mix as a wave file, or convert it to another format.
104+
#### At this point, we can download the mix as a wave file, or convert it to another format.
105105

106106
```python
107107
enc = audiostack.Delivery.Encoder.encode_mix(productionItem=mix, preset="mp3_high")
108108
enc.download(fileName="example")
109109
```
110110

111-
Easy right? 🔮 This is the final result:
111+
Easy right? This is the final result:
112112

113-
https://github.com/aflorithmic/audiostack-python/assets/64603095/6948cddb-4132-40a7-b84d-457f3fc0803d
113+
https://file.api.audio/pypi_example.mp3
114114

115-
## :speedboat: More quickstarts <a name = "quickstarts"></a>
115+
## More quickstarts <a name = "quickstarts"></a>
116116

117117
Get started with our [quickstart recipes](https://docs.audiostack.ai/docs/introduction).
118118

audiostack/content/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from audiostack.content.file import File, Folder # noqa: F401
2-
from audiostack.content.media import Media # noqa: F401
32
from audiostack.content.recommend import ( # noqa: F401
43
RecommendIAB,
54
RecommendMood,

0 commit comments

Comments
 (0)