Add docker functionality

This commit is contained in:
Jon 2021-11-21 14:34:55 -05:00
parent f0af005a87
commit 57e98f0f8a
No known key found for this signature in database
GPG key ID: 9665BA6CF5DC2671
10 changed files with 244 additions and 2 deletions

21
.dockerignore Normal file
View file

@ -0,0 +1,21 @@
**/dist
**/build
*.spec
**/__pycache__
/.vscode
**/log
README.md
LICENSE
.gitignore
.dockerignore
.git
.github
.vscode
*.psd
config/**/*
config
Dockerfile
venv
.idea
test.py
!config/config.yml.sample

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
github: bobokun

38
.github/workflows/develop.yml vendored Normal file
View file

@ -0,0 +1,38 @@
name: Docker Develop Release
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
docker-develop:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
with:
ref: develop
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/qbit_manage:develop

36
.github/workflows/latest.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: Docker Latest Release
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
docker-latest:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/qbit_manage:latest

18
.github/workflows/tag.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: Tag
on:
push:
branches: [ master ]
jobs:
tag-new-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
fetch-depth: 2
- uses: salsify/action-detect-and-tag-new-version@v1.0.3
with:
version-command: |
cat VERSION

39
.github/workflows/version.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Docker Version Release
on:
create:
tags:
- v*
jobs:
docker-develop:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/qbit_manage:${{ steps.get_version.outputs.VERSION }}

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.log* *.log*
*.yml *.yml
.vscode/settings.json .vscode/*
!.github/**

10
Dockerfile Normal file
View file

@ -0,0 +1,10 @@
FROM python:3.9-slim
COPY requirements.txt /
RUN echo "**** install python packages ****" \
&& pip3 install --no-cache-dir --upgrade --requirement /requirements.txt \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /requirements.txt /tmp/* /var/tmp/* /var/lib/apt/lists/*
COPY . /
VOLUME /config
ENTRYPOINT ["python3","qbit_manage.py"]

78
config.yml.sample Normal file
View file

@ -0,0 +1,78 @@
# qBittorrent parameters
qbt:
host: "localhost:8080"
user: "username"
pass: "password"
directory:
# Do not remove these
# Cross-seed var: </your/path/here/> #Output directory of cross-seed
# root_dir var: </your/path/here/> #Root downloads directory used to check for orphaned files and used in RecycleBin
# <OPTIONAL> remote_dir var: </your/path/here/> # Path of docker host mapping of root_dir. Must be set if you are using docker!
cross_seed: "/your/path/here/"
root_dir: "/data/torrents/"
remote_dir: "/mnt/user/data/torrents/"
# Category/Pathing Parameters
cat:
# <Category Name> : <save_path> #Path of your save directory. Can be a keyword or full path
movies: "/data/torrents/Movies"
tv: "TV"
# Tag Parameters
tags:
# <Tracker URL Keyword>: <Tag Name>
animebytes.tv: AnimeBytes
avistaz: Avistaz
beyond-hd: Beyond-HD
blutopia: Blutopia
cartoonchaos: CartoonChaos
digitalcore: DigitalCore
gazellegames: GGn
hdts: HDTorrents
landof.tv: BroadcasTheNet
myanonamouse: MaM
passthepopcorn: PassThePopcorn
privatehd: PrivateHD
tleechreload: TorrentLeech
torrentdb: TorrentDB
torrentleech: TorrentLeech
tv-vault: TV-Vault
#Tag Movies/Series that are not hard linked
nohardlinks:
# Mandatory to fill out directory parameter above to use this function (root_dir/remote_dir)
# This variable should be set to your category name of your completed movies/completed series in qbit. Acceptable variable can be any category you would like to tag if there are no hardlinks found
movies-completed:
#<OPTIONAL> exclude_tags var: Will exclude the following tags when searching through the category.
exclude_tags:
- Beyond-HD
- AnimeBytes
- MaM
#<OPTIONAL> cleanup var: WARNING!! Setting this as true Will remove and delete contents of any torrents that are in paused state and has the NoHL tag
cleanup: false
#<OPTIONAL> max_ratio var: Will set the torrent Maximum share ratio until torrent is stopped from seeding/uploading
max_ratio: 4.0
#<OPTIONAL> seeding time var: Will set the torrent Maximum seeding time (min) until torrent is stopped from seeding
max_seeding_time: 86400
#Can have additional categories set with separate ratio/seeding times defined.
series-completed:
#<OPTIONAL> exclude_tags var: Will exclude the following tags when searching through the category.
exclude_tags:
- Beyond-HD
- BroadcasTheNet
#<OPTIONAL> cleanup var: WARNING!! Setting this as true Will remove and delete contents of any torrents that are in paused state and has the NoHL tag
cleanup: false
#<OPTIONAL> max_ratio var: Will set the torrent Maximum share ratio until torrent is stopped from seeding/uploading
max_ratio: 4.0
#<OPTIONAL> seeding time var: Will set the torrent Maximum seeding time (min) until torrent is stopped from seeding
max_seeding_time: 86400
#Recycle Bin method of deletion will move files into the recycle bin instead of directly deleting them in qbit
recyclebin:
enabled: true
#<OPTIONAL> empty_after_x_days var: Will automatically remove all files and folders in recycle bin after x days.
# If this variable is not defined it, the RecycleBin will never be emptied.
# Setting this variable to 0 will delete files immediately.
empty_after_x_days: 60

View file

@ -285,7 +285,7 @@ def recheck():
logger.info(f'\n - Resuming {new_tag} - {torrent.name}') logger.info(f'\n - Resuming {new_tag} - {torrent.name}')
torrent.resume() torrent.resume()
#Recheck #Recheck
elif torrent.progress == 0 and torrentdict[torrent.name]['is_complete']: elif torrent.progress == 0 and torrentdict[torrent.name]['is_complete'] and 'checking' not in torrent.state:
if args.dry_run == 'dry_run': if args.dry_run == 'dry_run':
logger.dryrun(f'\n - Not Rechecking {new_tag} - {torrent.name}') logger.dryrun(f'\n - Not Rechecking {new_tag} - {torrent.name}')
else: else: