Metadata-Version: 2.4
Name: cdmclient
Version: 1.2.5
Summary: CDM - Centralized Download Manager Client
Project-URL: Homepage, https://github.com/radaron/CDMServer/tree/master/client
Project-URL: Repository, https://github.com/radaron/CDMServer
Author-email: Aron Radics <radics.aron.jozsef@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Aron Radics
        
        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.
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: cryptography
Requires-Dist: qbittorrent-api>=2025.7.0
Requires-Dist: requests
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: transmission-rpc
Description-Content-Type: text/markdown

# CDMClient
**CDM - Centralized Download Manager Client**
CDMClient is the client application for the [CDM Server](../README.md).

This client communicates with the CDM Server to periodically send the download status from Transmission/QBittorrent and check for new torrent files to download. If new torrents are available, they are downloaded and added to Transmission/QBittorrent client.

## Installation

### Install or Upgrade the Package
Run the following command to install or upgrade CDMClient:
```shell
python3 -m pip install --upgrade cdmclient --user
```

### Create a Systemd Service
To set up CDMClient as a systemd service, execute the following commands:

1. Create the service file:
   ```shell
   echo "[Unit]
   Description=cdm-client service
   After=multi-user.target
   Conflicts=getty@tty1.service

   [Service]
   User=${USER}
   Type=simple
   Environment=LC_ALL=C.UTF-8
   Environment=LANG=C.UTF-8
   ExecStart=${HOME}/.local/bin/cdm-client
   Restart=on-failure
   RestartSec=3

   [Install]
   WantedBy=multi-user.target" | sudo tee /etc/systemd/system/cdm-client.service
   ```

2. Reload systemd and enable the service:
   ```shell
   sudo systemctl daemon-reload
   sudo systemctl enable cdm-client.service
   sudo systemctl start cdm-client.service
   ```

### Add automatic update (optional)
To keep CDMClient updated automatically, you can add a cron job. Run:
```shell
crontab -e
```
Then add the following line to the crontab file:
```shell
0 3 * * * /usr/bin/python3 -m pip install --upgrade cdmclient --user && systemctl restart cdm-client.service
```

## Configuration
The configuration file is located at:
```~/.config/cdm_client/config.ini```

This file is automatically generated when the service starts. Below is an example configuration:

```ini
[connection]
server_host = "https://cdmserver.com"
api_key = "1409d6ed79280aadcbe20f8f21981e89"
client_host =
client_port =
client_username =
client_password =
client_type= transmission # possible values: transmission or qbitorrent
```

### Configuration Details:
- **`server_host`**: The full URL of the CDM Server (e.g., `https://cdmserver.com`).
- **`api_key`**: The API key generated when adding a new device on the CDM Server's devices page. Refer to the [Devices Page Documentation](../doc/USAGE.md#devices-page).
- **`client_username`** and **`client_password`**: Required authentication for the selected torrent client.
- **`client_type`**: Specify either `transmission` or `qbitorrent`, depending on the torrent client you are using.
- **`client_host`** and **`client_port`**: Optional. If not specified, defaults to `localhost` and the default port for the selected client type.

## Viewing Logs
To monitor the service logs, use the following command:
```shell
journalctl -fu cdm-client
```
