Remove .unwanted folder before upload
Signed-off-by: anas <e.anastayyar@gmail.com>
This commit is contained in:
parent
3edae19881
commit
0eb896cebc
|
|
@ -73,7 +73,7 @@ def get_client() -> qba.TorrentsAPIMixIn:
|
||||||
qb_client = qba.Client(host="localhost", port=8090, username="admin", password="adminadmin")
|
qb_client = qba.Client(host="localhost", port=8090, username="admin", password="adminadmin")
|
||||||
try:
|
try:
|
||||||
qb_client.auth_log_in()
|
qb_client.auth_log_in()
|
||||||
qb_client.application.set_preferences({"disk_cache":64, "incomplete_files_ext":True, "max_connec":10000, "max_connec_per_torrent":1000, "async_io_threads":32, "preallocate_all":True, "upnp":True, "dl_limit":-1, "up_limit":-1, "dht":True, "pex":True, "lsd":True, "encryption":0, "queueing_enabled":True, "max_active_downloads":15, "max_active_torrents":50, "dont_count_slow_torrents":True, "bittorrent_protocol":0, "recheck_completed_torrents":True, "enable_multi_connections_from_same_ip":True, "slow_torrent_dl_rate_threshold":100,"slow_torrent_inactive_timer":600})
|
qb_client.application.set_preferences({"disk_cache":64, "incomplete_files_ext":True, "max_connec":3000, "max_connec_per_torrent":300, "async_io_threads":32, "preallocate_all":True, "upnp":True, "dl_limit":-1, "up_limit":-1, "dht":True, "pex":True, "lsd":True, "encryption":0, "queueing_enabled":True, "max_active_downloads":15, "max_active_torrents":50, "dont_count_slow_torrents":True, "bittorrent_protocol":0, "recheck_completed_torrents":True, "enable_multi_connections_from_same_ip":True, "slow_torrent_dl_rate_threshold":100,"slow_torrent_inactive_timer":600})
|
||||||
return qb_client
|
return qb_client
|
||||||
except qba.LoginFailed as e:
|
except qba.LoginFailed as e:
|
||||||
LOGGER.error(str(e))
|
LOGGER.error(str(e))
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import random
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
|
import shutil
|
||||||
|
|
||||||
import qbittorrentapi as qba
|
import qbittorrentapi as qba
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
|
@ -173,6 +174,9 @@ class qbittorrent:
|
||||||
for file in files:
|
for file in files:
|
||||||
if fnmatch(file, "*.!qB"):
|
if fnmatch(file, "*.!qB"):
|
||||||
os.remove(os.path.join(dirpath, file))
|
os.remove(os.path.join(dirpath, file))
|
||||||
|
for folder in subdir:
|
||||||
|
if fnmatch(folder, ".unwanted"):
|
||||||
|
shutil.rmtree(os.path.join(dirpath, folder))
|
||||||
if not os.listdir(dirpath):
|
if not os.listdir(dirpath):
|
||||||
os.rmdir(dirpath)
|
os.rmdir(dirpath)
|
||||||
self.listener.onDownloadComplete()
|
self.listener.onDownloadComplete()
|
||||||
|
|
|
||||||
|
|
@ -80,14 +80,14 @@ class MirrorListener(listeners.MirrorListeners):
|
||||||
path = fs_utils.zip(name, m_path)
|
path = fs_utils.zip(name, m_path)
|
||||||
else:
|
else:
|
||||||
path = fs_utils.tar(m_path)
|
path = fs_utils.tar(m_path)
|
||||||
try:
|
|
||||||
shutil.rmtree(m_path)
|
|
||||||
except:
|
|
||||||
os.remove(m_path)
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
LOGGER.info('File to archive not found!')
|
LOGGER.info('File to archive not found!')
|
||||||
self.onUploadError('Internal error occurred!!')
|
self.onUploadError('Internal error occurred!!')
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
|
shutil.rmtree(m_path)
|
||||||
|
except:
|
||||||
|
os.remove(m_path)
|
||||||
elif self.extract:
|
elif self.extract:
|
||||||
try:
|
try:
|
||||||
path = fs_utils.get_base_name(m_path)
|
path = fs_utils.get_base_name(m_path)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue