Skip to content

Commit

Permalink
Version 2.0 (#34)
Browse files Browse the repository at this point in the history
- Remove docker and RPi integrations
- Upgrade to python3
- Migrate to click package for CLI
- Fix some MacOS issues, use fswatch cross-platform file notification instead of inotify
  • Loading branch information
datashaman authored Oct 5, 2021
1 parent 72bc2ff commit 1700e92
Show file tree
Hide file tree
Showing 32 changed files with 427 additions and 874 deletions.
4 changes: 2 additions & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ engines:
enabled: true
config:
languages:
- python
- python
fixme:
enabled: true
radon:
enabled: true
ratings:
paths:
- "**.py"
- "**.py"
exclude_paths: []
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
*pyc
/application.db
/application.log
/AUTHORS
/build/
/ChangeLog
Expand All @@ -9,5 +7,5 @@
/.eggs/
/.env
/*.egg-info/
/README.rst
/putio.log
/tmp/
40 changes: 0 additions & 40 deletions Dockerfile

This file was deleted.

48 changes: 0 additions & 48 deletions Dockerfile.development

This file was deleted.

40 changes: 0 additions & 40 deletions Dockerfile.template

This file was deleted.

44 changes: 1 addition & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
TAG = datashaman/putio-automator

HOST_DOWNLOADS = `pwd`/tmp/downloads
HOST_INCOMPLETE = `pwd`/tmp/incomplete
HOST_TORRENTS = `pwd`/tmp/torrents
Expand All @@ -9,48 +7,8 @@ clean:
find . -name '*.pyc' -delete
rm -rf build dist .eggs putio_automator.egg-info sdist tmp/*/*

restart-watcher:
sudo supervisorctl restart watcher

docker-run:
docker run --rm -it \
--privileged \
-e CHECK_DOWNLOADS_EVERY=2 \
-e LOG_LEVEL=DEBUG \
-e PUTIO_TOKEN=$(PUTIO_TOKEN) \
-e DOWNLOADS=/files/downloads \
-e INCOMPLETE=/files/incomplete \
-e TORRENTS=/files/torrents \
-p 9001:80 \
-v $(HOST_DOWNLOADS):/files/downloads \
-v $(HOST_INCOMPLETE):/files/incomplete \
-v $(HOST_TORRENTS):/files/torrents \
$(TAG)

docker-bash:
docker run --rm -it \
-e PUTIO_TOKEN=$(PUTIO_TOKEN) \
-p 9001:80 \
-v $(HOST_INCOMPLETE):/files/incomplete \
-v $(HOST_DOWNLOADS):/files/downloads \
-v $(HOST_TORRENTS):/files/torrents \
$(TAG) /bin/bash

docker-push:
docker push $(TAG)

docker-prune-stopped:
docker ps -a -q | xargs -r docker rm

docker-prune-untagged:
docker images | grep '^<none>' | awk '{print $$3}' | xargs -r docker rmi

docker-prune: docker-prune-stopped docker-prune-untagged

# npm i -g marked-toc --save
# apt install pandoc
readme-generate:
toc
# toc
cat -s README.md > /tmp/readme && mv /tmp/readme README.md
pandoc -f markdown -t rst README.md > README.rst
sed -i '/.. raw:: html/,+3d' README.rst
Expand Down
44 changes: 5 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ A suite of commands for managing torrents, transfers and files on **Put.IO**
Configure Sickrage to use a Torrent black hole folder. Configure this application to
monitor that folder and download to the same folder used for post-processing in Sickrage.

**Note** Version 2 drops Docker and RPi support. The application should still run just fine in both contexts; however it is no longer directly supported.

## Table of Contents

<!-- toc -->
Expand All @@ -16,42 +18,30 @@ monitor that folder and download to the same folder used for post-processing in
* [Files](#files)
* [Transfers](#transfers)
* [Database](#database)
* [Advanced Usage](#advanced-usage)
* [Docker](#docker)

<!-- toc stop -->

## Installation

Install the putio-automator package locally for your user (recommended):
Install the putio-automator package locally **for your user**. System-wide installation is not supported.

pip install --user putio-automator

This will install a new command-line utility `putio` in `$HOME/.local/bin`. Ensure it's on your path:

echo 'PATH=$HOME/.local/bin:$PATH' >> .profile # or .bashrc or .zshrc, ymmv

Or for all users on your machine (not recommended):

sudo -H pip install putio-automator

This will install a new command-line utility `putio` in `/usr/local/bin` or similar. It should be on your path already.

## Configuration

Initialize the application with a basic configuration locally for your user (recommended):
Initialize the application with a basic configuration locally for your user:

putio config init

Or for all users on your machine (not recommended):

putio config init --site

This will interactively prompt you with some questions about where files should be stored, and your **Put.IO** `OAuth Token`.

To get an `OAuth Token` register your application on **Put.IO**, and copy the `OAuth Token` (found under the key icon).

**NB** The directories entered must have world-write permissions (until I figure out how to do permissions cleanly).
**NB** The directories entered must be writable by the user running the application.

Check that the connection is working:

Expand Down Expand Up @@ -142,27 +132,3 @@ The application records downloads in a SQLite database, so you don't inadvertent

* name
A substring found in the filename.

## Advanced Usage

### Docker

To pull the latest docker image:

putio docker pull

To run an application container that manages downloads for you on an optional schedule:

putio docker run [-s START_HOUR] [-e END_HOUR] [-c CHECK_DOWNLOADS_EVERY] [-t TAG]

* -s START_HOUR, --start_hour START_HOUR
The hour to start downloads. Defaults to 0.
* -e END_HOUR, --end_hour END_HOUR
The hour to end downloads. Defaults to 24 (same as 0).
* -c CHECK_DOWNLOADS_EVERY, --check_downloads_every CHECK_DOWNLOADS_EVERY.
Defaults to 15 (minutes).
* -t TAG, --tag TAG
Defaults to datashaman/putio-automator.

The docker container will use your configured directories to watch for torrents and download files. You can view the supervisor console at [http://localhost:9001](http://localhost:9001).

Loading

0 comments on commit 1700e92

Please sign in to comment.