mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-17 17:26:14 +08:00
Fixes #359
This commit is contained in:
parent
1f7db1f57b
commit
42baacdadc
6 changed files with 68 additions and 7 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
4.0.9-develop3
|
||||
4.0.9-develop4
|
||||
|
|
|
@ -3,6 +3,7 @@ from collections import Counter
|
|||
|
||||
from modules import util
|
||||
from modules.torrent_hash_generator import TorrentHashGenerator
|
||||
from modules.util import remove_extension
|
||||
|
||||
logger = util.logger
|
||||
|
||||
|
@ -109,7 +110,7 @@ class CrossSeed:
|
|||
self.notify_attr = []
|
||||
# Tag missing cross-seed torrents tags
|
||||
for torrent in self.qbt.torrent_list:
|
||||
t_name = torrent.name
|
||||
t_name = remove_extension(torrent.name)
|
||||
t_cat = torrent.category
|
||||
if (
|
||||
not util.is_tag_in_torrent("cross-seed", torrent.tags)
|
||||
|
|
|
@ -4,6 +4,7 @@ from qbittorrentapi import TrackerStatus
|
|||
from modules import util
|
||||
from modules.util import TorrentMessages
|
||||
from modules.util import list_in_text
|
||||
from modules.util import remove_extension
|
||||
|
||||
logger = util.logger
|
||||
|
||||
|
@ -209,7 +210,7 @@ class RemoveUnregistered:
|
|||
"torrent_tracker": tracker["url"],
|
||||
"notifiarr_indexer": tracker["notifiarr"],
|
||||
}
|
||||
if self.qbt.torrentinfo[self.t_name]["count"] > 1:
|
||||
if self.qbt.torrentinfo[remove_extension(self.t_name)]["count"] > 1:
|
||||
# Checks if any of the original torrents are working
|
||||
if "" in self.t_msg or 2 in self.t_status:
|
||||
attr["torrents_deleted_and_contents"] = False
|
||||
|
@ -232,4 +233,4 @@ class RemoveUnregistered:
|
|||
attr["body"] = "\n".join(body)
|
||||
self.torrents_updated_unreg.append(self.t_name)
|
||||
self.notify_attr_unreg.append(attr)
|
||||
self.qbt.torrentinfo[self.t_name]["count"] -= 1
|
||||
self.qbt.torrentinfo[remove_extension(self.t_name)]["count"] -= 1
|
||||
|
|
|
@ -4,6 +4,7 @@ from time import time
|
|||
|
||||
from modules import util
|
||||
from modules.util import is_tag_in_torrent
|
||||
from modules.util import remove_extension
|
||||
from modules.webhooks import GROUP_NOTIFICATION_LIMIT
|
||||
|
||||
logger = util.logger
|
||||
|
@ -78,7 +79,7 @@ class ShareLimits:
|
|||
t_deleted_and_contents = set()
|
||||
for torrent_hash, torrent_dict in self.tdel_dict.items():
|
||||
torrent = torrent_dict["torrent"]
|
||||
t_name = torrent.name
|
||||
t_name = remove_extension(torrent.name)
|
||||
t_count = self.qbt.torrentinfo[t_name]["count"]
|
||||
t_msg = self.qbt.torrentinfo[t_name]["msg"]
|
||||
t_status = self.qbt.torrentinfo[t_name]["status"]
|
||||
|
|
|
@ -13,6 +13,7 @@ from modules import util
|
|||
from modules.util import Failed
|
||||
from modules.util import TorrentMessages
|
||||
from modules.util import list_in_text
|
||||
from modules.util import remove_extension
|
||||
|
||||
logger = util.logger
|
||||
|
||||
|
@ -135,7 +136,7 @@ class Qbt:
|
|||
if torrent.auto_tmm is False and settings["force_auto_tmm"] and torrent.category != "" and not self.config.dry_run:
|
||||
torrent.set_auto_management(True)
|
||||
try:
|
||||
torrent_name = torrent.name
|
||||
torrent_name = remove_extension(torrent.name)
|
||||
torrent_hash = torrent.hash
|
||||
torrent_is_complete = torrent.state_enum.is_complete
|
||||
save_path = torrent.save_path
|
||||
|
|
|
@ -14,6 +14,63 @@ import ruamel.yaml
|
|||
logger = logging.getLogger("qBit Manage")
|
||||
|
||||
|
||||
def remove_extension(filename):
|
||||
video_extensions = [
|
||||
".3gp",
|
||||
".3g2",
|
||||
".asf",
|
||||
".avi",
|
||||
".divx",
|
||||
".flv",
|
||||
".m2ts",
|
||||
".m4v",
|
||||
".mkv",
|
||||
".mov",
|
||||
".mp2",
|
||||
".mp4",
|
||||
".mpe",
|
||||
".mpeg",
|
||||
".mpg",
|
||||
".mpv",
|
||||
".mts",
|
||||
".mxf",
|
||||
".ogg",
|
||||
".ogv",
|
||||
".qt",
|
||||
".rm",
|
||||
".rmvb",
|
||||
".ts",
|
||||
".vob",
|
||||
".webm",
|
||||
".wmv",
|
||||
]
|
||||
audio_extensions = [
|
||||
".aac",
|
||||
".aiff",
|
||||
".ape",
|
||||
".au",
|
||||
".flac",
|
||||
".m4a",
|
||||
".m4b",
|
||||
".mka",
|
||||
".mp3",
|
||||
".ogg",
|
||||
".opus",
|
||||
".ra",
|
||||
".rm",
|
||||
".wav",
|
||||
".wma",
|
||||
]
|
||||
all_extensions = video_extensions + audio_extensions
|
||||
# Split the filename into base and extension parts
|
||||
base, extension = os.path.splitext(filename)
|
||||
# If there's an extension, return the base part
|
||||
if extension in all_extensions:
|
||||
return base
|
||||
else:
|
||||
return filename
|
||||
|
||||
|
||||
def get_list(data, lower=False, split=True, int_list=False):
|
||||
"""Return a list from a string or list."""
|
||||
if data is None:
|
||||
|
@ -277,7 +334,7 @@ class check:
|
|||
elif var_type == "float":
|
||||
try:
|
||||
data[attribute] = float(data[attribute])
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if isinstance(data[attribute], float) and data[attribute] >= min_int:
|
||||
return data[attribute]
|
||||
|
|
Loading…
Add table
Reference in a new issue