-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,297 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
**/*sample* | ||
**/*settings.py | ||
**/.flake8 | ||
**/__pycache__ | ||
**/logs | ||
**/data | ||
**/local | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md | ||
logs/ | ||
*.db | ||
*settings.py | ||
local/ | ||
|
||
.vscode/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[flake8] | ||
ignore = E203, E501, W503 | ||
exclude = .git,__pycache__,docs,build,dist,logs | ||
max-line-length = 88 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
data/ | ||
local/ | ||
logs/ | ||
*.db | ||
*settings.py | ||
|
||
.vscode/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM python:3.9-alpine | ||
|
||
LABEL Name=Searcharr Version=1.0.0 | ||
|
||
WORKDIR /app | ||
ADD . /app | ||
|
||
RUN apk add --no-cache --virtual .build-deps gcc musl-dev libffi-dev openssl-dev python3-dev | ||
|
||
RUN python3 -m pip install --upgrade pip | ||
RUN python3 -m pip install -r requirements.txt | ||
|
||
CMD ["python3", "searcharr.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Searcharr | ||
## Sonarr & Radarr Telegram Bot | ||
### By Todd Roberts | ||
https://github.com/toddrob99/searcharr | ||
|
||
This bot allows users to add movies to Radarr and series to Sonarr via Telegram messaging app. | ||
|
||
## Setup & Run | ||
|
||
### Configure | ||
|
||
Rename `settings-sample.py` to `settings.py`, and edit the settings within the file as necessary. | ||
|
||
You are required to update the following settings, at minimum: | ||
|
||
* Searcharr Bot > Password | ||
* Telegram Bot > Token | ||
* Sonarr > URL, API Key, Quality Profile ID | ||
* Radarr > URL, API Key, Quality Profile ID | ||
|
||
### Docker & Docker-Compose | ||
|
||
Docker is the suggested method to run Searcharr. Be sure to map the following in your Docker container: | ||
|
||
* Settings file to /app/settings.py | ||
* Database folder to /app/data | ||
* Log folder to /app/logs | ||
|
||
A docker-compose.yml file is provided for your convenience. Update the volume mappings listed above, and then run `docker-compose up -d` to start Searcharr. | ||
|
||
### Run from Source | ||
|
||
If running from source, use Python 3.8.3+, install requirements using `python -m pip install -r requirements.txt`, and then run `searcharr.py`. | ||
|
||
## Use | ||
|
||
### Authenticate | ||
|
||
Send a private message to your bot saying `/start <password>`. | ||
|
||
**Caution**: This command will work in a group chat, but then everyone else in the group will see the password. If not all group members should be allowed to use the bot, then be sure to authenticate in a private message. | ||
|
||
### Search & Add a Series to Sonarr | ||
|
||
Send the bot a (private or group) message saying `/series <title>`. The bot will reply with information about the first result, along with buttons to move forward and back within the search results, pop out to tvdb or IMDb, add the current series to Sonarr, or cancel the search. When you click the button to add the series to Sonarr, the bot will ask what root folder to put the series in--unless you only have one root folder configured in Sonarr, in which case it will add it straight away. | ||
|
||
### Search & Add a Movie to Radarr | ||
|
||
Send the bot a (private or group) message saying `/movie <title>`. The bot will reply with information about the first result, along with buttons to move forward and back within the search results, pop out to IMDb, add the current movie to Radarr, or cancel the search. When you click the button to add the movie to Radarr, the bot will ask what root folder to put the movie in--unless you only have one root folder configured in Radarr, in which case it will add it straight away. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.0' | ||
services: | ||
searcharr: | ||
container_name: searcharr | ||
image: toddrob/searcharr:latest | ||
volumes: | ||
- ./data:/app/data | ||
- ./logs:/app/logs | ||
- ./settings.py:/app/settings.py | ||
environment: | ||
- TZ=America/New_York | ||
restart: unless-stopped | ||
network_mode: host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
Searcharr | ||
Sonarr & Radarr Telegram Bot | ||
Log Helper | ||
By Todd Roberts | ||
https://github.com/toddrob99/searcharr | ||
""" | ||
import logging | ||
import os | ||
|
||
|
||
def set_up_logger(logger_name, verbose, console): | ||
if verbose: | ||
rootLogger = logging.getLogger() | ||
rootLogger.setLevel(logging.DEBUG) | ||
|
||
logger = logging.getLogger(logger_name) | ||
logger.setLevel(logging.DEBUG if verbose else logging.INFO) | ||
|
||
formatter = logging.Formatter( | ||
"%(asctime)s - %(levelname)8s - %(name)s(%(thread)s):%(lineno)d - %(message)s" | ||
) | ||
|
||
if console: | ||
ch = logging.StreamHandler() | ||
ch.setFormatter(formatter) | ||
logger.addHandler(ch) | ||
|
||
fileName = f"{logger_name}.log" | ||
logPath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "logs") | ||
if not os.path.exists(logPath): | ||
os.makedirs(logPath) | ||
fh = logging.handlers.TimedRotatingFileHandler( | ||
os.path.join(logPath, fileName), when="midnight", interval=1, backupCount=7 | ||
) | ||
fh.setFormatter(formatter) | ||
logger.addHandler(fh) | ||
|
||
return logger |
Oops, something went wrong.