Skip to content

Commit ebb4262

Browse files
committed
Merge branch 'pr/NaruZosa/252' into decluttarr-v2
2 parents 43b2589 + 2e6973b commit ebb4262

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+848
-744
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ venv
99
temp
1010
.notebooks
1111
**/old/
12-
logs/*
12+
logs/*
13+
.idea/*

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"tests"
77
],
88
"python.testing.unittestEnabled": false,
9-
"python.testing.pytestEnabled": true,
9+
"python.testing.pytestEnabled": true
1010
}

CONTRIBUTING.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Table of contents
44
- [Overview](#overview)
5-
- [Feature Requests](#feature--requests)
6-
- [Bug Reports](#bug--reports)
7-
- [Code Contributions](#code--contributions)
5+
- [Feature Requests](#feature-requests)
6+
- [Bug Reports](#bug-reports)
7+
- [Code Contributions](#code-contributions)
88

99
## Overview
1010
Thank you for wanting to contribute to this project.
@@ -27,7 +27,7 @@ Please go follow these steps to submit a bug:
2727
- Create meaningful logs by:
2828
1) Switch decluttarr to debug mode (setting LOG_LEVEL: DEBUG)
2929
2) Turn off all remove functions but one where you expect a removal (example: REMOVE_STALLED: True and the rest on False)
30-
3) Let it run until the supposed remove should be trigged
30+
3) Let it run until the supposed remove should be triggered
3131
4) Paste the full logs to a pastebin
3232
5) Share your settings (docker-compose or config.conf)
3333
6) Optional: If helpful, share screenshots showing the problem (from your arr-app or qbit)
@@ -40,23 +40,23 @@ Code contributions are very welcome - thanks for helping improve this app!
4040
3) Only commit code that you have written yourself and is not owned by anybody else
4141
4) Create a PR against the "dev" branch
4242
5) Be responsive to code review
43-
5) Once the code is reviewed and OK, it will be merged to dev branch, which will create the "dev"-docker image
44-
6) Help testing that the dev image works
45-
7= Finally, we will then commit the change to the main branch, which will create the "latest"-docker image
43+
6) Once the code is reviewed and OK, it will be merged to dev branch, which will create the "dev"-docker image
44+
7) Help testing that the dev image works
45+
8) Finally, we will then commit the change to the main branch, which will create the "latest"-docker image
4646

4747
You do not need to know about how to create docker images to contribute here.
4848
To get started:
4949
1) Create a fork of decluttarr
5050
2) Clone the git repository from the dev branch to your local machine `git clone -b dev https://github.com/yourName/decluttarr`
51-
2) Create a virtual python environment (`python3 -m venv venv`)
52-
3) Activate the virtual environment (`source venv/bin/activate`)
53-
4) Install python libraries (`pip install -r docker/requirements.txt`)
54-
5) Adjust the config/config.conf to your needs
55-
6) Adjust the code in the files as needed
56-
7) Run the script (`python3 main.py`)
57-
8) Push your changes to your own git repo and use a descriptive name for the branch name (e.g. add-feature-to-xyz; bugfix-xyz)
58-
9) Test the dev-image it creates automatically
59-
10) Create the PR from your repo to ManiMatter/decluttarr (dev branch)
60-
11) Make sure all checks pass
61-
12) Squash your commits
62-
13) Test that the docker image works that was created when you pushed to your fork
51+
3) Create a virtual python environment (`python3 -m venv venv`)
52+
4) Activate the virtual environment (`source venv/bin/activate`)
53+
5) Install python libraries (`pip install -r docker/requirements.txt`)
54+
6) Adjust the config/config.conf to your needs
55+
7) Adjust the code in the files as needed
56+
8) Run the script (`python3 main.py`)
57+
9) Push your changes to your own git repo and use a descriptive name for the branch name (e.g. add-feature-to-xyz; bugfix-xyz)
58+
10) Test the dev-image it creates automatically
59+
11) Create the PR from your repo to ManiMatter/decluttarr (dev branch)
60+
12) Make sure all checks pass
61+
13) Squash your commits
62+
14) Test that the docker image works that was created when you pushed to your fork

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ _Like this app? Thanks for giving it a_ ⭐️
1111
- [Docker-compose with config file (recommended)](#docker-docker-compose-together-with-configyaml)
1212
- [Docker-compose only](#docker-specifying-all-settings-in-docker-compose)
1313
- [Explanation of the settings](#explanation-of-the-settings)
14-
- [General](#general)
14+
- [General](#general-settings)
1515
- [LOG_LEVEL](#log_level)
1616
- [TEST_RUN](#test_run)
1717
- [TIMER](#timer)
@@ -36,7 +36,7 @@ _Like this app? Thanks for giving it a_ ⭐️
3636
- [REMOVE_UNMONITORED](#remove_unmonitored)
3737
- [SEARCH_CUTOFF_UNMET_CONTENT](#search_unmet_cutoff_content)
3838
- [SEARCH_MISSING_CONTENT](#search_missing_content)
39-
- [Instances](#instances)
39+
- [Instances](#arr-instances)
4040
- [SONARR](#sonarr)
4141
- [RADARR](#radarr)
4242
- [READARR](#readarr)
@@ -64,7 +64,7 @@ Feature overview:
6464
- Removing downloads that are stalled (remove_stalled)
6565
- Removing downloads belonging to movies/series/albums etc. that have been marked as "unmonitored" (remove_unmonitored)
6666
- Periodically searching for better content on movies/series/albums etc. where cutoff has not been reached yet (search_cutoff_unmet_content)
67-
- Periodcially searching for missing content that has not yet been found (search_missing_content)
67+
- Periodically searching for missing content that has not yet been found (search_missing_content)
6868

6969

7070
Key behaviors:
@@ -91,7 +91,7 @@ How to run this:
9191
- The feature that distinguishes private and private trackers (private_tracker_handling, public_tracker_handling) does not work
9292
- Removal of bad files and <100% availability (remove_bad_files) does not work
9393
- If you see strange errors such as "found 10 / 3 times", consider turning on the setting "Reject Blocklisted Torrent Hashes While Grabbing". On nightly Radarr/Sonarr/Readarr/Lidarr/Whisparr, the option is located under settings/indexers in the advanced options of each indexer, on Prowlarr it is under settings/apps and then the advanced settings of the respective app
94-
- If you use qBittorrent and none of your torrents get removed and the verbose logs tell that all torrents are protected by the protected_tag even if they are not, you may be using a qBittorrent version that has problems with API calls and you may want to consider switching to a different qBit image (see https://github.com/ManiMatter/decluttarr/issues/56)
94+
- If you use qBittorrent and none of your torrents get removed and the verbose logs tell that all torrents are protected by the protected_tag even if they are not, you may be using a qBittorrent version that has problems with API calls, and you may want to consider switching to a different qBit image (see https://github.com/ManiMatter/decluttarr/issues/56)
9595
- Currently, “\*Arr” apps are only supported in English. Refer to issue https://github.com/ManiMatter/decluttarr/issues/132 for more details
9696
- If you experience yaml issues, please check the closed issues. There are different notations, and it may very well be that the issue you found has already been solved in one of the issues. Once you figured your problem, feel free to post your yaml to help others here: https://github.com/ManiMatter/decluttarr/issues/173
9797

@@ -125,13 +125,13 @@ jobs:
125125
### Running in docker
126126

127127
In docker, there are two ways how you can run decluttarr.
128-
The [recommendeded approach](#docker-docker-compose-together-with-configyaml) is to use a config.yaml file (similar to running the script [locally](#running-locally)).
128+
The [recommended approach](#docker-docker-compose-together-with-configyaml) is to use a config.yaml file (similar to running the script [locally](#running-locally)).
129129
Alternatively, you can put all settings [directly in your docker-compose](#docker-specifying-all-settings-in-docker-compose), which may bloat it a bit.
130130

131131

132132
#### Docker: Docker-compose together with Config.yaml
133133
1. Use the following input for your `docker-compose.yml`
134-
2. Download the config_example.yaml from the config folder (on github) and put it into your mounted folder
134+
2. Download the config_example.yaml from the config folder (on GitHub) and put it into your mounted folder
135135
3. Rename it to config.yaml and adjust the settings to your needs
136136
4. Run `docker-compose up -d` in the directory where the file is located to create the docker container
137137

@@ -162,7 +162,7 @@ If you want to have everything in docker compose:
162162
1. Use the following input for your `docker-compose.yml`
163163
2. Tweak the settings to your needs
164164
3. Remove the things that are commented out (if you don't need them), or uncomment them
165-
4. If you face problems with yaml formats etc, please first check the open and closed issues on github, before opening new ones
165+
4. If you face problems with yaml formats etc., please first check the open and closed issues on GitHub, before opening new ones
166166
5. Run `docker-compose up -d` in the directory where the file is located to create the docker container
167167

168168
Note: Always pull the "**latest**" version. The "dev" version is for testing only, and should only be pulled when contributing code or supporting with bug fixes
@@ -207,7 +207,7 @@ services:
207207
SEARCH_MISSING_CONTENT: True
208208

209209
# # --- OR: Jobs (with job-specific settings) ---
210-
# Alternatively, you can use the below notation, which for certain jobs allows you to set additioanl parameters
210+
# Alternatively, you can use the below notation, which for certain jobs allows you to set additional parameters
211211
# As written above, these can also be set as Job Defaults so you don't have to specify them as granular as below.
212212
# REMOVE_BAD_FILES: |
213213
# keep_archives: True
@@ -314,14 +314,14 @@ Configures the general behavior of the application (across all features)
314314
- Allows you to configure download client names that will be skipped by decluttarr
315315
Note: The names provided here have to 100% match with how you have named your download clients in your *arr application(s)
316316
- Type: List of strings
317-
- Is Mandatory: No (Defaults to [], ie. nothing ignored])
317+
- Is Mandatory: No (Defaults to [], i.e. nothing ignored])
318318

319319
#### PRIVATE_TRACKER_HANDLING / PUBLIC_TRACKER_HANDLING
320320

321321
- Defines what happens with private/public tracker torrents if they are flagged by a removal job
322322
- Note that this only works for qbittorrent currently (if you set up qbittorrent in your config)
323323
- "remove" means that torrents are removed (default behavior)
324-
- "skip" means they are disregarded (which some users might find handy to protect their private trackers prematurely, ie., before their seed targets are met)
324+
- "skip" means they are disregarded (which some users might find handy to protect their private trackers prematurely, i.e., before their seed targets are met)
325325
- "obsolete_tag" means that rather than being removed, the torrents are tagged. This allows other applications (such as [qbit_manage](https://github.com/StuffAnThings/qbit_manage) to monitor them and remove them once seed targets are fulfilled)
326326
- Type: String
327327
- Permissible Values: remove, skip, obsolete_tag
@@ -372,10 +372,10 @@ If a job has the same settings configured on job-level, the job-level settings w
372372
#### MAX_CONCURRENT_SEARCHES
373373

374374
- Only relevant together with search_unmet_cutoff_content and search_missing_content
375-
- Specified how many ites concurrently on a single arr should be search for in a given iteration
375+
- Specified how many ites concurrently on a single arr should be searched for in a given iteration
376376
- Each arr counts separately
377377
- Example: If your wanted-list has 100 entries, and you define "3" as your number, after roughly 30 searches you'll have all items on your list searched for.
378-
- Since the timer-setting steer how often the jobs run, if you put 10minutes there, after one hour you'll have run 6x, and thus already processed 18 searches. Long story short: No need to put a very high number here (else you'll just create unecessary traffic on your end..).
378+
- Since the timer-setting steer how often the jobs run, if you put 10minutes there, after one hour you'll have run 6x, and thus already processed 18 searches. Long story short: No need to put a very high number here (else you'll just create unnecessary traffic on your end.).
379379
- Type: Integer
380380
- Permissible Values: Any number
381381
- Is Mandatory: No (Defaults to 3)
@@ -389,12 +389,12 @@ This is the interesting section. It defines which job you want decluttarr to run
389389
- Steers whether files within torrents are marked as 'not download' if they match one of these conditions
390390
1) They are less than 100% available
391391
2) They are not one of the desired file types supported by the *arr apps:
392-
3) They contain one of these words (case insensitive) and are smaller than 500 MB:
392+
3) They contain one of these words (case-insensitive) and are smaller than 500 MB:
393393
- Trailer
394394
- Sample
395395

396396
- If all files of a torrent are marked as 'not download' then the torrent will be removed and blacklisted
397-
- Note that this is only supported when qBittorrent is configured in decluttarr and it will turn on the setting 'Keep unselected files in ".unwanted" folder' in qBittorrent
397+
- Note that this is only supported when qBittorrent is configured in decluttarr, and it will turn on the setting 'Keep unselected files in ".unwanted" folder' in qBittorrent
398398
- Type: Boolean or Dict
399399
- Permissible Values: True, False or keep_archives (bool)
400400
- Is Mandatory: No (Defaults to False)
@@ -431,8 +431,8 @@ This is the interesting section. It defines which job you want decluttarr to run
431431
- Permissible Values: True, False or max_strikes (int)
432432
- Is Mandatory: No (Defaults to False)
433433
- Note:
434-
- With max_strikes you can define how many time this torrent can be caught before being removed
435-
- Instead of configuring it here, you may also configure it as a default across all jobs or use the built-in defaults (see futher above under "Max_Strikes")
434+
- With max_strikes you can define how many times this torrent can be caught before being removed
435+
- Instead of configuring it here, you may also configure it as a default across all jobs or use the built-in defaults (see further above under "Max_Strikes")
436436

437437
#### REMOVE_MISSING_FILES
438438

@@ -455,7 +455,7 @@ This is the interesting section. It defines which job you want decluttarr to run
455455

456456
- Steers whether slow downloads are removed from the queue
457457
- Blocklisted: Yes
458-
- Note: Does not apply to usenet downloads (since there users pay for certain speed, slowness should not occurr)
458+
- Note: Does not apply to usenet downloads (since there users pay for certain speed, slowness should not occur)
459459
- Type: Boolean or Dict
460460
- Permissible Values:
461461
If bool: True, False

config/config_example.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ instances:
5858

5959
download_clients:
6060
qbittorrent:
61-
- base_url: "http://qbittorrent:8080" # You can use decluttar without qbit (not all features available, see readme).
61+
- base_url: "http://qbittorrent:8080" # You can use decluttarr without qbit (not all features available, see readme).
6262
# username: xxxx # (optional -> if not provided, assuming not needed)
6363
# password: xxxx # (optional -> if not provided, assuming not needed)
6464
# name: "qBittorrent" # (optional -> if not provided, assuming "qBittorrent". Must correspond with what is specified in your *arr as download client name)

docker/dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ COPY main.py main.py
3737
COPY src src
3838

3939

40-
# Install health check
40+
# Install health check
4141
RUN apt-get update && apt-get install -y --no-install-recommends procps && \
4242
apt-get clean && rm -rf /var/lib/apt/lists/*
4343
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \

docker/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ autoflake==2.3.1
1111
isort==5.13.2
1212
envyaml==1.10.211231
1313
demjson3==3.0.6
14+
ruff==0.11.11

main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import asyncio
2-
from src.settings.settings import Settings
32

4-
from src.utils.startup import launch_steps
5-
from src.utils.log_setup import logger
63
from src.job_manager import JobManager
4+
from src.settings.settings import Settings
5+
from src.utils.log_setup import logger
6+
from src.utils.startup import launch_steps
77

88
settings = Settings()
99
job_manager = JobManager(settings)

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.pylint]
2-
ignore = ".venv"
2+
ignore = [".venv", "old"]
33
ignore-patterns = ["__pycache__", ".pytest_cache"]
44
disable = [
55
"logging-fstring-interpolation", # W1203
@@ -9,6 +9,7 @@ disable = [
99
"missing-class-docstring", # C0115
1010
"missing-function-docstring", # C0116
1111
"line-too-long", # C0301
12+
"too-few-public-methods", # R0903
1213
]
1314

1415
[tool.pytest.ini_options]

ruff.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Exclude a variety of commonly ignored directories.
2+
exclude = [
3+
".bzr",
4+
".direnv",
5+
".eggs",
6+
".git",
7+
".git-rewrite",
8+
".hg",
9+
".ipynb_checkpoints",
10+
".mypy_cache",
11+
".nox",
12+
".pants.d",
13+
".pyenv",
14+
".pytest_cache",
15+
".pytype",
16+
".ruff_cache",
17+
".svn",
18+
".tox",
19+
".venv",
20+
".vscode",
21+
"__pypackages__",
22+
"_build",
23+
"buck-out",
24+
"build",
25+
"dist",
26+
"node_modules",
27+
"site-packages",
28+
"venv",
29+
]
30+
31+
# Assume Python 3.10
32+
target-version = "py310"
33+
34+
[lint]
35+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
36+
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
37+
# McCabe complexity (`C901`) by default.
38+
select = ["ALL"]
39+
ignore = ["D203", "D212", "E501"]
40+
41+
[lint.per-file-ignores]
42+
# "src/jobs/remove_bad_files.py" = ["ERA001"]
43+
"tests/settings/test__user_config_from_env.py" = ["S101"]
44+
"tests/jobs/test_strikes_handler.py" = ["S101", "SLF001"]
45+
"tests/jobs/test_remove_unmonitored.py" = ["S101", "SLF001"]
46+
"tests/jobs/test_remove_stalled.py" = ["S101", "SLF001"]
47+
"tests/jobs/test_remove_slow.py" = ["S101", "SLF001"]
48+
"tests/jobs/test_remove_orphans.py" = ["S101", "SLF001"]
49+
"tests/jobs/test_remove_missing_files.py" = ["S101", "SLF001"]
50+
"tests/jobs/test_remove_metadata_missing.py" = ["S101", "SLF001"]
51+
"tests/jobs/test_remove_failed_imports.py" = ["S101", "SLF001"]
52+
"tests/jobs/test_remove_failed_downloads.py" = ["S101", "SLF001"]
53+
"tests/jobs/test_remove_bad_files.py" = ["S101", "SLF001"]
54+
"tests/jobs/test_removal_handler.py" = ["S101", "SLF001"]

0 commit comments

Comments
 (0)