consertado o renamer para masi precisão

This commit is contained in:
2026-02-08 23:32:18 +00:00
parent 95a9bcd24d
commit e273233e38
4 changed files with 63 additions and 54 deletions

View File

@@ -195,12 +195,23 @@ class DirectoryWatcher:
return
self.current_process = None
# 4. DEPLOY FINAL
# 4. DEPLOY SEGURO
state.update_task(fname, 'running', 98, label="Organizando...")
# Monta caminho completo
final_full_path = Path(category.target_path) / relative_path
# Garante que a PASTA existe (Merge seguro)
# Se a pasta já existe, o mkdir(exist_ok=True) não faz nada (não apaga, não mexe)
final_full_path.parent.mkdir(parents=True, exist_ok=True)
# Tratamento de ARQUIVO duplicado
if final_full_path.exists():
# Se o arquivo já existe, apagamos ele para substituir pelo novo (Upgrade)
state.log(f"⚠️ Substituindo arquivo existente: {final_full_path.name}")
os.remove(str(final_full_path))
# Move APENAS o arquivo
shutil.move(str(temp_output), str(final_full_path))
if AppConfig.get_val('deploy_mode', 'move') == 'move':
@@ -209,8 +220,7 @@ class DirectoryWatcher:
await self.bot.send_notification(f"🎬 Organizado: `{full_details['title']}`")
state.update_task(fname, 'done', 100, label=f"{full_details['title']}")
state.current_file = ""
# Limpeza pasta vazia
# Limpeza pasta vazia
if AppConfig.get_val('cleanup_empty_folders', 'true') == 'true':
try:
parent = filepath.parent