Compare commits
1 Commits
a12814d271
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24f5c2753b |
16
README.md
16
README.md
@@ -5,7 +5,6 @@ Matches `{id}.torrent` files against your qBittorrent session and updates NocoDB
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Python 3.10+
|
- Python 3.10+
|
||||||
- No external dependencies
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -15,9 +14,8 @@ Matches `{id}.torrent` files against your qBittorrent session and updates NocoDB
|
|||||||
python xb_seed_status.py \
|
python xb_seed_status.py \
|
||||||
--id-folder ./torrents \
|
--id-folder ./torrents \
|
||||||
--bt-backup ~/.local/share/qBittorrent/BT_backup \
|
--bt-backup ~/.local/share/qBittorrent/BT_backup \
|
||||||
--nocodb-url https://noco.example.com \
|
|
||||||
--table-id xxxxxxxxxxxxx \
|
--table-id xxxxxxxxxxxxx \
|
||||||
--api-token xc-xxxx
|
--api-token xx
|
||||||
```
|
```
|
||||||
|
|
||||||
### CSV Mode (outputs file for manual import)
|
### CSV Mode (outputs file for manual import)
|
||||||
@@ -34,18 +32,17 @@ python xb_seed_status.py \
|
|||||||
```bash
|
```bash
|
||||||
python xb_seed_status.py \
|
python xb_seed_status.py \
|
||||||
--upload-csv seeds.csv \
|
--upload-csv seeds.csv \
|
||||||
--nocodb-url https://noco.example.com \
|
|
||||||
--table-id xxxxxxxxxxxxx \
|
--table-id xxxxxxxxxxxxx \
|
||||||
--api-token xc-xxxx
|
--api-token xx
|
||||||
```
|
```
|
||||||
|
|
||||||
## Flags
|
## Flags
|
||||||
|
|
||||||
| Flag | Required | Description |
|
| Flag | Required | Description |
|
||||||
|------|----------|-------------|
|
|------|----------|-------------|
|
||||||
| `--id-folder` | Scan modes | Folder containing `{id}.torrent` files |
|
| `--id-folder` | Scan modes | Folder containing `{id}.torrent` files (see [ID Folder](#id-folder)) |
|
||||||
| `--bt-backup` | Scan modes | qBittorrent's `BT_backup` folder |
|
| `--bt-backup` | Scan modes | qBittorrent's `BT_backup` folder |
|
||||||
| `--nocodb-url` | API modes | NocoDB base URL |
|
| `--nocodb-url` | No | NocoDB base URL (default: `https://xb.constantprojects.com`) |
|
||||||
| `--table-id` | API modes | Table ID |
|
| `--table-id` | API modes | Table ID |
|
||||||
| `--api-token` | API modes | API token (`xc-token`) |
|
| `--api-token` | API modes | API token (`xc-token`) |
|
||||||
| `--csv-only` | No | Skip API, output CSV instead |
|
| `--csv-only` | No | Skip API, output CSV instead |
|
||||||
@@ -53,6 +50,11 @@ python xb_seed_status.py \
|
|||||||
| `--upload-csv` | No | Upload a CSV file to NocoDB (skip torrent scanning) |
|
| `--upload-csv` | No | Upload a CSV file to NocoDB (skip torrent scanning) |
|
||||||
| `--debug` | No | Print API request/response details |
|
| `--debug` | No | Print API request/response details |
|
||||||
|
|
||||||
|
## ID Folder
|
||||||
|
|
||||||
|
The `--id-folder` should point to the sanitized site export folder. You can download it from:
|
||||||
|
https://tankserver.org/u/torrents%20-%20sanitized.7z
|
||||||
|
|
||||||
## Finding NocoDB IDs
|
## Finding NocoDB IDs
|
||||||
|
|
||||||
- **Table ID**: Click `...` next to table name → Copy Table ID
|
- **Table ID**: Click `...` next to table name → Copy Table ID
|
||||||
|
|||||||
@@ -1,26 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
|
||||||
Seed Tracker - Match torrent files against qBittorrent session.
|
|
||||||
|
|
||||||
Compares {id}.torrent files against qBittorrent's BT_backup folder to determine
|
|
||||||
which torrents are actively seeding, then updates a NocoDB database with the
|
|
||||||
seeding user's name. Used for tracking who is seeding shared backup torrents.
|
|
||||||
|
|
||||||
Matching is done by:
|
|
||||||
1. Info hash (exact match)
|
|
||||||
2. Name + size fallback (for re-created torrents with different hashes)
|
|
||||||
|
|
||||||
Requirements:
|
|
||||||
- Python 3.10+
|
|
||||||
- No external dependencies (uses only stdlib)
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
python seed_tracker.py --id-folder ./torrents --bt-backup /path/to/BT_backup \\
|
|
||||||
--nocodb-url https://noco.example.com --table-id tblXXX --api-token xc-xxx
|
|
||||||
|
|
||||||
To find NocoDB IDs:
|
|
||||||
- Table ID: Click ... next to table name → Copy Table ID
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import csv
|
import csv
|
||||||
@@ -302,14 +280,13 @@ def main():
|
|||||||
Examples:
|
Examples:
|
||||||
# API mode - update NocoDB directly:
|
# API mode - update NocoDB directly:
|
||||||
%(prog)s --id-folder ./torrents --bt-backup ~/.local/share/qBittorrent/BT_backup \\
|
%(prog)s --id-folder ./torrents --bt-backup ~/.local/share/qBittorrent/BT_backup \\
|
||||||
--nocodb-url https://noco.example.com --table-id tblXXXXX --api-token xc-xxxx
|
--table-id tblXXXXX --api-token xx
|
||||||
|
|
||||||
# CSV mode - just output a file:
|
# CSV mode - just output a file:
|
||||||
%(prog)s --id-folder ./torrents --bt-backup /path/to/BT_backup --csv-only
|
%(prog)s --id-folder ./torrents --bt-backup /path/to/BT_backup --csv-only
|
||||||
|
|
||||||
# Upload a CSV generated by someone else:
|
# Upload a CSV generated by someone else:
|
||||||
%(prog)s --upload-csv seeds.csv --nocodb-url https://noco.example.com \\
|
%(prog)s --upload-csv seeds.csv --table-id tblXXXXX --api-token xx
|
||||||
--table-id tblXXXXX --api-token xc-xxxx
|
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -319,8 +296,8 @@ Examples:
|
|||||||
help="Path to qBittorrent's BT_backup folder")
|
help="Path to qBittorrent's BT_backup folder")
|
||||||
|
|
||||||
# NocoDB API options
|
# NocoDB API options
|
||||||
parser.add_argument('--nocodb-url', type=str, default=None,
|
parser.add_argument('--nocodb-url', type=str, default='https://xb.constantprojects.com',
|
||||||
help='NocoDB base URL (e.g., http://localhost:8080)')
|
help='NocoDB base URL (default: https://xb.constantprojects.com)')
|
||||||
parser.add_argument('--table-id', type=str, default=None,
|
parser.add_argument('--table-id', type=str, default=None,
|
||||||
help='NocoDB table ID (starts with "tbl")')
|
help='NocoDB table ID (starts with "tbl")')
|
||||||
parser.add_argument('--api-token', type=str, default=None,
|
parser.add_argument('--api-token', type=str, default=None,
|
||||||
@@ -342,8 +319,8 @@ Examples:
|
|||||||
if not args.upload_csv.exists():
|
if not args.upload_csv.exists():
|
||||||
print(f"Error: CSV file not found: {args.upload_csv}", file=sys.stderr)
|
print(f"Error: CSV file not found: {args.upload_csv}", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if not all([args.nocodb_url, args.table_id, args.api_token]):
|
if not all([args.table_id, args.api_token]):
|
||||||
print("Error: --upload-csv requires --nocodb-url, --table-id, and --api-token", file=sys.stderr)
|
print("Error: --upload-csv requires --table-id and --api-token", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
if not args.id_folder or not args.bt_backup:
|
if not args.id_folder or not args.bt_backup:
|
||||||
@@ -435,8 +412,8 @@ Examples:
|
|||||||
print(f"Mode: {'NocoDB API' if use_api else 'CSV output'}")
|
print(f"Mode: {'NocoDB API' if use_api else 'CSV output'}")
|
||||||
|
|
||||||
if use_api:
|
if use_api:
|
||||||
if not all([args.nocodb_url, args.table_id, args.api_token]):
|
if not all([args.table_id, args.api_token]):
|
||||||
print("Error: API mode requires --nocodb-url, --table-id, and --api-token", file=sys.stderr)
|
print("Error: API mode requires --table-id and --api-token", file=sys.stderr)
|
||||||
print(" Use --csv-only to skip API and just output CSV", file=sys.stderr)
|
print(" Use --csv-only to skip API and just output CSV", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
noco = NocoDBClient(
|
noco = NocoDBClient(
|
||||||
|
|||||||
Reference in New Issue
Block a user