diff --git a/README.md b/README.md index 2721cd2..bfd4d6e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ Matches `{id}.torrent` files against your qBittorrent session and updates NocoDB ## Requirements - Python 3.10+ -- No external dependencies ## Usage @@ -15,9 +14,8 @@ Matches `{id}.torrent` files against your qBittorrent session and updates NocoDB python xb_seed_status.py \ --id-folder ./torrents \ --bt-backup ~/.local/share/qBittorrent/BT_backup \ - --nocodb-url https://noco.example.com \ --table-id xxxxxxxxxxxxx \ - --api-token xc-xxxx + --api-token xx ``` ### CSV Mode (outputs file for manual import) @@ -34,18 +32,17 @@ python xb_seed_status.py \ ```bash python xb_seed_status.py \ --upload-csv seeds.csv \ - --nocodb-url https://noco.example.com \ --table-id xxxxxxxxxxxxx \ - --api-token xc-xxxx + --api-token xx ``` ## Flags | 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 | -| `--nocodb-url` | API modes | NocoDB base URL | +| `--nocodb-url` | No | NocoDB base URL (default: `https://xb.constantprojects.com`) | | `--table-id` | API modes | Table ID | | `--api-token` | API modes | API token (`xc-token`) | | `--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) | | `--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 - **Table ID**: Click `...` next to table name → Copy Table ID diff --git a/xb_seed_status.py b/xb_seed_status.py index 0ee9ace..744a664 100644 --- a/xb_seed_status.py +++ b/xb_seed_status.py @@ -1,26 +1,4 @@ #!/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 csv @@ -302,14 +280,13 @@ def main(): Examples: # API mode - update NocoDB directly: %(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: %(prog)s --id-folder ./torrents --bt-backup /path/to/BT_backup --csv-only # Upload a CSV generated by someone else: - %(prog)s --upload-csv seeds.csv --nocodb-url https://noco.example.com \\ - --table-id tblXXXXX --api-token xc-xxxx + %(prog)s --upload-csv seeds.csv --table-id tblXXXXX --api-token xx """ ) @@ -319,8 +296,8 @@ Examples: help="Path to qBittorrent's BT_backup folder") # NocoDB API options - parser.add_argument('--nocodb-url', type=str, default=None, - help='NocoDB base URL (e.g., http://localhost:8080)') + parser.add_argument('--nocodb-url', type=str, default='https://xb.constantprojects.com', + help='NocoDB base URL (default: https://xb.constantprojects.com)') parser.add_argument('--table-id', type=str, default=None, help='NocoDB table ID (starts with "tbl")') parser.add_argument('--api-token', type=str, default=None, @@ -342,8 +319,8 @@ Examples: if not args.upload_csv.exists(): print(f"Error: CSV file not found: {args.upload_csv}", file=sys.stderr) sys.exit(1) - if not all([args.nocodb_url, args.table_id, args.api_token]): - print("Error: --upload-csv requires --nocodb-url, --table-id, and --api-token", file=sys.stderr) + if not all([args.table_id, args.api_token]): + print("Error: --upload-csv requires --table-id and --api-token", file=sys.stderr) sys.exit(1) else: 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'}") if use_api: - if not all([args.nocodb_url, args.table_id, args.api_token]): - print("Error: API mode requires --nocodb-url, --table-id, and --api-token", file=sys.stderr) + if not all([args.table_id, args.api_token]): + 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) sys.exit(1) noco = NocoDBClient(