Metadata-Version: 2.1
Name: python_cart_chunk
Version: 0.0.2b2
Summary: Add CART CHUNK to wave files.
Author-email: Tim Finley <tim.finley24@gmail.com>
Maintainer-email: Tim Finley <tim.finley24@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Tim Finley
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE

## Python CART CHUNK

### Installation

Clone this repo and install using pip:

```
$ git clone https://github.com/maxtimbo/python_cart_chunk
$ cd python_cart_chunk
$ pip install .
```

### Usage

You can use the CartChunk class to read CART CHUNK headers as well as riff and fmt data of a wave file:

```
from cart_chunk import CartChunk
from pathlib import Path

src = Path('/path/to/wave/file.wav')

wav = CartChunk(src)

if wav.is_scott:
    for key, value in wav.scott_data.items():
        print(f'{key:<20}: {value}')
else:
    print('Does not contain CART CHUNK')

for key, value in wav.riff_data.items():
    print(f'{key:<20}: {value}')

for key, value in wav.fmt_data.items():
    print(f'{key:<20}: {value}')

for key, value in wav.data_meta.items():
    print(f'{key:<20}: {value}')
```

Use the CartChunk class to write a new copy with the CART CHUNK. The following keyword args are available:

- `artist`          str
- `title`           str
- `trivia`          str
- `year`            int
- `category`        str
- `cart`            str
- `intro`           float
- `sec`             float
- `eom`             float
- `start_timestamp` tuple
- `end_timestamp`   tuple
- `hrcanplay`       list[list[int]]


```
from cart_chunk import NewCart

new_file = Path('/path/to/new/file.wav')

new_cart = NewCart(new_file, artist='artist', title='title')

wav.write_copy(new_cart)
```
