17 Commits

Author SHA1 Message Date
4d861e1739 Merged with upstream 2022-11-25 01:23:05 +01:00
5acf8e8848 Clearer output text for publish version 2022-11-25 01:21:59 +01:00
103696e01a Clearer output text for publish version 2022-11-25 01:03:59 +01:00
b1018d7f9d Merge branch 'ci/build-and-pypi-publish' of github.com:kevinmidboe/delugeClient into ci/build-and-pypi-publish 2022-11-25 00:56:02 +01:00
7d4f4d0e9b If source is newer than pypi, exit 0 and continue pipeline 2022-11-25 00:38:35 +01:00
2f716e65a3 If source is newer than pypi, exit 0 and continue pipeline 2022-11-25 00:33:22 +01:00
fa59acfd03 Twince check command before upload 2022-11-25 00:01:40 +01:00
120d300b07 Install python dependencies before publish 2022-11-24 23:49:18 +01:00
0faa42a048 Publish depends on build 2022-11-24 23:13:29 +01:00
e2db73bf2a fixed typo in pacakge name 2022-11-24 23:05:28 +01:00
0841fdc03d sync pipenv after install 2022-11-24 22:57:03 +01:00
76c99568a8 try install requirements first 2022-11-24 22:50:04 +01:00
09e496a907 test explicitly defining wheel version 2022-11-24 22:46:54 +01:00
3989523632 add missing pipenv command 2022-11-24 22:43:18 +01:00
30c3e117da test step indentation fking with lint 2022-11-24 22:40:30 +01:00
3fa8c4b18f Add build for amd64 & arm64 arch + start of publish steps 2022-11-24 22:30:03 +01:00
11e9677d1a Split wheel and tarball dist into separate make cmds 2022-11-24 22:29:50 +01:00
8 changed files with 87 additions and 107 deletions

View File

