From 6951f29a26a99b8f4c450738a153d99a1200d315 Mon Sep 17 00:00:00 2001
From: Jeffrey Serio <hyperreal@moonshadow.dev>
Date: Sun, 6 Apr 2025 06:41:51 -0500
Subject: [PATCH] Use uv in shebang

---
 python/fetch_combined_trackers_list.py | 1 +
 python/fetch_scihub_infohashes.py      | 1 +
 python/list_torrents.py                | 1 +
 python/qbt_sum_size.py                 | 3 ++-
 python/resend_notify.py                | 1 +
 python/scihub_knapsack.py              | 1 +
 python/seed_armbian_torrents.py        | 1 +
 python/sync_from_remotes.py            | 1 +
 python/update_tracker.py               | 1 +
 python/{yaml2json => yaml2json.py}     | 1 +
 shell/natpmpcd                         | 6 +-----
 11 files changed, 12 insertions(+), 6 deletions(-)
 rename python/{yaml2json => yaml2json.py} (94%)

diff --git a/python/fetch_combined_trackers_list.py b/python/fetch_combined_trackers_list.py
index efa20e7..31f9cf5 100755
--- a/python/fetch_combined_trackers_list.py
+++ b/python/fetch_combined_trackers_list.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "requests",
diff --git a/python/fetch_scihub_infohashes.py b/python/fetch_scihub_infohashes.py
index 84fdb7f..8f60989 100755
--- a/python/fetch_scihub_infohashes.py
+++ b/python/fetch_scihub_infohashes.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "requests",
diff --git a/python/list_torrents.py b/python/list_torrents.py
index c607806..3a69ee1 100755
--- a/python/list_torrents.py
+++ b/python/list_torrents.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "qbittorrent-api",
diff --git a/python/qbt_sum_size.py b/python/qbt_sum_size.py
index f5fd7b7..d7e91c8 100755
--- a/python/qbt_sum_size.py
+++ b/python/qbt_sum_size.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "qbittorrent-api",
@@ -8,7 +9,7 @@
 """qbt_sum_size.py
 
 Description:
-Get the total size of all added torrents and the total size of all completed 
+Get the total size of all added torrents and the total size of all completed
 torrents from a qBittorrent instance.
 
 Usage:
diff --git a/python/resend_notify.py b/python/resend_notify.py
index c6f597e..fdcb672 100755
--- a/python/resend_notify.py
+++ b/python/resend_notify.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "resend",
diff --git a/python/scihub_knapsack.py b/python/scihub_knapsack.py
index 49d2661..2556db4 100755
--- a/python/scihub_knapsack.py
+++ b/python/scihub_knapsack.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "qbittorrent-api",
diff --git a/python/seed_armbian_torrents.py b/python/seed_armbian_torrents.py
index cb72390..d85d37d 100755
--- a/python/seed_armbian_torrents.py
+++ b/python/seed_armbian_torrents.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 # "qbittorrent-api",
diff --git a/python/sync_from_remotes.py b/python/sync_from_remotes.py
index 68efeaa..4c2bde5 100755
--- a/python/sync_from_remotes.py
+++ b/python/sync_from_remotes.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "resend",
diff --git a/python/update_tracker.py b/python/update_tracker.py
index 8a73a6c..e1a6bab 100755
--- a/python/update_tracker.py
+++ b/python/update_tracker.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "qbittorrent-api",
diff --git a/python/yaml2json b/python/yaml2json.py
similarity index 94%
rename from python/yaml2json
rename to python/yaml2json.py
index f7a582b..0187392 100755
--- a/python/yaml2json
+++ b/python/yaml2json.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env -S uv run --script
 # /// script
 # dependencies = [
 #   "yaml",
diff --git a/shell/natpmpcd b/shell/natpmpcd
index afc3d4d..6d60b69 100755
--- a/shell/natpmpcd
+++ b/shell/natpmpcd
@@ -1,11 +1,7 @@
 #!/bin/sh
 
 port=$(/usr/local/bin/natpmpc -a 1 0 udp 60 -g 10.2.0.1 | grep "Mapped public port" | awk '{print $4}')
-
-sed -i.bak 's|Session\\Port=[[:digit:]]*|Session\\Port='"${port}"'|g' /var/db/qbittorrent/conf/qBittorrent/config/qBittorrent.conf
-
-killall -HUP qbittorrent-nox
-service qbittorrent start
+echo $port | tee /usr/local/etc/natvpn_port.txt
 
 while true; do
     date