Set up the initial project structure
- Create a bash script to set up a virtual environment - Implement config.ini loading with debug option - Create a basic torrent listing and slow print functionality
This commit is contained in:
commit
3f4fa3c10d
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
config.ini
|
||||||
|
venv
|
22
main.py
Normal file
22
main.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import configparser
|
||||||
|
import qbittorrent
|
||||||
|
import time
|
||||||
|
|
||||||
|
# Load config
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read("config.ini")
|
||||||
|
qbittorrent_client = config["DEFAULT"]["QBITTORRENT_CLIENT"]
|
||||||
|
debug = config["DEFAULT"].getboolean("DEBUG")
|
||||||
|
|
||||||
|
# Connect to qbittorrent
|
||||||
|
qb = qbittorrent.Client(qbittorrent_client)
|
||||||
|
torrents = qb.torrents()
|
||||||
|
|
||||||
|
# Debug info
|
||||||
|
if debug:
|
||||||
|
print(f"[DEBUG]: There are {len(torrents)} torrents")
|
||||||
|
|
||||||
|
# List torrents
|
||||||
|
for torrent in torrents:
|
||||||
|
print(torrent["name"])
|
||||||
|
time.sleep(2)
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
python-qbittorrent==0.4.3
|
18
tarch
Executable file
18
tarch
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Create a virtual environment if it does not exist
|
||||||
|
if [ ! -d "venv" ]; then
|
||||||
|
python3 -m venv venv && \
|
||||||
|
source venv/bin/activate && \
|
||||||
|
pip install -r requirements.txt && \
|
||||||
|
deactivate
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate the virtual environment
|
||||||
|
source venv/bin/activate
|
||||||
|
|
||||||
|
# Run the Python script
|
||||||
|
python main.py "$@"
|
||||||
|
|
||||||
|
# Deactivate the virtual environment
|
||||||
|
deactivate
|
Loading…
Reference in New Issue
Block a user