@@ -17,8 +17,10 @@ steps:
image: python:3.10 image: python:3.10
commands: commands:
- make dist - make dist
- pip3 install -r requirements.txt - pip3 install pipenv
- pip3 install dist/*.whl - pipenv install
- pipenv sync
- pipenv install dist/delugeClient_kevin-0.3.1-py3-none-any.whl
# - pipenv install pytest # - pipenv install pytest
# - name: Run tests # - name: Run tests
@@ -42,49 +44,24 @@ steps:
- pip3 install delugeClient-kevin -q -q - pip3 install delugeClient-kevin -q -q
- bash publish_version?.sh - bash publish_version?.sh
- name: PyPi verify - name: Test PyPi publish
image: python:3.10 image: python:3.10
commands: commands:
- make dist - make dist
- pip3 install -r requirements.txt
- pip3 install twine - pip3 install twine
- twine check dist/* - twine check dist/*
- twine upload --repository delugeClient-kevin dist/*
- name: PyPi test publish
image: python:3.10
environment:
TWINE_USERNAME:
from_secret: TWINE_USERNAME
TWINE_PASSWORD:
from_secret: TWINE_TEST_PASSWORD
commands:
- make dist
- pip3 install twine
- twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- name: PyPi publish - name: PyPi publish
image: python:3.10 image: python:3.10
environment: commands:
TWINE_USERNAME: - make dist
from_secret: TWINE_USERNAME - pip3 install pipenv
TWINE_PASSWORD: - pipenv install
from_secret: TWINE_PASSWORD - pipenv sync
commands: - pipenv install twine
- make dist # - pipenv run twine upload dist/*
- pip3 install twine
- twine upload dist/*
depends_on: depends_on:
- Build and test amd64 - Build and test amd64
trigger:
branch:
- master
event:
exclude:
- pull_request
---
kind: signature
hmac: 60604a21f35e11d078d5d381bbea8e25b903175c018ba9e6f4a4379285e89883
...

111
README.md
View File

@@ -4,20 +4,23 @@
<h4 align="center"> A easy to use Deluge CLI that can connect to Deluge RPC (even over ssh) written entirely in python.</h4> <h4 align="center"> A easy to use Deluge CLI that can connect to Deluge RPC (even over ssh) written entirely in python.</h4>
| Tested version | PyPi package | License | | Tested version | PyPi package | Drone CI |
|:--------|:------|:------| |:--------|:------|:------|
| [![PyVersion](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/) | [![PyPI](https://img.shields.io/pypi/v/delugeClient_kevin)](https://pypi.org/project/delugeClient_kevin/) |[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) | [![PyVersion](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/) | [![PyPI](https://img.shields.io/pypi/v/delugeClient_kevin)](https://pypi.org/project/delugeClient_kevin/) | [![Build Status](https://drone.schleppe.cloud/api/badges/KevinMidboe/delugeClient/status.svg)](https://drone.schleppe.cloud/KevinMidboe/delugeClient)
| Drone CI | Known vulnerabilities |
| Known vulnerabilities | License |
|:--------|:------| |:--------|:------|
| [![Build Status](https://drone.schleppe.cloud/api/badges/KevinMidboe/delugeClient/status.svg)](https://drone.schleppe.cloud/KevinMidboe/delugeClient) | [![Known Vulnerabilities](https://snyk.io/test/github/kevinmidboe/delugeClient/badge.svg?targetFile=requirements.txt)](https://snyk.io/test/github/kevinmidboe/delugeClient?targetFile=requirements.txt) | [![Known Vulnerabilities](https://snyk.io/test/github/kevinmidboe/delugeClient/badge.svg?targetFile=requirements.txt)](https://snyk.io/test/github/kevinmidboe/delugeClient?targetFile=requirements.txt) |[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
<p align="center"> <p align="center">
<a href="#abstract">Abstract</a> <a href="#abstract">Abstract</a>
<a href="#install">Install</a> <a href="#setup_virtualenv">Setup virtualenv</a>
<a href="#usage">Usage</a>
<a href="#setup_virtualenv">Setup Virtual Environment</a>
<a href="#configure">Configure</a> <a href="#configure">Configure</a>
<a href="#installation">Install dependencies</a>
<a href="#usage">Usage</a>
<a href="#running">Running</a>
<a href="#contributing">Contributing</a> <a href="#contributing">Contributing</a>
</p> </p>
@@ -25,51 +28,6 @@
## <a name="abstract"></a> Abstract ## <a name="abstract"></a> Abstract
Create a deluge python client for interfacing with deluge for common tasks like listing, adding, removing and setting download directory for torrents. Create a deluge python client for interfacing with deluge for common tasks like listing, adding, removing and setting download directory for torrents.
## <a name="install"></a> Install
Install from source:
```bash
python3 setup.py install
```
Install from pip:
```bash
pip3 install delugeClient-kevin
```
## <a name="usage"></a> Usage
View delugeClient cli options with `delugeclient --help`:
```
Usage: python -m delugeclient [OPTIONS] COMMAND [ARGS]...
╭─ Options ───────────────────────────────────────────────────────────────╮
│ --debug Set log level to debug │
│ --info Set log level to info │
│ --warning Set log level to warning │
│ --error Set log level to error │
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell │
│ --help Show this message and exit. │
╰─────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────╮
│ add Add magnet torrent │
│ disk Get free disk space │
│ get Get torrent by id or hash │
│ ls List all torrents │
│ remove Remove torrent by id or hash │
│ rm Remove torrent by name │
│ search Search for string segment in torrent name │
│ toggle Toggle torrent download state │
│ version Print package version │
╰─────────────────────────────────────────────────────────────────────────╯
```
### Running from source
Run from source for fun or during development using module flag:
```
python3 -m delugeClient --help
```
## <a name="setup_virtualenv"></a> Setup Virtual Environment ## <a name="setup_virtualenv"></a> Setup Virtual Environment
Virtual environment allows us to create a local environment for the requirements needed. Because pip does not download packages already downloaded to your system, we can use virtualenv to save our packages in the project folder. Virtual environment allows us to create a local environment for the requirements needed. Because pip does not download packages already downloaded to your system, we can use virtualenv to save our packages in the project folder.
@@ -83,7 +41,7 @@ To install virtualenv, simply run:
``` ```
### Virtualenv setup ### Usage
After you have downloaded this project go to it in your terminal by going to the folder you downloaded and typing the following: After you have downloaded this project go to it in your terminal by going to the folder you downloaded and typing the following:
@@ -100,6 +58,8 @@ The to setup a virtual environment enter this:
> If you get an error now it might be because you don't have python3.10, please make sure you have python version 3.10 if else you can download it from [here](https://www.python.org/downloads/) > If you get an error now it might be because you don't have python3.10, please make sure you have python version 3.10 if else you can download it from [here](https://www.python.org/downloads/)
First we navigate to the folder we downloaded.
Then we use the ```virtualenv``` command to create a ```env``` subdirectory in our project. This is where pip will download everything to and where we can add other specific python versions. Then we need to *activate* our virtual environment by doing: Then we use the ```virtualenv``` command to create a ```env``` subdirectory in our project. This is where pip will download everything to and where we can add other specific python versions. Then we need to *activate* our virtual environment by doing:
``` ```
@@ -136,6 +96,51 @@ Then you need to change the HOST and PORT to reflect the address for your deluge
$ cat /home/USER/.config/deluge/auth $ cat /home/USER/.config/deluge/auth
``` ```
## <a name="install"></a> Install Required Dependencies
Now that we have our virutalenv set up and activated we want to install all the necessary packages listed in `requirements.txt`. To install it's dependencies do the following:
```
$ pip install -r requirements.txt
```
Now we have our neccessary packages installed!
## <a name="usage"></a> Usage
```
Custom delugeRPC client
Usage:
deluge_cli add MAGNET [DIR] [--debug | --warning | --error]
deluge_cli get TORRENT
deluge_cli ls [--downloading | --seeding | --paused]
deluge_cli toggle TORRENT
deluge_cli rm TORRENT [--debug | --warning | --error]
deluge_cli (-h | --help)
deluge_cli --version
Arguments:
MAGNET Magnet link to add
DIR Directory to save to
TORRENT A selected torrent
Options:
-h --help Show this screen
--version Show version
--debug Print all debug log
--warning Print only logged warnings
--error Print error messages (Error/Warning)
```
### <a name="running"></a> Running
To interface with deluged :
```
$ ./deluge_cli.py ls
```
## <a name="contributing"></a> Contributing ## <a name="contributing"></a> Contributing
- Fork it! - Fork it!
- Create your feature branch: git checkout -b my-new-feature - Create your feature branch: git checkout -b my-new-feature

View File

@@ -2,14 +2,12 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
from sys import path from sys import path
from os.path import dirname, join, abspath from os.path import dirname, join
SCRIPT_DIR = dirname(abspath(__file__)) path.append(dirname(__file__))
path.append(dirname(SCRIPT_DIR))
import logging import logging
from delugeClient.utils import BASE_DIR from utils import BASE_DIR
from delugeClient.deluge import Deluge
def addHandler(handler): def addHandler(handler):
handler.setFormatter(formatter) handler.setFormatter(formatter)

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python3.10 #!/usr/bin/env python3.10
import os import os
import sys import sys
import signal import signal
@@ -7,10 +8,10 @@ import logging
import typer import typer
from pprint import pprint from pprint import pprint
from delugeClient.deluge import Deluge from deluge import Deluge
from delugeClient.utils import ColorizeFilter, BASE_DIR, validHash, convertFilesize from utils import ColorizeFilter, BASE_DIR, validHash, convertFilesize
from delugeClient.__version__ import __version__ from __version__ import __version__
from delugeClient.__init__ import addHandler from __init__ import addHandler
ch = logging.StreamHandler() ch = logging.StreamHandler()
ch.addFilter(ColorizeFilter()) ch.addFilter(ColorizeFilter())

View File

@@ -1,4 +1,4 @@
__version__ = '0.3.5' __version__ = '0.3.1'
if __name__ == '__main__': if __name__ == '__main__':
print(__version__) print(__version__)

View File

@@ -9,9 +9,9 @@ import logging.config
from deluge_client import DelugeRPCClient, FailedToReconnectException from deluge_client import DelugeRPCClient, FailedToReconnectException
from sshtunnel import SSHTunnelForwarder, BaseSSHTunnelForwarderError from sshtunnel import SSHTunnelForwarder, BaseSSHTunnelForwarderError
from utils import getConfig, BASE_DIR
from delugeClient.utils import getConfig, BASE_DIR from torrent import Torrent
from delugeClient.torrent import Torrent
logger = logging.getLogger('deluge_cli') logger = logging.getLogger('deluge_cli')

View File

@@ -2,7 +2,7 @@ import json
import logging import logging
from distutils.util import strtobool from distutils.util import strtobool
from delugeClient.utils import convert from utils import convert
logger = logging.getLogger('deluge_cli') logger = logging.getLogger('deluge_cli')
@@ -44,5 +44,5 @@ class Torrent(object):
return json.dumps(torrentDict) return json.dumps(torrentDict)
def __str__(self): def __str__(self):
return "{} Progress: {}% ETA: {} State: {} Paused: {}".format( return "{} {} Progress: {}% ETA: {} State: {} Paused: {}".format(
self.name[:59].ljust(60), self.progress.rjust(5), self.eta.rjust(11), self.state.ljust(12), self.paused) self.key, self.name[:59].ljust(60), self.progress.rjust(5), self.eta.rjust(11), self.state.ljust(12), self.paused)

View File

@@ -32,7 +32,6 @@ setup(
classifiers=[ classifiers=[
'Programming Language :: Python', 'Programming Language :: Python',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.10',
], ],
entry_points={ entry_points={