remove file
This commit is contained in:
parent
b5dca02805
commit
6fece7cca2
@ -1,88 +0,0 @@
|
|||||||
#!/usr/bin/python3
|
|
||||||
#
|
|
||||||
# qBittorrent-api:
|
|
||||||
# https://qbittorrent-api.readthedocs.io/en/v2023.4.47/introduction.html
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Make sure to set the folling variables.
|
|
||||||
# <USERNAME>
|
|
||||||
# <SERVER IP ADDRESS>
|
|
||||||
# <PORT>
|
|
||||||
#
|
|
||||||
#
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import logging
|
|
||||||
import qbittorrentapi
|
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
||||||
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
logging.warning('[ACAT] - *** STARTING ASSIGN CATEGORY SCRIPT ***')
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
|
|
||||||
# qbittorrent webui login crendentials.
|
|
||||||
qbitt_username = '<USERNAME>'
|
|
||||||
qbitt_password = '<PASSWORD>'
|
|
||||||
|
|
||||||
# qbittorrent webui address.
|
|
||||||
#url = 'http://192.168.1.55:8080'
|
|
||||||
url = 'http://<SERVER IP ADDRESS>:<PORT>'
|
|
||||||
|
|
||||||
# The categories to use for matching torrents. Change as needed.
|
|
||||||
category_1080_shows = "1080+ | Shows"
|
|
||||||
category_1080_movies = "1080+ | Movies"
|
|
||||||
|
|
||||||
# Connect to the qBittorrent API
|
|
||||||
qb = qbittorrentapi.Client(host=url)
|
|
||||||
|
|
||||||
# Log in qbittorrent API
|
|
||||||
qb.auth_log_in(username=qbitt_username, password=qbitt_password)
|
|
||||||
|
|
||||||
# Get information about all torrents in the download queue
|
|
||||||
torrents = qb.torrents_info()
|
|
||||||
|
|
||||||
# loop through the torrents
|
|
||||||
for torrent in torrents:
|
|
||||||
|
|
||||||
# Get the name of the completed torrent from the command line arguments inside qbittorrent
|
|
||||||
torrent_name = sys.argv[1] # Name of the added torrent as defined by "%N" in qbittorrent settings.
|
|
||||||
torrent_hash = sys.argv[2] # Hash of the added torrent as defined by "%I" in qbittorrent settings.
|
|
||||||
|
|
||||||
# Define the regular expression pattern for 'SxxExx' or 'sxxexx' format.
|
|
||||||
pattern = r"[Ss]\d{2}[Ee]\d{2}"
|
|
||||||
|
|
||||||
# Check for 'SxxExx' or 'sxxexx' episode pattern and '1080p' or '2160p'
|
|
||||||
# If so, assign 1080 show category.
|
|
||||||
if re.search(pattern, torrent_name) and ("1080p" in torrent_name or "2160p" in torrent_name):
|
|
||||||
qb.torrents_set_category(category=category_1080_shows, hashes=torrent_hash)
|
|
||||||
qb.torrents_set_auto_management(hashes=torrent_hash, enable=True)
|
|
||||||
|
|
||||||
# Then check for movies criteria.
|
|
||||||
elif ("1080p" in torrent_name or "2160p" in torrent_name) and "YTS.MX" in torrent_name:
|
|
||||||
qb.torrents_set_category(category=category_1080_movies, hashes=torrent_hash)
|
|
||||||
qb.torrents_set_auto_management(hashes=torrent_hash, enable=True)
|
|
||||||
|
|
||||||
# Logging and printing the raw torrent name and what category it was changed to
|
|
||||||
logging.warning(f'[ACAT] - raw torrent name: {torrent_name}')
|
|
||||||
logging.warning(f'[ACAT] - raw torrent hash: {torrent_hash}')
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
|
|
||||||
logging.warning(f'[ACAT] - Torrent "{torrent_name}" category was changed to: "{category_1080_movies}".')
|
|
||||||
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
logging.warning('[ACAT] - *** ENDING ASSIGN CATEGORY SCRIPT ***')
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
logging.warning('[ACAT] - -------------')
|
|
||||||
|
|
||||||
# Disconnect from the qBittorrent API
|
|
||||||
qb.auth_log_out()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user