# media – mediafiler

> Hanterar mediafiler (ljud, video, bild) på stationen — ladda upp, ned, aktivera på en mediakanal och ta bort.

_Källa: E-Sharp (esharp.se) · Accordion Shell (CLI)_


## Description

The `media` command manages media files (audio, video, and image files) on the Accordion device. It supports uploading files from your local system, downloading files to your local system, activating files on specific media channels, and removing files from the device.

## Syntax

```bash
media [options]
```

## Options

| Option | Short | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `--channel` | `-c` | No | - | Media channel to configure |
| `--upload` | `-u` | No | false | Upload file specified in --path |
| `--download` | `-d` | No | false | Download file specified in --name |
| `--remove` | `-r` | No | false | Remove file specified in --name |
| `--activate` | `-a` | No | false | Activate file specified in --name on --channel |
| `--path` | `-p` | No | - | Local file path for upload or download destination |
| `--name` | `-n` | No | - | Media file name on device |

Mutually exclusive: upload/download cannot be used together; remove/activate cannot be used together.

## Examples

```bash
media                                                            # list files
media --upload --path "C:\media\new_audio.wav"
media --activate --name "audio_test_1khz.wav" --channel "AUDIO_OUT_1"
media --download --name "captured_audio.wav" --path "C:\downloads\audio.wav"
media --remove --name "old_file.wav"
```

## Supported Media Types

- Audio: `.wav`, `.mp3`, `.flac`, etc.
- Video: `.mp4`, `.avi`, `.mkv`, etc.
- Image: `.png`, `.jpg`, `.bmp`, `.gif`, etc.

Specific format support depends on hardware capabilities.

## Channel Types

Media can be activated on channels implementing IAudioChannel, IVideoChannel or IImageChannel. Use `list --filter ".*AUDIO.*|.*VIDEO.*|.*IMAGE.*"` to see available media channels.

## Behavior

Upload stores the file but does NOT activate it. Activate sets the channel value to the filename and waits up to 10 seconds for confirmation. Download saves a device file to the local path. Remove deletes a device file and lists the updated set.

## Notes

- Media files persist across reboots and are limited by device storage capacity.
- Use unique, descriptive filenames; names are case-sensitive on most devices.

## Error Handling

- **File does not exist** (upload): verify the local file path
- **Channel not found / not a media channel**: use `list` to find a correct media channel
- **Channel must be defined for activate**: provide `--channel`
- **Upload and Download are mutually exclusive**: use one operation per command
