Skip to content

Commit

Permalink
fix: nit formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
buroa committed Aug 27, 2023
1 parent 60697bf commit 5b69830
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions qbittools/commands/reannounce.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ def process_downloading():
expired = t.time_active > 60 * 60

if expired and (not working or t.num_seeds == 0) and t.progress == 0:
logger.warning("[%s] is inactive for too long, not reannouncing...", t.name)
logger.warning(f"[{t.name}] is inactive for too long, not reannouncing...")

elif (invalid or not working) and t.time_active < 60:
if invalid and args.pause_resume:
logger.warning("[%s] is invalid, active for %ss, pausing/resuming...", t.name, t.time_active)
logger.warning(f"[{t.name}] is invalid, active for {t.time_active}s, pausing/resuming...")
t.pause()
t.resume()

logger.info("[%s] is not working, active for %ss, reannouncing...", t.name, t.time_active)
logger.info(f"[{t.name}] is not working, active for {t.time_active}s, reannouncing...")
t.reannounce()

elif t.num_seeds == 0 and t.progress == 0:
if t.time_active < 120 or (t.time_active >= 120 and iterations % 2 == 0):
logger.info("[%s] has no seeds, active for %ss, reannouncing...", t.name, t.time_active)
logger.info(f"[{t.name}] has no seeds, active for {t.time_active}s, reannouncing...")
t.reannounce()
else:
wait = (2 - iterations % 2) * timeout
logger.info("[%s] has no seeds, active for %ss, waiting %s...", t.name, t.time_active, wait)
logger.info(f"[{t.name}] has no seeds, active for {t.time_active}s, waiting {wait}...")

def process_seeding():
torrents = client.torrents.info(status_filter="seeding", sort="time_active")
Expand All @@ -50,11 +50,11 @@ def process_seeding():

if invalid or not working:
if invalid and args.pause_resume:
logger.warning("[%s] is invalid, active for %ss, pausing/resuming...", t.name, t.time_active)
logger.warning(f"[{t.name}] is invalid, active for {t.time_active}s, pausing/resuming...")
t.pause()
t.resume()

logger.info("[%s] is not working, active for %ss, reannouncing...", t.name, t.time_active)
logger.info(f"[{t.name}] is not working, active for {t.time_active}s, reannouncing...")
t.reannounce()

logger.info("Started reannounce process")
Expand All @@ -75,7 +75,7 @@ def process_seeding():
def add_arguments(subparser):
parser = subparser.add_parser("reannounce")

parser.add_argument('--pause-resume', action='store_true', help='Will pause/resume torrents that are invalid.')
parser.add_argument('--process-seeding', action='store_true', help='Will also process seeding torrents for reannouncements.')
parser.add_argument("--pause-resume", action="store_true", help="Pause+resume torrents that are invalid.")
parser.add_argument("--process-seeding", action="store_true", help="Include seeding torrents for reannouncements.")

qbittools.add_default_args(parser)

0 comments on commit 5b69830

Please sign in to comment.