annotate qbittorrent_update.py @ 133:0d8eabdd12ab default tip

create: write H:MM:SS timestamps, add option to fill with gaussian-blur instead of black many albums are longer than one hour so writing H:MM:SS is a necessity. if anything there will just be verbose info that isn't important for my use-case. however the gaussian-blur is simply broken. It works, and it plays locally just fine, but YouTube in particular elongates the video to fit the full width. I'm not entirely sure why it does this, but it makes it useless and ugly.
author Paper <paper@tflc.us>
date Sat, 03 Jan 2026 20:25:38 -0500
parents 8be9281d7ade
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
62
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
1 """
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
2 qBittorrent Updater for Windows (x64)
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
3 by Paper
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
4
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
5 This could be easily ported to macOS/Linux, but for the former it
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
6 would just be easier to do it in AppleScript, and for the latter
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
7 you should already be using a package manager to do this for you.
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
8 """
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
9 import urllib.request
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
10 import re
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
11 import psutil
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
12 import os
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
13 import platform
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
14 import time
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
15
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
16
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
17 def _check_running(exename):
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
18 for proc in psutil.process_iter():
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
19 try:
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
20 if proc.name() == exename:
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
21 return True
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
22 except psutil.NoSuchProcess as err:
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
23 return False
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
24 except psutil.AccessDenied:
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
25 return False
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
26
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
27
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
28 QBITTORRENT_DIRECTORY = "C:\\Program Files\\qBittorrent"
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
29 TEMP_DIRECTORY = os.getenv("TEMP")
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
30 BIT_STR = "_x64" if platform.machine().endswith('64') else ""
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
31
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
32 if _check_running("qbittorrent.exe"):
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
33 print("qBittorrent is currently running! Please exit it and try again.")
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
34 quit(1)
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
35
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
36 # Get the link for the latest version, courtesy of SourceForge
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
37 urllib.request.urlretrieve(re.search("\<a href=\"(https:\/\/sourceforge\.net\/projects\/qbittorrent\/files\/qbittorrent-win32\/qbittorrent-[0-9\.]+\/qbittorrent_[0-9\.]+" + BIT_STR + "_setup\.exe\/download)\"\>", urllib.request.urlopen("https://www.qbittorrent.org/download.php").read().decode("utf-8")).group(1), os.path.join(TEMP_DIRECTORY, "qbittorrent_setup.exe"))
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
38
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
39 # Run the installer and wait for it to finish
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
40 os.system(os.path.join(TEMP_DIRECTORY, "qbittorrent_setup.exe") + " /S")
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
41 while _check_running("qbittorrent_setup.exe"):
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
42 time.sleep(5)
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
43
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
44 # Cleanup
8be9281d7ade Add `qbittorrent_update.py`
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
45 os.remove(os.path.join(TEMP_DIRECTORY, "qbittorrent_setup.exe"))